FPGA - nRF24L01 `RPI Net' server
Hi, Toying with `RPI Net server'. I can so far `semi-reliably' exchange single payload packets, only. When I try to exchange packets of multiple payloads, this is where things get interesting, as I have to try many times to push the whole packet through. Often `RPI' receives packets of bogus length bigger than 512, this is guarded by if-else, if ( (rx.hd.len <= MAX_PAYLOAD) && ..) else /* discard packet */ But even when discarded, still some parts of packet (headers) remain in the FIFO, that seems confusing next packet retransmission, leaving incorrect data in payloads. Even if try FLUSH_TX/RX to clear the FIFO queue, still communication is not reliable, especially when I try to send different messages, single payload followed by multiple payload ones. I realised NRF makes use of a FIFO, it keeps on queue the last three payloads. My understanding is that when FIFO is full, no other payloads can be written to. So one end must wait a little until the other reads out data to empty FIFO. This is possibly the trick of using some timing loops in the code. I needed to adjust some from 50ms to 5ms, to catch the transmission on RPI at all. Also I am not sure what happens, when automatic `ACK' is not received after all retries exhausted, or worst is missed. Is the payload with bad `CRC' or otherwise uncertain data freed from FIFO? After reading some more of the NRF specs, reading the code, I am not at all sure my understanding is correct. Many thanks. -- Tomas Kral <thomas.kral@email.cz>
Hi Tomas, On Fr, 2018-04-27 at 10:29 +0200, Tomas Kral wrote:
Hi,
Toying with `RPI Net server'.
I can so far `semi-reliably' exchange single payload packets, only. When I try to exchange packets of multiple payloads, this is where things get interesting, as I have to try many times to push the whole packet through.
I didn't closely follow your attempts to get a reliable connection. But your wording 'semi-reliably' reminds me of having read in another forum (Arduino perhaps) that in some circumstances (longer power supply wires) the nRF24L01 needs RF decoupling capacitors in order to function reliably. Maybe you've tried this already, but I thought that it could be worth a try if you haven't. Hellwig
On Fri, 27 Apr 2018 11:47:20 +0200 Hellwig Geisse <hellwig.geisse@mni.thm.de> wrote:
nRF24L01 needs RF decoupling capacitors in order to function reliably
Hi Hwllwig, Good point, I have thought about, but did not fit any cap yet. There seems different opinions about the capacity value, some claim fitting just small surface mount across VSS-GND pins is good enough, other have some elyts of 0.63uF and more. I am somehow led to believe I chase some bad timing loops. As small single payloads are acknowledged, semi-reliably. Longer packets once they got through, the RPI sends ACK back, that is missed by Oberon, which is not case with small packets, although reported as sent by RPI. After long packets got through, one end stops listening, then talks to confirm, while the other end is no longer listening, or not yet listening. Not any wiser. -- Tomas Kral <thomas.kral@email.cz>
Hi Tomas,
I am somehow led to believe I chase some bad timing loops... ...Not any wiser.
By now you have, I think, already achieved the equivalent of the most we ask of our students in the time protocol example, and then some. To go beyond the reception of a simple regular broadcast message is indeed, as you have found, very challenging. What I'm a bit concerned about is that you are describing a lot about the (assumed) operation of code, and very little about the specifics of the operation of the chip. A better understanding of the chip at the low-level would, I think, allow you to verify more, and assume less. For example, as described in section 7 of the datasheet, the nRF24L01 packet-transfer protocol in the chip (Nordic calls it "Enhanced ShockBurst[TM]") uses error-checking (a configurable-length CRC) to verify the packet contents, and drops the packet if the CRC does not match. So you won't be dealing with corrupt data (or control information), only missed packets - your "bogus length" is surely just data from later in the transmission, and somehow you have missed the packet containing the first 32 bytes - a framing error at a higher level, you might say. If you have the stamina (and it certainly seems you do) I would certainly encourage you to continue, because you are sharpening some very general skills on a very real-world problem! If you haven't already, I would advise you to make a very detailed study of section 9 of the datasheet, the register map. There's lots of interesting stuff here. For example, register 8, OBSERVE_TX, will give you a count of lost packets, ie packets transmitted but not acknowledged by the receiver (from the transmitter's point of view - the ack might have been sent but not received by the transmitter of course). In a simple test, this count should of course match the number of packets lost as inferred from the software trace. I hope you have by now dispensed with the library on the Pi and are talking to the chip yourself, controlling every aspect of its programming. After all, you have been doing this on the Oberon side, so the library offers little and is probably getting in the way of understanding - it may have helped in the beginning but I'm guessing you won't really be sure of some things unless you completely control them. And you do need to be sure. :) HTH Paul
Tomas As Paul said: RTFM :-) For low level programming this is VERY important to understand the meaning of every single bit. And in addition study SCC.Mod. What does SCC do? As the chip is meant to reliably transmit a maximum of 32 byte at once, you need some kind of additional mechanism or logic (could be called „protocol“) on top of the chips capability to enable packet transfer of arbitrary length (especially >32 byte) SCC implement this additional logic. What is the approach SCC takes? By studying the code, you will find that SCC defines an own header (that will be transported as part of the first 32 byte chunk) to communicate to the other side the overall length of the packet. This info helps the receiver to know upfront how many 32 byte chunks it has to receive to assemble the whole packet. Let’s assume the sender and receiver constantly exchange a stream of 32 byte. Without having exchanged the packet length, the receiver has no chance to decide whether the 32 byte chunk it just received is part of the previous packet or is the start of a new packet. There are other methods to do it (eg time based interpacket gap) but the header methods is in my view easier to start with. br Jörg
Am 29.04.2018 um 00:25 schrieb Paul Reed <paulreed@paddedcell.com>:
Hi Tomas,
I am somehow led to believe I chase some bad timing loops... ...Not any wiser.
By now you have, I think, already achieved the equivalent of the most we ask of our students in the time protocol example, and then some. To go beyond the reception of a simple regular broadcast message is indeed, as you have found, very challenging.
What I'm a bit concerned about is that you are describing a lot about the (assumed) operation of code, and very little about the specifics of the operation of the chip. A better understanding of the chip at the low-level would, I think, allow you to verify more, and assume less.
For example, as described in section 7 of the datasheet, the nRF24L01 packet-transfer protocol in the chip (Nordic calls it "Enhanced ShockBurst[TM]") uses error-checking (a configurable-length CRC) to verify the packet contents, and drops the packet if the CRC does not match.
So you won't be dealing with corrupt data (or control information), only missed packets - your "bogus length" is surely just data from later in the transmission, and somehow you have missed the packet containing the first 32 bytes - a framing error at a higher level, you might say.
If you have the stamina (and it certainly seems you do) I would certainly encourage you to continue, because you are sharpening some very general skills on a very real-world problem!
If you haven't already, I would advise you to make a very detailed study of section 9 of the datasheet, the register map. There's lots of interesting stuff here. For example, register 8, OBSERVE_TX, will give you a count of lost packets, ie packets transmitted but not acknowledged by the receiver (from the transmitter's point of view - the ack might have been sent but not received by the transmitter of course). In a simple test, this count should of course match the number of packets lost as inferred from the software trace.
I hope you have by now dispensed with the library on the Pi and are talking to the chip yourself, controlling every aspect of its programming. After all, you have been doing this on the Oberon side, so the library offers little and is probably getting in the way of understanding - it may have helped in the beginning but I'm guessing you won't really be sure of some things unless you completely control them. And you do need to be sure. :)
HTH Paul
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
On Sun, 29 Apr 2018 08:23:51 +0200 Jörg Straube <joerg.straube@iaeth.ch> wrote:
There are other methods to do it (eg time based interpacket gap) but the header methods is in my view easier to start with.
Hi Joerg, Read through, understood, thank you. Also looking at `Net.Mod', for sending files, I can see packet numbering is used, broken sequence then flags erroneous transmition. -- Tomas Kral <thomas.kral@email.cz>
On Sat, 28 Apr 2018 23:25:04 +0100 Paul Reed <paulreed@paddedcell.com> wrote:
I hope you have by now dispensed with the library on the Pi and are talking to the chip yourself
Hi Paul, Joerg, `RF24' is still basis of may `PI' end code, but I will try talking to chip directly as suggested, studying low level library code for that. Many thanks. -- Tomas Kral <thomas.kral@email.cz>
On Fri, 27 Apr 2018 11:47:20 +0200 Hellwig Geisse <hellwig.geisse@mni.thm.de> wrote:
having read in another forum (Arduino perhaps) that in some circumstances (longer power supply wires) the nRF24L01 needs RF decoupling capacitors in order to function reliably. Maybe you've tried this already
Hi Hellwig again. Today I soldered 4.7uF across VCC-GND pins, sadly I do not observe any improvement in communication, I could have possibly tried other values, but for now caps desoldered. Thank you for pointing this out, perhaps I may do this test again once trying the comms on a wider range. -- Tomas Kral <thomas.kral@email.cz>
participants (4)
-
Hellwig Geisse -
Jörg Straube -
Paul Reed -
Tomas Kral