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

Problem using RADIO_MODE_MODE_Ble_LR125Kbit in custom protocol

I have an application which is currently using a the custom RADIO_MODE_MODE_Nrf_250Kbit mode, and I want to port it to the 52840 and 52911 using 

RADIO_MODE_MODE_Ble_LR125Kbit instead.

A central node communicates with a number of peripherals. Initially, the peripherals advertise and receive a connection initiator from the central. After the connection, the central sends out a sync message and all the peripherals respond in turn.

I followed the instructions in https://devzone.nordicsemi.com/f/nordic-q-a/22094/rx-on-le-coded-phy to use the LR mode.

I changed the TXADDRESS and RXADDRESSES to logical address 0 (I read this somewhere, even though I did not find the actual documentation about what the issue with the logical addresses is in LR mode)

Now, in both the advertising mode and in the connection mode, only the initial transmission goes through, but the reply is not received. This is true for both the central and the peripheral, so it is happening in both directions.

This is the code I use to initialize the radio:

    NRF_RADIO->TXPOWER   = (power << RADIO_TXPOWER_TXPOWER_Pos);
    NRF_RADIO->FREQUENCY = 7UL;  // Frequency bin 7, 2407MHz
    NRF_RADIO->DATAWHITEIV = 25;
    NRF_RADIO->MODE      = (RADIO_MODE_MODE_Ble_LR125Kbit << RADIO_MODE_MODE_Pos);

    NRF_RADIO->PREFIX0  = 0xabcd8e8e; //access_addr[3]
    NRF_RADIO->PREFIX1  = 0x12345678; //access_addr[3]
    NRF_RADIO->BASE0    = 0x89abcd00; //access_addr[0:3]
    NRF_RADIO->BASE1    = 0xfedcba00; //access_addr[0:3]
     
    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
        uint32_t preamble_mask =  ((RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) & (3 << RADIO_PCNF0_PLEN_Pos));
        preamble_mask |= ((2                          << RADIO_PCNF0_CILEN_Pos) & RADIO_PCNF0_CILEN_Msk);
        preamble_mask |= ((3                          << RADIO_PCNF0_TERMLEN_Pos) & RADIO_PCNF0_TERMLEN_Msk); 

        
         NRF_RADIO->PCNF0        =   (((1UL) << RADIO_PCNF0_S0LEN_Pos                               ) & RADIO_PCNF0_S0LEN_Msk)
                              | (((0UL) << RADIO_PCNF0_S1LEN_Pos     // I tried 2 here also, no difference                         ) & RADIO_PCNF0_S1LEN_Msk)
                              | (((8UL) << RADIO_PCNF0_LFLEN_Pos                               ) & RADIO_PCNF0_LFLEN_Msk)
                              | preamble_mask;
         NRF_RADIO->PCNF1  =   (((RADIO_PCNF1_ENDIAN_Big)     << RADIO_PCNF1_ENDIAN_Pos    ) & RADIO_PCNF1_ENDIAN_Msk)
                              | (((3UL)                           << RADIO_PCNF1_BALEN_Pos     ) & RADIO_PCNF1_BALEN_Msk)
                              | (((0UL)                           << RADIO_PCNF1_STATLEN_Pos   ) & RADIO_PCNF1_STATLEN_Msk)
                              | ((((uint32_t) maxsize)                 << RADIO_PCNF1_MAXLEN_Pos    ) & RADIO_PCNF1_MAXLEN_Msk)
                              | ((RADIO_PCNF1_WHITEEN_Enabled     << RADIO_PCNF1_WHITEEN_Pos   ) & RADIO_PCNF1_WHITEEN_Msk);
           NRF_RADIO->CRCCNF       =   (((RADIO_CRCCNF_SKIPADDR_Skip)    << RADIO_CRCCNF_SKIPADDR_Pos ) & RADIO_CRCCNF_SKIPADDR_Msk)
                              | (((RADIO_CRCCNF_LEN_Three)        << RADIO_CRCCNF_LEN_Pos      ) & RADIO_CRCCNF_LEN_Msk);
           NRF_RADIO->CRCPOLY      = 0x0000065b;
           NRF_RADIO->CRCINIT      = 0x00555555;

Somehow when switching from TX to RX and vice versa, something gets mixed up. The code used to work fine with all the other radio modes. What am I missing here?

Any help is appreciated.

Johannes

Parents
  • Hi,

    Custom RADIO_MODE_MODE_Ble_LR125Kbit mode is implemented in the DTM example in our SDK. Did you have a look at this and compare it to your code?

    Best regards,
    Jørgen

  • Hi Jorgen,

    I looked at this example, but it seems to operate in separate TX and RX mode. The problem I am experiencing is when switching from TX to RX, such as when sending an ACK packet. I use the same code to initialize the radio in both the central and the peripheral, and either one of them can transmit the first packet (depending oh the app state), but the ACK never goes through, even with the same settings. So far I have learned of 2 differences between normal and coded PHY: one is related to the PHYEND event, and the other the logical address issue that was mentioned in one of the posts. 

    Are there any other known differences between normal and coded PHY? and why can only logical address 0 be used?

    My pseudo-sequence is fundamentally very basic:

    // construct packet

    NRF_RADIO->TXEN = 1; // START is done via SHORT

    while (NRF_RADIO->EVENTS_END == 0); // I tried using PHYEND here also

    // DISABLE is done via SHORT

    // listen for ACK packet

    NRF_RADIO->RXEN = 1; // use SHORT for START

    while (NRF_RADIO->EVENTS_END == 0); // from the documentation it seems PHYEND is not generated in RX mode

    this sequence works with the non-coded PHY

Reply
  • Hi Jorgen,

    I looked at this example, but it seems to operate in separate TX and RX mode. The problem I am experiencing is when switching from TX to RX, such as when sending an ACK packet. I use the same code to initialize the radio in both the central and the peripheral, and either one of them can transmit the first packet (depending oh the app state), but the ACK never goes through, even with the same settings. So far I have learned of 2 differences between normal and coded PHY: one is related to the PHYEND event, and the other the logical address issue that was mentioned in one of the posts. 

    Are there any other known differences between normal and coded PHY? and why can only logical address 0 be used?

    My pseudo-sequence is fundamentally very basic:

    // construct packet

    NRF_RADIO->TXEN = 1; // START is done via SHORT

    while (NRF_RADIO->EVENTS_END == 0); // I tried using PHYEND here also

    // DISABLE is done via SHORT

    // listen for ACK packet

    NRF_RADIO->RXEN = 1; // use SHORT for START

    while (NRF_RADIO->EVENTS_END == 0); // from the documentation it seems PHYEND is not generated in RX mode

    this sequence works with the non-coded PHY

Children
No Data
Related