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

non blocking delay

Hi,

I work with a ship nrf52832.

I try to realise a communication beetween an UART sensor and the ship.

When i send my command (app_uart_put), i use nrf_delay_ms fonction to wait the answer and synchnise my communication. 

But during the delay my bytes are not sent.

Actually my soft is based on the ble_perepherical/ble_app_uart SDK example.

Thanks for you help

Regards 

Guillaume

Parents
  • The nrf_delay function uses __NOP(); (ie, no operation) repeatedly to affect the delay. It is kind of a lazy approach to a delay function.

    Since this holds up the processor, I would assume the UART comms are getting lost. The UART uses DMA to pass the data to the processor but likely the UART driver is held up or slowed down while your delay runs.

    You can use the app timer to make a timer that uses the hardware timers for your delay.  The hardware timers don't affect the processor activity. Or you can build the thing by hand using the timers and UART events to make your delay.

Reply
  • The nrf_delay function uses __NOP(); (ie, no operation) repeatedly to affect the delay. It is kind of a lazy approach to a delay function.

    Since this holds up the processor, I would assume the UART comms are getting lost. The UART uses DMA to pass the data to the processor but likely the UART driver is held up or slowed down while your delay runs.

    You can use the app timer to make a timer that uses the hardware timers for your delay.  The hardware timers don't affect the processor activity. Or you can build the thing by hand using the timers and UART events to make your delay.

Children
No Data
Related