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

app_uart_get fifo size

Hi,

When the UART is configured to use FIFO , i use the UNUSED_VARIABLE(app_uart_get(rxdata)); to read a buffer from FIFO.

how can i also receive a number of bytes it is get and not just a pointer ?

Thanks.

  • Hi Max,

    app_uart_get() only get one byte from the FIFO and put to the pointer (rx_data). You need to call that again to get more bytes until you get NRF_ERROR_NOT_FOUND. Please see the documentation:

    /**@brief Function for getting a byte from the UART.
     *
     * @details This function will get the next byte from the RX buffer. If the RX buffer is empty
     *          an error code will be returned and the app_uart module will generate an event upon
     *          reception of the first byte which is added to the RX buffer.
     *
     * @param[out] p_byte    Pointer to an address where next byte received on the UART will be copied.
     *
     * @retval NRF_SUCCESS          If a byte has been received and pushed to the pointer provided.
     * @retval NRF_ERROR_NOT_FOUND  If no byte is available in the RX buffer of the app_uart module.
     */
    uint32_t app_uart_get(uint8_t * p_byte);
    
Related