This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to use RXREADY and TXREADY Events in SHORTS

I am developing my own low level radio protocol based on BLE advertisement telegrams with the nRF52840. It works good so far and the usage of SHORTS helps a lot.

But there is one scenario which does not work.

I want to send a request telegram to another device and I expect an immediate response (or a time-out if the device is not present or the channel is disturbed).

For this case, I set TXREADY_START and END_DISABLE and DISABLED_RXEN and RXREADY_START in SHORTS and start the transmission with TASKS_TXEN = 1. At the current state, I watch the channel with a universal reader (I developed by my own with the nRF52840). And I see the transmitted telegram, but it works only once. In a loop with sending every second, only the first telegram is sent. Before each sending, I disable the radio (TASKS_DISABLE).

With other combinations in SHORTS, e.g. the simplest with READY_START and END_DISABLE, the loop works correct and I receive a packet every second.

May be I misunderstood the function of TSREADY and RXREADY events instead of READY, but what are they for, if not distinguishing between receiver or transmitter ready?

Any information will help. Thank you all.

Some hours later: I found out more by testing other combinations in SHORTS.

The repetition of sending also does not work with READY_START and END_DISABLE and DISABLED_RXEN. There is a pause of 500 us after TASKS_DISABLE = 1 and the next call of sending (started with TASKS_TXEN = 1). It seems, I cannot force the radio back to disabled when it is in the receive state. But from the state diagram in Figure 110: Radio states, it should be possible to force radio to disabled from any state.

Here is my sending method (different sending modes controlled by parameter):

void  nRF52840Radio::send(bcPduPtr inPduPtr, TxMode txMode)
{
  NrfRadioPtr->INTENCLR         = 0xFFFFFFFF;
  NrfRadioPtr->EVENTS_READY     = 0;
  NrfRadioPtr->EVENTS_END       = 0;
  NrfRadioPtr->EVENTS_DISABLED  = 0;
  NrfRadioPtr->EVENTS_RXREADY   = 0;
  NrfRadioPtr->EVENTS_TXREADY   = 0;

  memcpy((void *)pduMem, (void *)inPduPtr, sizeof(bcPdu));    // Daten in Funkpuffer kopieren
  memcpy((void *)pduSent, (void *)inPduPtr, sizeof(bcPdu));   // Daten in extra Puffer kopieren

  switch(txMode)
  {
    case txmBase:
      NrfRadioPtr->SHORTS = NrfScREADY_START | NrfScEND_DISABLE;
      NrfRadioPtr->TASKS_TXEN = 1;
      break;

    case txmRepStart:
      NrfRadioPtr->SHORTS = NrfScREADY_START;
      NrfRadioPtr->TASKS_TXEN = 1;
      break;

    case txmRepCont:
      NrfRadioPtr->SHORTS = 0;
      NrfRadioPtr->TASKS_START = 1;
      break;

    case txmRepEnd:
      NrfRadioPtr->SHORTS = NrfScEND_DISABLE;
      NrfRadioPtr->TASKS_START = 1;
      break;

    case txmReadPrep:
      NrfRadioPtr->SHORTS = NrfScREADY_START | NrfScEND_DISABLE | NrfScDISABLED_RXEN;
      NrfRadioPtr->TASKS_TXEN = 1;
      break;

    case txmRead:
      NrfRadioPtr->SHORTS = NrfScTXREADY_START | NrfScEND_DISABLE | NrfScDISABLED_RXEN | NrfScRXREADY_START;
      NrfRadioPtr->TASKS_TXEN = 1;
      break;
  }
}

Because I am developing both, the transmit/receive procedures and the construction of telegrams, I copy the sent data in an extra buffer for analyzing, because it will be overwritten with received data. My definition for the content of SHORTS is

#define NrfScREADY_START    0x00000001
#define NrfScEND_DISABLE    0x00000002
#define NrfScDISABLED_RXEN  0x00000008
#define NrfScTXREADY_START  0x00040000
#define NrfScRXREADY_START  0x00080000

Solved

What a stupid simple mistake ...

If I disable the radio, but there is a shortcut from DISABLED to READxxx in SHORTS, the disabling process ends in the reading state. And of course, I cannot start a transmit task then.

I added SHORTS = 0 to my disable-method and now the loop runs as it should.

Thanks for reading and have a nice day all.

  • Hi,

     

    If I disable the radio, but there is a shortcut from DISABLED to READxxx in SHORTS, the disabling process ends in the reading state. And of course, I cannot start a transmit task then.

    I added SHORTS = 0 to my disable-method and now the loop runs as it should.

    Thanks for reading and have a nice day all.

    I'm glad to hear that you found a solution to the problem, and thank you for updating the initial thread with this info as well. I hope you have a good day, and remember to contact us again if you have any issues/questions!

     

    Kind regards,

    Håkon 

Related