Difference between uart_fifo_fill and uart_poll_out

Hello,
I am developing a uart communication between the nrf52833 and the nrf9160. I found some examples but I don't want to use the HCI layer, I prefer to use the NUS service.
The idea is that the nrf52833 can be connected. As soon as a device connects to it, it activates the uart link and wakes up the nrf9160.
The code on the nrf52833 side is mostly done, but I'm looking for examples for the nrf9160 side.
I'm using the nrf/samples/peripheral/lpuart example which handles the wake up from interrupt well but I don't understand the uart_poll_out call in interrupt_driven and uart_fifo_fill in the isr. Are both calls mandatory ?

Parents
  • Hello,

    Based on the documentation (see link) it seems that uart_fifo_fill() is only mandatory if you include uart_irq_tx_ready() in your ISR. This function can be used  when you want to transmit multiple bytes at at time, but since it can only be called from the ISR, you have to pass the data to be transmitted to the ISR using k_fifo, etc. uart_poll_out() is optional to use and can be called from the thread context. The limitation is it can only send one byte at a time.

    I actually find the async API to be more intuitive, possibly because it is more similar to the UART driver API we had in the nRF5 SDK.

Reply
  • Hello,

    Based on the documentation (see link) it seems that uart_fifo_fill() is only mandatory if you include uart_irq_tx_ready() in your ISR. This function can be used  when you want to transmit multiple bytes at at time, but since it can only be called from the ISR, you have to pass the data to be transmitted to the ISR using k_fifo, etc. uart_poll_out() is optional to use and can be called from the thread context. The limitation is it can only send one byte at a time.

    I actually find the async API to be more intuitive, possibly because it is more similar to the UART driver API we had in the nRF5 SDK.

Children
No Data
Related