Uart is initialized in non blocking mode but i need to use blocking transfer in a spacial case: is there any function available for this.

Uart is initialized in non blocking mode but i need to use blocking transfer in a spacial case: is there any function available for this.

I can not reinitialize nrf_dvr_init for this case.

i need to blocl rt=nrf_drv_uart_tx(&uart_instent_0, data, size); function with some while loop, but i dont know how to read tx empty flag.

  • In this case you need to wait for the NRF_DRV_UART_EVT_TX_DONE event. I you are waiting with a lower interrupt priority than the UART interrupt  you can simply use a volatile variable that you write to when you get the NRF_DRV_UART_EVT_TX_DONE, and wait for that to get the expected value in a loop. Or you can do some thing a bit more elegant, depending on your needs. You can see some examples of the use of NRF_DRV_UART_EVT_TX_DONE if you search for it in the SDK.

Related