RFM69 variable packet mode question

Started by shailesh, November 30, 2017, 01:27:39 PM

shailesh

Hello,

I am working with the variable packet structure and have a question about what value to write in the first byte. I will explain why such a question because what I am seeing does not agree with the datasheet.

I have a packet with the following data (0xAA, 0xBB, 0xCC, 0xDD, 0x0D and 0x0A) These are six bytes in all. As a result I write the value 6 to the first byte followed by these 6 bytes. Then I write all 7 bytes to the FIFO and switch to transmit mode. However, I only receive the first 5 bytes and the byte 0x0A is not received. I read six bytes from the FIFO and the sixth byte is always 0x00. However, if I write 8 bytes to my FIFO, the byte 0x0A is received. What is going on here?

Regards,
Shailesh

iggardo


shailesh

No. My own. My question is a bit more device specific and less library related.

iggardo

Hi.

It's hard to guess what's going on without seeing the code.
May be a SPI problem. Grab an oscilloscope or logic analyzer to monitor SPI signals.
Felix library uses half-duplex SPI transactions and I'm using full duplex. Both working fine.
To avoid SPI data corruption talking with RFM69, do not use SPI speeds beyond 7Mhz.
4 to 6 Mhz will be fast enough. (datasheet lies about max 10Mhz).

Configuration settings on RFM69 registers are critical, so try fist the default from Lowpowerlab or My Sensors.

If you don't have proper equipment, my suggestion is to start from something is tested and working, as Felix's moteinos

Regards.

perky

Before delving deeper into this, can you confirm the following are true:

1) Both the transmitter and the receiver are in variable packet mode
2) You wait for PayloadReady before reading out the FIFO
3) The only change you made is to write an extra dummy byte to the FIFO when transmitting to get the 0x0A byte
4) The RegPayloadlength register is set to a large value

Note in variable packet mode RegPayloadlength register is not used in transmission but it is in reception, it should *greater* than your packet size. This is a protection mechanism against a corrupted received payload length byte causing the receiver to remain in receive mode for long periods.

Mark.

shailesh

Hello Mark,

to answer your questions:
1) Yes
2) I wait for the interrupt generated by Payload Ready. Then I check the CRC flag. If CRC is Ok, only then do I read out the FIFO. This hints strongly at the fact that the additional byte is not packeted at all.
3) Yes
4) It is set to 66. My packets are not longer than 63 bytes.

I have a follow up question. How does the RFM69 detect the end of a transmission when receiving in variable mode? Does it read the first byte in variable mode, let us say n and then read in n+2 bytes (CRC included) before generating a payload interrupt?

My question is still the same, say I am transmitting n bytes. Does this not mean that I write the value n to my first byte and then write the n+1 bytes to the FIFO? Why does this not work and why do i have to write n+2 bytes?

Thanks,
Shailesh