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

nRF52 receiving data from 24L01 incorrectly

Hi,

I am using a 24L01+(as PTX) communicating with a nrf52832(as PRX).

I can have these two device communicating, where nrf52832 can receive data from 24L01+.

However, the data nrf52832 received is not the exactly same as the data 24L01+ has transmitted. For example, the 24L01+ is transmitting a 3-byte data(e.g. 0x123456) to nRF52832, while the data nRF52832 received is 0x2468AC. As you can see, 0x2468AC = 0x123456 <- 1. However, in another test, the 24L01+ transmitted 0x676767, while the nRF52832 received 0xCECECF.

Any suggestion would be appreciated. 

Best regards!

Parents
  • Hi,

     

    It sounds like you have configured the radio incorrectly, especially the endianess of the nrf52 radio (see PCNF1 register)

    Have you tried using nrf_esb library for nRF52 to see if that works better?

     

    Kind regards,

    Håkon

  • Thanks for your suggestion.

    The program running on the nRF52832 was modified from the nRF52 SDK 15.0.0 esb_prx example. It uses the nrf_esb library to recieve data.

    A part of my code which config the esb is as follows.

    uint32_t esb_init( void )
    {
        uint32_t err_code;
        uint8_t base_addr_0[3] = {0xE7, 0xE7, 0xE7};
        uint8_t base_addr_1[3] = {0xC2, 0xC2, 0xC2};
        uint8_t addr_prefix[2] = {0xE7, 0xC2};
        nrf_esb_config_t nrf_esb_config         = NRF_ESB_LEGACY_CONFIG;
        nrf_esb_config.payload_length           = 3;
        nrf_esb_config.crc 	                	= NRF_ESB_CRC_8BIT;
        nrf_esb_config.protocol                 = NRF_ESB_PROTOCOL_ESB;
        nrf_esb_config.bitrate                  = NRF_ESB_BITRATE_2MBPS;
        nrf_esb_config.mode                     = NRF_ESB_MODE_PRX;
        nrf_esb_config.event_handler            = nrf_esb_event_handler;
        nrf_esb_config.selective_auto_ack       = false;
    
        err_code = nrf_esb_init(&nrf_esb_config);
        VERIFY_SUCCESS(err_code);		
    		
        err_code = nrf_esb_set_rf_channel(73);
        VERIFY_SUCCESS(err_code);
    		
        err_code = nrf_esb_set_address_length(4);
        VERIFY_SUCCESS(err_code);
    
        err_code = nrf_esb_set_base_address_0(base_addr_0);
        VERIFY_SUCCESS(err_code);
    
        err_code = nrf_esb_set_base_address_1(base_addr_1);
        VERIFY_SUCCESS(err_code);
    
        err_code = nrf_esb_set_prefixes(addr_prefix, 2);
        VERIFY_SUCCESS(err_code);
    
        return err_code;
    }
    

    I don't know where I should modify my code. 

    Thanks

  • That is strange. Looking at the bit stream, it seems that your data is shifted one bit (0x676767 << 1 becomes 0xCECECF).

    Do you have several nRF24L01+ modules, and they all behave like this? Do you have a link to where you obtained them?

     

    Kind regards,

    Håkon

Reply Children
  • I have several 24L01+ modules and they can work well with each other. Also I have several nRF52832 modules and they work well too.

    Since 24L01+ can receive data correctly from 24L01+, the 24L01+ may not have problem and so does nRF52832. It is so strange.

  • Are you sending ESB-packets from the nRF24L01+, or are you using the older "shockburst" packet format?

    Could you post the nRF24L01+ configuration that you are using? A register dump would suffice.

     

    Cheers,

    Håkon

  • void TX_Mode(void)
    {														 
        
    
      	SPI1_Write_Buf(SPI_WRITE_REG+TX_ADDR,(uint8_t*)TX_ADDRESS,TX_ADR_WIDTH);    
    	  
      	SPI1_Write_REG(SPI_WRITE_REG+EN_AA,0x00);    
    
      	SPI1_Write_REG(SPI_WRITE_REG+EN_RXADDR,0x00); //0x01  //close--0x00
    
      	SPI1_Write_REG(SPI_WRITE_REG+SETUP_RETR,0x00);//0x1a  //close--0x00
    
      	SPI1_Write_REG(SPI_WRITE_REG+RF_CH,0x49);     //频率,0x00~0x4e    
    
      	SPI1_Write_REG(SPI_WRITE_REG+RF_SETUP,0x08);  //0x26  ---- 250k    //0x0f ----2M   //0x06 ----1M   //B1000-0x08  -18db    //B1110-0x0f  0db 
    
      	SPI1_Write_REG(SPI_WRITE_REG+CONFIG,0x0a);    //0x0e--16crc    //0x0a--8crc
            
    	CE_H;                                  
    }	
    

    24L01+ using Shorkburst but not ESB? How do I know what protocol it is using? As far as I know, it uses ESB as default?

    Thanks

  • Hi,

     

    You're using ShockBurst, as you are disabling EN_AA and setting field ARC in register SETUP_RETR to '0'. This will effectively omit the 9 bit "PCF" field from the on-air RF payload, as explained in the nrf24l01+ datasheet in chapter 7.9. The nRF52 library nrf_esb expects to receive in ESB mode, not SB mode.

    The nrf_esb library does not support the legacy "shockburst" mode, unfortunately.

     

    Kind regards,

    Håkon

  • Hi. Thank you for reply.

    Same confing as LamGELI. Now I enable EN_AA, and ARC is set to 5. As recommanded.

    I allways get CRC mismatch (CRCSTATUS=0). While nRF24 in ShockBurst mode make right CRC for nRF52 side, but false payload (one bit shifted). I notice that every received radio event, have payload first byte to 0x00 (payload size). Then I enable dynamic payload too, at nRF24 side : Same result.

    Otherwise, I try to make ShockBurst on nRF52 side with S0LEN=0 and S1LEN=0 : same result, CRC errors.

    Maybe LamGELI will have more luck.

Related