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

How to use app_uart?

Hello,

I cannot find an example in the current SDK on how to use APP_UART. I do not want to use app_uart_fifo because it has quite some overhead that I do not need. All I need to implement is an interrupt driven receive that uses flow control and I want to have a transmit function that blocks until all data is sent. I am currently using a loop that tries to send characters until everything is sent but I have a problem in that it blocks when it is called from the uart interrupt I suppose. As soon as I call my PutString method, the uart transmit function will only send one character after which it blocks. How is this supposed to be implemented? I think I should call my code outside the interrupt handler? Why is the app_uart implementation not providing a putString method? Because the underlying driver seems to support it.

Marius

Parents
  • Hi Marius,

    app_uart only handles one byte at a time. So printf or putstring only send one byte. You may need to write some code if you want to use app_uart and want to send several byte at a time.

    You can either using app_uart_put() and put it into a loop to retry if NRF_ERROR_NO_MEM or NRF_ERROR_INTERNAL return. Or you can use an event handler and catch NRF_DRV_UART_EVT_TX_DONE to know when to send the next byte.

Reply
  • Hi Marius,

    app_uart only handles one byte at a time. So printf or putstring only send one byte. You may need to write some code if you want to use app_uart and want to send several byte at a time.

    You can either using app_uart_put() and put it into a loop to retry if NRF_ERROR_NO_MEM or NRF_ERROR_INTERNAL return. Or you can use an event handler and catch NRF_DRV_UART_EVT_TX_DONE to know when to send the next byte.

Children
Related