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

the communication of nRF51822 and nRF24l01P

Hi, I want to use the nrf51822 to communicate withe the old module of 24l01p, in the module of 24l01p, the Address is addrofch[0] = 0xe7; addrofch[1] = 0x7e; addrofch[2] = 0xe3; addrofch[3] = 0x0; addrofch[4] = 0x0; the power is 0db, the rate is 1M,and the length of data is 8,and the crc is two bytes. the frequncy is 9. In the 51822 the radio I configure: NRF_RADIO->TXPOWER = (RADIO_TXPOWER_TXPOWER_0dBm << RADIO_TXPOWER_TXPOWER_Pos); NRF_RADIO->FREQUENCY = 9UL; // Frequency bin 9, 2409MHz NRF_RADIO->MODE = (RADIO_MODE_MODE_Nrf_1Mbit << RADIO_MODE_MODE_Pos); NRF_RADIO->PREFIX0= 0xe7UL; NRF_RADIO->BASE0 =0x7ee30000UL;
NRF_RADIO->TXADDRESS = 0x00UL; // Set device address 0 to use when transmitting NRF_RADIO->RXADDRESSES = 0x01UL;

NRF_RADIO->PCNF0 = (PACKET_S1_FIELD_SIZE << RADIO_PCNF0_S1LEN_Pos) | (PACKET_S0_FIELD_SIZE << RADIO_PCNF0_S0LEN_Pos) | (PACKET_LENGTH_FIELD_SIZE << RADIO_PCNF0_LFLEN_Pos); NRF_RADIO->PCNF1 = (RADIO_PCNF1_WHITEEN_Disabled << RADIO_PCNF1_WHITEEN_Pos) | (RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) | (PACKET_BASE_ADDRESS_LENGTH << RADIO_PCNF1_BALEN_Pos) | (PACKET_STATIC_LENGTH << RADIO_PCNF1_STATLEN_Pos) | (PACKET_PAYLOAD_MAXSIZE << RADIO_PCNF1_MAXLEN_Pos); // CRC Config NRF_RADIO->CRCCNF = (RADIO_CRCCNF_LEN_Two << RADIO_CRCCNF_LEN_Pos); if ((NRF_RADIO->CRCCNF & RADIO_CRCCNF_LEN_Msk) == (RADIO_CRCCNF_LEN_Two << RADIO_CRCCNF_LEN_Pos)) { NRF_RADIO->CRCINIT = 0xFFFFUL; // Initial value
NRF_RADIO->CRCPOLY = 0x11021UL; // CRC poly: x^16+x^12^x^5+1 } but I have tried many times,but they cann't communicate,please tell me why. thank you .

Parents Reply Children
  • Hi , Thank you for your reply. Maybe I don't explain very clearly.Now I want to use 51822 to receive data that from the transmit module of 24l01. The Address of 24l01 is the Address is addrofch[0] = 0xe7; addrofch[1] = 0x7e; addrofch[2] = 0xe3; addrofch[3] = 0x0; addrofch[4] = 0x0; the power is 0db, the rate is 1M,and the length of data is 8,and the crc is two bytes. the frequncy is 9. How can I configure the 51822 the Address? I configure it like this NRF_RADIO->PREFIX0= 0xe7UL; NRF_RADIO->BASE0 =0x7ee30000UL; Is it right?please give me an explanation,thank you!

  • Hi , Thank you for your reply. Maybe I don't explain very clearly.Now I want to use 51822 to receive data that from the transmit module of 24l01. The Address of 24l01 is the Address is addrofch[0] = 0xe7; addrofch[1] = 0x7e; addrofch[2] = 0xe3; addrofch[3] = 0x0; addrofch[4] = 0x0; the power is 0db, the rate is 1M,and the length of data is 8,and the crc is two bytes. the frequncy is 9. How can I configure the 51822 the Address? I configure it like this NRF_RADIO->PREFIX0= 0xe7UL; NRF_RADIO->BASE0 =0x7ee30000UL; Is it right?please give me an explanation,thank you!

  • Hi,

    I understood you question but it was my mistake not to point out the issue in your configuration.

    As you can find in the nRF51 Reference Manual at section 16.1.2, least significant byte is sent first, and least significant bit also is sent first (little endian) when the compiler use store the MSBit first for each byte. So there is a bit swap for each byte needed,(bytewise_bitswap().

    So you would need to set your address to:

    NRF_RADIO->BASE0 = 0x7EC70000; Or as in the example: NRF_RADIO->BASE0 = bytewise_bitswap(0x7ee30000UL);

    Note that e7 and 7e and 00 remain the same when reverse the bit. And E3 reversed -> C7

  • Hi, Thank you for your reply. I configrue the address as your advice,the 51822 can receive data and the data can get through the PC by the UART. However,I have another confusion. In the 51822 radio- RX ,I configure as follows: if (NRF_RADIO->CRCSTATUS == 1U) { nrf_gpio_pin_set(10); for(i=0;i<8;i++) { rbuf[i]=packet[i]; } simple_uart_putstring(rbuf); } In this case,the CRCSTATUS==0 all the time,I receive the data by this: while(NRF_RADIO->EVENTS_DISABLED == 0U) { } for(i=0;i<8;i++) { rbuf[i]=packet[i]; } simple_uart_putstring(rbuf); nrf_delay_ms(10); } please help me to find is there any mistakes in my code? In my understanding, if the two devices can communicate, the CRCSTATUS==1 is right. If the CRCSTATUS is 0, is there any mistakes? please give me an explanation,thank you! why there is data in the packet,however, the CRCSTATUS is 0 all the time?

  • Hi, Thank you for your reply. I configrue the address as your advice,the 51822 can receive data and the data can get through the PC by the UART. However,I have another confusion. In the 51822 radio- RX ,I configure as follows: if (NRF_RADIO->CRCSTATUS == 1U) { nrf_gpio_pin_set(10); for(i=0;i<8;i++) { rbuf[i]=packet[i]; } simple_uart_putstring(rbuf); } In this case,the CRCSTATUS==0 all the time,I receive the data by this: while(NRF_RADIO->EVENTS_DISABLED == 0U) { } for(i=0;i<8;i++) { rbuf[i]=packet[i]; } simple_uart_putstring(rbuf); nrf_delay_ms(10); } please help me to find is there any mistakes in my code? In my understanding, if the two devices can communicate, the CRCSTATUS==1 is right. If the CRCSTATUS is 0, is there any mistakes? please give me an explanation,thank you! why there is data in the packet,however, the CRCSTATUS is 0 all the time?

Related