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