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

Example code for fully implemented libuarte with uart

Hi Nordic Tech Support team,

One of my customers is having some problem with UARTE implementation. They used the ble_app_uart example (pca10056 with SoftDevice 113) as a start.

Setup right now is :

nRF52 DK -> Raytac module MDBT50Q-DB (nRF52840) <-(uart)-> STM32F103C8

Initially, they started with using app_uart library, however reading that it's not suitable for handling a lot of data transfer in the pipeline from STM32 UART port, the nRF keeps triggers "Error 1 NRF_ERROR_SVC_HANDLER_MISSING. "(Overrun error) 

So, they tried using the suggested new libuarte library so that it can handle multiple bytes stream, and combined ble_app_uart with the libuarte example. So far, the program compiles after a lot of debugging, but when they connected it to the phone and send command from phone to nrf, it keeps crashing. 

Can you pls confirm what to set in the "sdk_config.h", because there is configuration related to UART, UARTE, LIBUARTE. Seems like there are some dependencies between their config. 

And pls advise how to initialise libuarte instance properly. "NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 1, 1, 1, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);"  

Currently, they stuck with this error which is "NRFX_ASSERT(p_cb->state == NRFX_DRV_STATE_INITIALIZED)" under nrfx_err_t nrfx_uart_tx(nrfx_uart_t const * p_instance,

                        uint8_t const *     p_data,

                        size_t              length)

 which happens under  err_code = app_uart_put(p_evt->params.rx_data.p_data[i]); under nus_data_handler() in ble_app_uart.

 The value of the p_cb->state == NRFX_DRV_STATE_UNINITIALIZED in their program, even though they already turn on the NRFX_UART and NRFX_UARTE config in "sdk_config.h"

 Should they be calling nrfx_uart_tx or nrfx_uarte_tx, and would they need to turn off UART config if using UARTE?

They have referred to these threads extensively, however referring to some example codes that have fully implemented libuarte with uart would be good.

 

https://devzone.nordicsemi.com/f/nordic-q-a/30997/understand-uart-uarte-and-getting-it-to-work-with-ppi

https://devzone.nordicsemi.com/f/nordic-q-a/47685/libuarte-on-ble_app_uart-with-dma

https://devzone.nordicsemi.com/f/nordic-q-a/41215/general-libuarte-questions

https://devzone.nordicsemi.com/f/nordic-q-a/57431/libuarte_async-bug-s---missing-data-wrong-buffer-returned

https://jimmywongiot.com/2019/12/15/high-speed-uart-on-nordic-nrf52-series/

Parents Reply Children
No Data
Related