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

nRF52840DK Libuarte Balloc Fails

Hello,

I've been working with a nRF52840DK and the ble_app_uart example (examples\ble_central\ble_app_uart_c) trying to modify it as needed for my application. The dev kit is connected to another device for UART communication, which is constantly sending data rapidly to the dev kit's RX pin. I've noticed that the dev kit eventually hangs and stops responding, which I have isolated to the data coming into the dev kit.

I tried out the libuarte example (examples\peripheral\libuarte), and it was able to run without a single issue observed, so I'm trying to switch from app_uart to libuarte since it seems more stable.

I've disabled app_uart in the sdk_config file for the ble_app_uart example and modified the config as necessary based on the libuarte example's sdk_config. I think the project is setup correctly in terms of include paths, sdk_config, and the minor changes in main.c, but I'm running into a run-time error in the "nrf_libuarte_async_enable" function related to balloc.

00> <info> app_timer: RTC: initialized.
00> 
00> <error> app: ERROR 0 [NRF_SUCCESS] at C:\nRF5_SDK_17.0.0_9d13099\components\libraries\libuarte\nrf_libuarte_async.c:596
00> 
00> PC at: 0x0002965D
00> 
00> <error> app: End of error report

void nrf_libuarte_async_enable(const nrf_libuarte_async_t * const p_libuarte)
{
    uint8_t * p_data;
    p_data = nrf_balloc_alloc(p_libuarte->p_rx_pool); // This is null and results in error below
    p_libuarte->p_ctrl_blk->alloc_cnt++;
    if (p_data == NULL)
    {
        APP_ERROR_CHECK_BOOL(false);
    }
    
    ...
    
}

I'm not really sure how to proceed since the project compiles fine, and I cannot see anything in the libuarte sdk_config which I have not brought over to the ble_app_uart sdk_config. Here is the project folder zipped if someone can help show me what I'm doing wrong.

Related