I see that in the 6.20.14.20 RXADDRESSES in Reference Manual I can enable multiple addresses in the same time, so is it possible for nrf52840 to listen on several addresses at the time?
I was using nRF5 SDK, and couldnt make it work.
I see that in the 6.20.14.20 RXADDRESSES in Reference Manual I can enable multiple addresses in the same time, so is it possible for nrf52840 to listen on several addresses at the time?
I was using nRF5 SDK, and couldnt make it work.
Hi
Which RF protocol are you using?
It is true that you can enable the radio to listen on different addresses at the same time, but it is a bit restricted which addresses you can listen to. You can only configure two fully independent addresses (pipe 0 and pipe 1), and then you can configure 6 more addresses that will be mostly similar to the pipe 1 address (only the prefix byte is different).
This feature is supported by the ESB and Gazell proprietary protocols, which are included in the nRF5 SDK.
Best regards
Torbjørn
Hi
Which RF protocol are you using?
It is true that you can enable the radio to listen on different addresses at the same time, but it is a bit restricted which addresses you can listen to. You can only configure two fully independent addresses (pipe 0 and pipe 1), and then you can configure 6 more addresses that will be mostly similar to the pipe 1 address (only the prefix byte is different).
This feature is supported by the ESB and Gazell proprietary protocols, which are included in the nRF5 SDK.
Best regards
Torbjørn
Thanks for the answer. I am using NRF_RADIO peripheral in examples/peripheral/radio/receiver, I hope it is possible with it? I am aware about the channel setup but thanks for pointing that out aswell.
Maybe you can help me finding out what is the problem, I wrote this function to set the addresses:
typedef enum
{
LOGICAL_ADDRESS0 = 0,
LOGICAL_ADDRESS1,
LOGICAL_ADDRESS2,
LOGICAL_ADDRESS3,
LOGICAL_ADDRESS4,
LOGICAL_ADDRESS5,
LOGICAL_ADDRESS6,
LOGICAL_ADDRESS7
} logical_address;
uint32_t set_address(uint8_t* address, uint8_t address_size, logical_address address_num, bool clear_prev_addresses)
{
if (address_size < 3 || address_size > 5)
{
NRF_LOG_INFO("PROVIDED ADDRESS HAS WRONG 3<=SIZE<=5: %d !", address_size);
return NRF_ERROR_INVALID_PARAM;
}
if(address_num == LOGICAL_ADDRESS0) NRF_RADIO->BASE0 = bytewise_bitswap(((uint32_t*)address)[0], address_size-1); //logical address 0
else NRF_RADIO->BASE1 = bytewise_bitswap(((uint32_t*)address)[0],address_size-1); //for logical addresses 1-8
//uint32_t prefix0_mask = 0xFF;
uint8_t shift_multiplier = (uint8_t)address_num % 4;
if (address_num < LOGICAL_ADDRESS4)
{
NRF_RADIO->PREFIX0 &= ~(0x000000FF << shift_multiplier*8); // clean the desired address prefix field
NRF_RADIO->PREFIX0 |= (uint32_t)swap_bits(address[address_size-1]) << shift_multiplier*8; // Prefix byte of address 'address_num' converted to nRF24L series format
NRF_LOG_INFO("NRF_RADIO->PREFIX0 set to: %X",NRF_RADIO->PREFIX0);
}
else
{
NRF_RADIO->PREFIX1 &= ~(0x000000FF << shift_multiplier*8); // clean the desired address prefix field
NRF_RADIO->PREFIX1 |= (uint32_t)swap_bits(address[address_size-1]) << shift_multiplier*8; // Prefix byte of address 'address_num' converted to nRF24L series format
NRF_LOG_INFO("NRF_RADIO->PREFIX1 set to: %X",NRF_RADIO->PREFIX1);
}
if (clear_prev_addresses) NRF_RADIO->RXADDRESSES = 0x00;
NRF_RADIO->RXADDRESSES |= 0x01 << (uint8_t)address_num;
return NRF_SUCCESS;
}
So I call it this way:
set_address(address, address_size, LOGICAL_ADDRESS0, true); //when I want to clear previous addresses // Respecting that the previous address can be deleted in certain cases: set_address(address, address_size, LOGICAL_ADDRESS1, false); //when I want to add additional address
But here it only listens on the first address, but when I just use (it sets to only listen to Logical address 1):
set_address(address, address_size, LOGICAL_ADDRESS1, true); //clear previous addresses
Then I am getting the messages from this address, as expected.
You should know that the message rate is quite fast.
Hi
Have you considered using one of the proprietary protocols included in the SDK?
Then you don't have to spend time implementing low level features such as packet acknowledge, payload buffering etc.
You also get a cleaner interface to set addresses and other RF configuration parameters.
As for your issue, have you checked with the debugger to see if the BASE and PREFIX registers are set as you expect them to, after you have run the set_address function?
Best regards
Torbjørn
Hi,
I really need to work with native radio stack, so transferring to some higher level is not probably that good option. Luckily in the examples provided I found many things that I need.
I found out now actually that the example provided might be working ok, I had a problem with other part of the code, but I would still appreciate some feedback. Thanks
Best,
Hi
Keep in mind that you have all the source code available if you decide to use the nrf_esb library, so you can always make changes if needed.
If you are still having issues with the address, are you able to take a look at the relevant registers in the debugger and check what they are actually set to?
Just set a breakpoint in the code after you have run all the calls to the set_address function.
Best regards
Torbjørn