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
  • Hi Linda,

    I don't see any issue with your setup. I have tried your configuration with a nRF51822 and a nRF24LE1 and they work properly. nRF24LE1 has the same radio as nRF24L01+.

    Have you make sure you set S0, S1, LEN length to 0 ? PACKET_BASE_ADDRESS_LENGTH to 4 and PACKET_STATIC_LENGTH matched with the number of byte you sent ?

    I attached here the examples that I modified for your reference.

    radio_example_LE1.zip

    ptx_SBnRF51.zip

  • 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

Reply
  • 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

Children
No Data
Related