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

What should I do if a fatal error occurs when running APP_UART_FIFO_INIT?

sdk12.3.0
In the ble_app_hrs_rscs_relay example, I added the uart_init function referring to the ble_uart example, but when I execute the APP_UART_FIFO_INIT () function, a fatal error occurs. Is there a workaround?
  • I was able to make it work by following the steps given by Petter Myhre in this answer. First complete step 1 and 2, then in step 3 you need to do some modification to the sdk_config file belonging to the ble_app_hrs_rscs_relay project.

    • Search for APP_FIFO_ENABLED and RETARGET_ENABLED in the sdk_config file of the ble_app_uart project and copy out the parts shown below

    // <q> APP_FIFO_ENABLED  - app_fifo - Software FIFO implementation
     
    
    #ifndef APP_FIFO_ENABLED
    #define APP_FIFO_ENABLED 1
    #endif
    
    .
    .
    .
    .
    .
    .
    
    // <q> RETARGET_ENABLED  - retarget - Retargeting stdio functions
     
    
    #ifndef RETARGET_ENABLED
    #define RETARGET_ENABLED 1
    #endif

    • Then insert it into the sdk_config file of the relay project
    • Remeber to set APP_UART_ENABLED to 1

    Add the following code to main:

    #include "app_uart.h"
    #define UART_TX_BUF_SIZE 256                         /**< UART TX buffer size. */
    #define UART_RX_BUF_SIZE 256                         /**< UART RX buffer size. */
    
    /**@snippet [Handling the data received over UART] */
    void uart_event_handle(app_uart_evt_t * p_event)
    {
    			//Handle the event
    }
    
    /**@brief  Function for initializing the UART module.
     */
    /**@snippet [UART Initialization] */
    static void uart_init(void)
    {
        uint32_t                     err_code;
        const app_uart_comm_params_t comm_params =
        {
            RX_PIN_NUMBER,
            TX_PIN_NUMBER,
            RTS_PIN_NUMBER,
            CTS_PIN_NUMBER,
            APP_UART_FLOW_CONTROL_DISABLED,
            false,
            UART_BAUDRATE_BAUDRATE_Baud115200
        };
    
        APP_UART_FIFO_INIT( &comm_params,
                           UART_RX_BUF_SIZE,
                           UART_TX_BUF_SIZE,
                           uart_event_handle,
                           APP_IRQ_PRIORITY_LOWEST,
                           err_code);
        APP_ERROR_CHECK(err_code);
    }
    /**@snippet [UART Initialization] */
    
    int main(void)
    {
        uart_init();
        .
        .
    }
    
    

    Best regards Simon

Related