1.4 SerialGateway freezes
-
@hek Could it be that the transmit buffer is not flushed when a transmission fails after automatic-ack retrying?
Didn't look in the code yet...Would be great if you have some kind of idea . How/where did you mean I should flush?
@Goppo
Do you have the amplified radio version on you gateway? I'm suspecting a powering issue. In the cases where the sensor is shut down your gateway-radio will send a burst 15 messages. This could very well cause some issues if you get a voltage drop. -
Would be great if you have some kind of idea . How/where did you mean I should flush?
@Goppo
Do you have the amplified radio version on you gateway? I'm suspecting a powering issue. In the cases where the sensor is shut down your gateway-radio will send a burst 15 messages. This could very well cause some issues if you get a voltage drop. -
Would be great if you have some kind of idea . How/where did you mean I should flush?
@Goppo
Do you have the amplified radio version on you gateway? I'm suspecting a powering issue. In the cases where the sensor is shut down your gateway-radio will send a burst 15 messages. This could very well cause some issues if you get a voltage drop.@hek said:
Would be great if you have some kind of idea . How/where did you mean I should flush?
On a failed transmit the message stays in the tx buffer iirr, have to look it up in the data sheet. If this is the case you have to explicitly clear the tx buffer. I'll come back to this; no time right now...
-
Would be great if you have some kind of idea . How/where did you mean I should flush?
@Goppo
Do you have the amplified radio version on you gateway? I'm suspecting a powering issue. In the cases where the sensor is shut down your gateway-radio will send a burst 15 messages. This could very well cause some issues if you get a voltage drop.@hek Looked it up in the datasheet:
If the TX FIFO (PRX) contains more than one payload to a PTX, payloads are handled using the first in –
first out principle. The TX FIFO (PRX) is blocked if all pending payloads are addressed to a PTX where the
link is lost. In this case, the MCU can flush the TX FIFO (PRX) by using the FLUSH_TX command.
.....
While executing the Auto Retransmit feature, the number of retransmits can reach the maximum number
defined in ARC. If this happens, the nRF24L01+ asserts the MAX_RT IRQ and returns to standby-I mode.
.....
MAX_RT IRQ is asserted if the auto retransmit counter (ARC_CNT) exceeds the programmed maximum limit
(ARC). In Figure 24. the packet transmission ends with a MAX_RT IRQ. The payload in TX FIFO is NOT
removed and the MCU decides the next step in the protocol. A toggle of the CE starts a new transmitting
sequence of the same packet. The payload can be removed from the TX FIFO using the FLUSH_TX command.The FIFO is 3 entries big, so 3 successive failed transmissions to the same destination will block the transmission.
This FIFO needs to be flushed after a failed transmission (indicated by the MAX_RT IRQ) by executing the FLUSH_TX command.
Add the following method to the NRF24 class:uint8_t RF24::flush_tx(void) { return spiTrans( FLUSH_TX ); }and when you're at it, please also add (used e.g. by the sniffer):
uint8_t RF24::flush_rx(void) { return spiTrans( FLUSH_RX ); }This might very well be a very nasted bug bugging the 1.4 users...
-
@hek Looked it up in the datasheet:
If the TX FIFO (PRX) contains more than one payload to a PTX, payloads are handled using the first in –
first out principle. The TX FIFO (PRX) is blocked if all pending payloads are addressed to a PTX where the
link is lost. In this case, the MCU can flush the TX FIFO (PRX) by using the FLUSH_TX command.
.....
While executing the Auto Retransmit feature, the number of retransmits can reach the maximum number
defined in ARC. If this happens, the nRF24L01+ asserts the MAX_RT IRQ and returns to standby-I mode.
.....
MAX_RT IRQ is asserted if the auto retransmit counter (ARC_CNT) exceeds the programmed maximum limit
(ARC). In Figure 24. the packet transmission ends with a MAX_RT IRQ. The payload in TX FIFO is NOT
removed and the MCU decides the next step in the protocol. A toggle of the CE starts a new transmitting
sequence of the same packet. The payload can be removed from the TX FIFO using the FLUSH_TX command.The FIFO is 3 entries big, so 3 successive failed transmissions to the same destination will block the transmission.
This FIFO needs to be flushed after a failed transmission (indicated by the MAX_RT IRQ) by executing the FLUSH_TX command.
Add the following method to the NRF24 class:uint8_t RF24::flush_tx(void) { return spiTrans( FLUSH_TX ); }and when you're at it, please also add (used e.g. by the sniffer):
uint8_t RF24::flush_rx(void) { return spiTrans( FLUSH_RX ); }This might very well be a very nasted bug bugging the 1.4 users...
-
Ohh.. interesting.
So are you saying we should flush_tx after every failed send? Or only after 3 consecutive send-fails to the same address?
-
Can you make some tests perhaps? And create a pull req with the changes in RF24 and MySensor.cpp if you see any improvements?
-
Take your time. We don't have any deadlines or bosses hanging over the shoulder here :smile:
-
@hek true, but I have a gut feeling some troubles reported on this forum lately could be related to this. Furthermore I've seen strange repeated messages on air, but didn't investigate yet...
-
@hek Ok, gut feeling was wrong this time ;-)
Buried deep inside the nRF24 driver (RF24::write) is standard flush when transmission fails://Max retries exceeded if( status & _BV(MAX_RT)){ flush_tx(); //Only going to be 1 packet int the FIFO at a time using this method, so just flush return 0; } -
@hek Ok, gut feeling was wrong this time ;-)
Buried deep inside the nRF24 driver (RF24::write) is standard flush when transmission fails://Max retries exceeded if( status & _BV(MAX_RT)){ flush_tx(); //Only going to be 1 packet int the FIFO at a time using this method, so just flush return 0; }