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

device match

Hello, I am trying a simple btle application where one mcu will send a "help" message and another will respond with its address. The mcu that asks for stores the address of the responder and sets the dev match readio. like so

void setdevmatch0(uint32_t least_sig, uint16_t most_sig)

{

disable_radio(); /* set dev match address */

NRF_RADIO->DAB[0] = least_sig; // 0x4ae67dbe 32 least significant NRF_RADIO->DAP[0] = most_sig; // 0x1172 16 most significant NRF_RADIO->DACNF |= (0x1) | (0x100); //enable addrress0 and keep any other dev match settigns

hal_radio_set_rcv_mode(); hal_radio_rcv();

}

essentially I deactivate the radio set the registers and then put the mcu to listen. it then goes into a while loop waiting for only messages from the other mcu.

while(1)

{


__nop();

if (NRF_RADIO -> EVENTS_DEVMATCH == 1)
	{
	NRF_RADIO -> EVENTS_DEVMATCH = 0; // clear our devmatch
	parse_message((void *) NRF_RADIO->PACKETPTR);
	NRF_RADIO->PACKETPTR = (uint32_t)&bootloader_packetptr; //update packetpointer
	NRF_RADIO->TASKS_START = 1;
	}
// need to create aomething to parse data... similiar to interrupt but interrupts are turned off
//toggle_led();
//its pressed, new fw
//wait_for_firmware();
}

this is just a simple wait for a devmatch and do something with the received packet. Problem I am having is that I can not get this to run in real time. If I set a breakpoint in the if statement I reach it and parse the data correctly. If I do not set a breakpoint at this location I never enter my parse data function.

Is there anything special, hints tips or tricks to using this dev amtch feature? I have the sender transmitting a packet a fll power every 250ms. So it is plenty of time for the receiver to parse the data and enter back into receive state.

I am using nrf52 btw

Thank you,

Eric Micallef

Related