nRF52840 Radio receiving with CRC

Hi

I have nRF52840 DK with nRF5_SDK_17.0.2_d674dde 

I am using radio_test example code under examples\peripheral\radio_test:

Radio Channel is fixed at 10,

The data packet is  : from x01 to 0x1F                                                                       

20 01 02 03  04 05 06 07  08 09 0A 0B  0C 0D 0E 0F                              
10 11 12 13  14 15 16 17  18 19 1A 1B  1C 1D 1E 1F                              

Normally, it is ok, but occasionally, it received with a bit error:   

uart_cli:~$ print_rx                                                           
                                                                                
20 01 02 03  04 05 06 07  08 09 0A 0B  0C 0D 0E 0F                              
10 11 12 13  14 15 56 17  18 19 1A 1B  1C 1D 1E 1F

My question is:  radio receiving is when CRCOK event occurs,

    nrf_radio_int_enable(NRF_RADIO_INT_CRCOK_MASK);

void RADIO_IRQHandler(void)
{
    if (nrf_radio_event_check(NRF_RADIO_EVENT_CRCOK))
    {
        nrf_radio_event_clear(NRF_RADIO_EVENT_CRCOK);
       / / data packet recieved here
        m_rx_packet_cnt++;
    }

  ...

}

Why the packet is still received when there is CRC error? I believe that data byte 0x16 is changed to 0x56, CRC must be different.

Did I miss something here?

Thank you,

David Zhou.

Parents Reply Children
  • Hi Vidar,

    I have attached two projects source code. Global Macros:

    SDK7=SDK7=F:\_Develop\nRFSDK\nRF5_SDK_17.0.2_d674dde

    EDIT1:

    Project folder structure:

    local_root:

      nRF5_SDK_17.0.2_d674dde
      _Project\nRF_17\frc_tx
                                     \radio_test

    Load radio_test, and type print_rx on UART terminal, it will receive packages from frc_tx project running from a second nRF52840 DK.

    I calculated checksum, printed on the second and third bytes, if not equal. (EF BA), Fourth byte [03], is the number of packages with checksum error. (But all packages are received when CRCOK event triggered). (Radio channel is fixed at 10).

    20 EF BA 03  24 05 06 07  08 09 0A 0B  0C 0D 09 BF                              
    10 11 12 13  14 15 16 17  18 19 1A 1B  1C 1D 1E 1F

    At the same time, could you please review my code for reading RSSI values? I noticed that RSSI >|(-85)|, it is likely to have checksum errors. But for Beacon examples, RSSI at -99 or less (more negative), is still receiving packets ok. I am wondering I did anything wrong in reading RSSI, or something else.

    Appreciate your help!

    David Zhou

    frc_tx.zip

    radio_test.zip

  • Hi David,

    Thanks. I ran you code here and noticed the same problem you've been describing. However, when I look at the RADIO registers I see that CRC has not been enabled. CRCCNF  is '0'.

  • Hi Vidar,

    Thank you for debugging my code. I made a mistake in frc_tx code by setting

    NRF_RADIO_CRC_ADDR_SKIP instead of NRF_RADIO_CRC_ADDR_INCLUDE.

    Now I set CRCCNF to

    nrf_radio_crc_configure(RADIO_CRCCNF_LEN_Disabled, NRF_RADIO_CRC_ADDR_INCLUDE, 0x18E);

    on both projects, and I still got:

     Was the above setup for CRC not enough?

    EDIT1 : the CRCPOLY is 0x18D not 0x18E passed in.

    Is one byte CRC not enough?

    EDIT -2 : made mistake again: It shall be configured as :

       nrf_radio_crc_configure(RADIO_CRCCNF_LEN_One, NRF_RADIO_CRC_ADDR_SKIP, 0x18D);

    Then it works. Thank you again. 

    Could you please review RSSI value reading :

        nrf_radio_shorts_enable(NRF_RADIO_SHORT_READY_START_MASK | NRF_RADIO_SHORT_END_START_MASK
          |  RADIO_SHORTS_ADDRESS_RSSISTART_Msk |  RADIO_SHORTS_DISABLED_RSSISTOP_Msk  
          );

     if (nrf_radio_event_check(NRF_RADIO_EVENT_RSSIEND)) {
              rssi = (volatile uint8_t )NRF_RADIO->RSSISAMPLE;
           }  

    Is that correct?

    I have noticed that under -85dBm rssi, it starts having receiving problem (skipped or rejected by CRCOK). But in some other applications, -99 dBm is still capable of receiving. I am not so sure that is there anything wrong with my code (radio test and frc_tx).

    Thank you,

    David Zhou

  • Hi David,

    I think the RSSI will be more accurate if you start the sampling after receiving the EVENTS_ADDRESS so that the sample is taken while receiving the packet payload. Also note that - 99dBm is outside the valid RSSI range between -90 to -20 dB.

    For even better accuracy you should consider including temperature compensation with the internal TEMP sensor: [153] RADIO: RSSI parameter adjustment

    Best regards,

    Vidar

  • Hi Vidar,

    Thank you for your valuable knowledge. I will try to use EVENTS_ADDRESS and compensate T.

    Best Regards,

    David

Related