[Oberon] FPGA - nRF24L01 `RPI Net' server

Tomas Kral thomas.kral at email.cz
Wed May 16 20:11:44 CEST 2018


On Wed, 16 May 2018 16:46:48 +0200
Jörg Straube <joerg.straube at iaeth.ch> wrote:

> We try to help but as Paul said, we are a little blind of what your
> code actually does. What bits do you check? what bits do you reset?
> when?

This is not my code, I just tinker it to get some status output.

bool RF24::write( const void* buf, uint8_t len, const bool multicast )
{
   uint8_t status;

   //Start Writing, just write_payload(), and starts transmit
   startFastWrite(buf,len,multicast);

   //Wait until complete or failed
   uint32_t timer = millis();
 
   while( ! ( status = get_status() & ( _BV(TX_DS) | _BV(MAX_RT) ))) {
         if(millis() - timer > 95){
            errNotify(); // no output from radio, report wiring problem
            return 0;
         }
   }
   
   ce(LOW);

   printf("status %d\n", status);
   if ( status & _BV(TX_DS) ) write_register(NRF_STATUS, _BV(TX_DS));
   else if ( status & _BV(MAX_RT) ) {
      write_register(NRF_STATUS, _BV(MAX_RT)); flush_tx();
   }

   return ( status & _BV(TX_DS) );
}

I call it like this.

/* mimics `SCC.SubSnd' */
void subsnd( payload *pl, bool *timeout )
{
   bool done;
   uint32_t stry = SEND_TRIES;
   do {
      delay(WAIT0);
      done = radio.write(pl, SUB_PACKET);
   } while ( --stry && ! done );
   
   *timeout = ! done;
   printf ("%d\n", stry);
}

> Did you read chapter 7.8 in the datasheet describing the normal
> communication cases as well as error cases. (retransmits, missing
> ACKs...)

This is an interesting part. 7.8.3. is applicable to my experience of
missing ACK packet.
It shows that when ACK is lost, auto packet retransmit commences, and RX
discards each duplicate packet received, until ACK gets through to the
sender. This works, duplicates discarded until MAX retry is reached.

But when no ACK received after MAX retries, I reset MAX, discard the
packet and start again, but then, the receiver sees it as a new
transaction, therefore I got duplicates.

I wonder If I somehow reused payload instead, while resetting MAX count,
were it still seen as a new transaction by the receiver? Would I get
duplicates?

-- 
Tomas Kral <thomas.kral at email.cz>


More information about the Oberon mailing list