This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Radio receive problem in 51822

Hi, I used two 51822 modules for my project. One should send a byte and other one should receive. I used the exact same configurations of radio examples (transmitter and received). But it didn't work. Radio configuration is as below: // Radio config NRF_RADIO->TXPOWER = (RADIO_TXPOWER_TXPOWER_0dBm << RADIO_TXPOWER_TXPOWER_Pos); NRF_RADIO->FREQUENCY = 7UL; // Frequency bin 7, 2407MHz NRF_RADIO->MODE = (RADIO_MODE_MODE_Nrf_1Mbit << RADIO_MODE_MODE_Pos);

// Radio address config
NRF_RADIO->PREFIX0 = 
    ((uint32_t)swap_bits(0xC3) << 24) // Prefix byte of address 3 converted to nRF24L series format
  | ((uint32_t)swap_bits(0xC2) << 16) // Prefix byte of address 2 converted to nRF24L series format
  | ((uint32_t)swap_bits(0xC1) << 8)  // Prefix byte of address 1 converted to nRF24L series format
  | ((uint32_t)swap_bits(0xC0) << 0); // Prefix byte of address 0 converted to nRF24L series format

NRF_RADIO->PREFIX1 = 
    ((uint32_t)swap_bits(0xC7) << 24) // Prefix byte of address 7 converted to nRF24L series format
  | ((uint32_t)swap_bits(0xC6) << 16) // Prefix byte of address 6 converted to nRF24L series format
  | ((uint32_t)swap_bits(0xC4) << 0); // Prefix byte of address 4 converted to nRF24L series format

NRF_RADIO->BASE0 = bytewise_bitswap(0x01234567UL);  // Base address for prefix 0 converted to nRF24L series format
NRF_RADIO->BASE1 = bytewise_bitswap(0x89ABCDEFUL);  // Base address for prefix 1-7 converted to nRF24L series format

NRF_RADIO->TXADDRESS   = 0x00UL;  // Set device address 0 to use when transmitting
NRF_RADIO->RXADDRESSES = 0x01UL;  // Enable device address 0 to use to select which addresses to receive

// Packet configuration
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); //lint !e845 "The right argument to operator '|' is certain to be 0"

// Packet configuration
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); //lint !e845 "The right argument to operator '|' is certain to be 0"


// CRC Config
NRF_RADIO->CRCCNF = (RADIO_CRCCNF_LEN_One << RADIO_CRCCNF_LEN_Pos); // Number of checksum bits
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
}
else if ((NRF_RADIO->CRCCNF & RADIO_CRCCNF_LEN_Msk) == (RADIO_CRCCNF_LEN_One << RADIO_CRCCNF_LEN_Pos))
{
    NRF_RADIO->CRCINIT = 0xFFUL;   // Initial value
    NRF_RADIO->CRCPOLY = 0x107UL;  // CRC poly: x^8+x^2^x^1+1
}

After debugging, I understood that transmission works file (or at least I think!) but in receiving, the program stock in a white for END task. In blow, read_packet function is brought: NRF_RADIO->EVENTS_READY = 0U; // Enable radio and wait for ready NRF_RADIO->TASKS_RXEN = 1U;

while (NRF_RADIO->EVENTS_READY == 0U)
{
		cnt1++;
    // wait
}
NRF_RADIO->EVENTS_END = 0U;
// Start listening and wait for address received event
NRF_RADIO->TASKS_START = 1U;

// Wait for end of packet or buttons state changed
while ((NRF_RADIO->EVENTS_END == 0U) && (cnt2 < 30000))
{
		cnt2++;
    // wait
}

if (NRF_RADIO->CRCSTATUS == 1U)
{
  result = packet;
		nrf_gpio_pin_toggle(18);
		nrf_gpio_pin_toggle(19);
		nrf_gpio_pin_toggle(20);
		nrf_gpio_pin_toggle(21);
		nrf_gpio_pin_toggle(22);
}
NRF_RADIO->EVENTS_DISABLED = 0U;
// Disable radio
NRF_RADIO->TASKS_DISABLE = 1U;

while (NRF_RADIO->EVENTS_DISABLED == 0U)
{
		cnt3++;
    // wait
}

I appreciate if anyone can help me

Related