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

NRF51822 Receiving on the wrong address

Hi,

I have a case where the receive end event is triggered even though the receive base address and prefix shouldn't match. Some background: Initially the receiver is set to listen to a transmitter, let's call it A, on address A. After a while the receiver changes the base (BASE0) and prefix (PREFIX0) to listen to a new address, B. Even after this change then I can see that packets packets are received from transmitter A. When I turn off A and turn on B I also receive packets.

Only address 0 is enabled for reception. I've also called the disabled task before changing address to be sure.

Any ideas are most welcome.

Best regards, Andreas Wileur

Update: I found that disabling and reenabling the radio solved the problem:

NRF_RADIO->POWER = 0;   // Power down radio
NRF_RADIO->POWER = 1;   // Power up radio again

Of course it has to be re-initialized again but that is not a problem. I haven't read out the actual registers but it seems that they were not updated properly when written to. The power cycle fixed that.

Any Nordic employee that can comment on that?

Best regards, Andreas Wileur

Parents
  • Thank you for your reply. I'll try to clarify.

    Here is my radio initialization code:

    // Shortcut from READY to START and END to DISABLE, saves a lot of MCU timing and work
    NRF_RADIO->SHORTS     = RADIO_SHORTS_END_DISABLE_Msk | RADIO_SHORTS_READY_START_Msk;
    NRF_RADIO->MODE = 		RADIO_MODE_MODE_Nrf_1Mbit;  // 1MBit/s data rate
    
    // CRC settings
    NRF_RADIO->CRCINIT = 	0xffff;	// Initial CRC value
    NRF_RADIO->CRCPOLY = 	0x11021UL;  // 
    NRF_RADIO->PCNF1 =		(RADIO_PCNF1_ENDIAN_Big << RADIO_PCNF1_ENDIAN_Pos) |
                            (2UL<<RADIO_PCNF1_BALEN_Pos) |
                            //((u32)32<<RADIO_PCNF1_STATLEN_Pos) |
                            32;	// 2 base address bytes, 32 bytes static length and  32byte data max
    // S1 size = 0 bits, S0 size = 0 bytes
    NRF_RADIO->PCNF0 = 		(0UL << RADIO_PCNF0_S1LEN_Pos) |
                            (0UL << RADIO_PCNF0_S0LEN_Pos) |
                            (0UL << RADIO_PCNF0_LFLEN_Pos);
    
    NRF_RADIO->TXADDRESS = 	0;      // Logical address 0 for transmission
    NRF_RADIO->RXADDRESSES = RADIO_RXADDRESSES_ADDR0_Enabled << RADIO_RXADDRESSES_ADDR0_Pos;	// Logical address 0 enabled for reception
    

    I set the address like this, where addr[x] is three bytes:

    NRF_RADIO->BASE0 =		bytewiseBitSwap(((u32)((u8)addr[1]))<<24 | ((u32)((u8)addr[0]))<<16);
    NRF_RADIO->PREFIX0 =	swapBits((u8)addr[2]);
    

    I got the swapBits from someones example on this forum and it works fine. As far as I understand this only configures the base address for pipe 0 and prefix for pipe 0. Before calling this function I disabled the radio by executing NRF_RADIO->TASKS_DISABLE = 1;

    What do you mean by closing the pipe?

    The system is frequency hopping so the problem occurs only when the channels happen to match, but that is bad enough.

    Best regards, Andreas Wileur

  • By closing the channel I mean that you have to put the radio into DISABLED state before the configurations will be valid. You can verify this by checking the radios STATE register.

Reply Children
No Data
Related