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

hal_nrf nrf24le1 timing problem

Hello,

i am currently working at a project which includes radio transmission based on th hal_nrf library. I am using parts of an example code, which worked fine for me till now. My problem is that the transmission itselfs blocks quite some time, which i basically dont have. :-)

Here is my Code of the radio transmission part:

//********** Send Over Radio *************
void radio()
{
	
	zaehler_t1 = 0;
	// Write payload to radio TX FIFO
	hal_nrf_write_tx_payload(radio_load, 3U);

	// Toggle radio CE signal to start transmission
	CE_PULSE();

	radio_busy = true;
	// Wait for radio operation to finish
	
	
	while (radio_busy)
	{
	}
	
	
}

//********** Radio interrupt *************
NRF_ISR()
{
	uint8_t irq_flags;
  
  // Read and clear IRQ flags from radio
  irq_flags = hal_nrf_get_clear_irq_flags();

  switch(irq_flags)
  {
    // Transmission success
    case (1 << (uint8_t)HAL_NRF_TX_DS):
      radio_busy = false;
      // Data has been sent
      break;
    // Transmission failed (maximum re-transmits)
    case (1 << (uint8_t)HAL_NRF_MAX_RT):
      // When a MAX_RT interrupt occurs the TX payload will not be removed from the TX FIFO.
      // If the packet is to be discarded this must be done manually by flushing the TX FIFO.
      // Alternatively, CE_PULSE() can be called re-starting transmission of the payload.
      // (Will only be possible after the radio irq flags are cleared)
      hal_nrf_flush_tx();
      radio_busy = false;
      break;
    default:
      break;
  }

Of course i enabled the radio clock and the radio interrupt before and powered it up. The main problem is the part:

while (radio_busy)
    	{
    	}

Is someone familiar with the hal_nrf library and knows if i really need to wait till the radio is not busy any more?

And my second question is. Does someone know which timers or rtc, of the nrf24le1, the hal_nrf library uses?

Parents Reply Children
Related