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

nrf24le1 serial and wireless I/O - interrupts VS polling

Hi all,

I have an application where an nrf24le1 is communicating serially with another processor, using the UART at 57600 bps. I have multiple identical boards communicating wirelessly with each other through the nrf24le1.

I'm using the Keil toolchain to compile code (uvision 4 standalone). In my code I have a simple main loop, which 1) tries to receive a packet 2) interprets the packet 3) replies with a packet (if the packet was intended for this board).

I'm not using any of the multiceiver logic. The packets all use the default address and I created a time division multiplexing kind of scheme to make it all work. One board is the master and sends packets with unique numbers and the other boards reply when they get a packet with their number.

The other boards are also receiving packets not intended for them, and use some of the info in those packets for synchronisation purposes.

It works pretty well, but I have the impression I am losing some packets and that this might not be due to interference but more due to a software problem.

The code uses interrupt handlers for the wireless and serial comm. When the wireless packet is received or sent there is an interrupt and each time a serial byte is received or sent I also get an interrupt. These interrupts set flags on which I can wait in my main loop if necessary.

My question:

What is the best way to choose which tasks (wireless I/O or serial comm) should use interrupts and which shouldn't?

I am thinking that one of the two tasks might be in the way of the other task, causing packets to get lost or serial messages to get lost.

I can't decide whether the wireless stuff should just use polling and no interrupts or whether the serial comm should do that and the wireless stuff should just use interrupts.

Thanks! B

Related