LowPowerLab Forum

Hardware support => Moteino => Topic started by: Digitalsarcasm on October 22, 2014, 06:57:31 PM

Title: RFM69 fundamentals of receiving
Post by: Digitalsarcasm on October 22, 2014, 06:57:31 PM
Hello, sorry i couldn't find anything that could answer my question.

For the RFM69, how is receiving done in respect to RX_Mode?
1. Does the module only start receiving when receiveDone() is called?
2.Does the module handle the transmission of a packet atomically (waiting for a whole packet to be received and put it in PAYLOAD)?
3.Does it ignore other transmitting modules while receiving a packet?

I'm asking because I plan on using multiple Moteinos where one is a server and the other are clients. I' m worried that the clients will overwrite each others packets due to race condition.

Thank you
Title: Re: RFM69 fundamentals of receiving
Post by: Felix on October 23, 2014, 08:17:50 AM
Hi,
1. The radio works in the packet mode (see datasheet). You put the data in the registers. Then you turn ON the TX module, that will modulate data into the medium (air). The receiver will have to be in RX mode to modulate that signal back into the registers of a receiver. When all conditions are met and packet is valid, an interrupt is raised to the MCU and the packet gets moved into the buffers of the RFM69 library.
So to receive something you have to be LISTENING. You can do that with receiveDone(). Which puts the RFM69 in RX mode, and also returns a TRUE if a packet is ready and waiting to be read.
2. The packet is transmitted atomically yes. Like I said above, the radio handles all the receiving and raw packet validation before it signals the MCU that a packet is waiting in the radio buffer.
3. The RFM69 library implements a simple CSMA scheme where it LISTENS before it TALKS. So in pricinpal all radios will listen for a "conversation" (RSSI above a certain threshold) before they start transmitting. This is to limit the chance of collisions with other transmitting nodes. Note that when a radio is actively receiving a signal, the sender is actively transmitting it. So one node is modulating bytes out, one is modulating them in. Like 2 people talking, you say words 1 at a time, one person talks, one person listens. Another person could interfere and start talking and then you can't understand anything, but the "rule" is: listen before you talk, if anyone is "talking" be polite and wait until they finish. I hope the illustration makes it easier to understand.