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

uart_init() in dtm_start() cannot be completed on Connectivity board

I try DTM using the serialized application. The serialized application interface is UART.

The software on Connectivity board is ble_connectivity in nRF5 SDK, it is not modified.

After transmitting ble_dtm_init()/ble_dtm_init_req_enc() command from Application board,

dtm_start() was executed on Connectivity board. But, nrfx_uarte_uninit() in dtm_start()  could not be completed.

Call stack and un-completed code are the following.

Call stak: ser_conn_is_ready_to_enter_dtm() -> dtm_start() -> uart_init() -> nrf_drv_uart_uninit() -> nrfx_uarte_uninit()

nrfx_uarte.c (Line 317-320): 

    // Wait for TXSTOPPED event and for RXTO event, provided that there was ongoing reception.
    while (!nrf_uarte_event_check(p_reg, NRF_UARTE_EVENT_TXSTOPPED) ||
           (p_cb->rx_buffer_length && !nrf_uarte_event_check(p_reg, NRF_UARTE_EVENT_RXTO)))
    {}

Why cannot it complete?

Parents Reply Children
  • Hi Jørgen-san,

    Thank you for your replay.

    SDK version is 17.0.2. I use the project file  

    "\nRF5_SDK_17.0.2_d674dde\examples\connectivity\ble_connectivity\pca10040\ser_s132_uart\ses/ble_connectivity_s132_uart_pca10040.emProject".

    The debugger calls nrf_drv_uart_uninit() at line136  in "\nRF5_SDK_17.0.2_d674dde\components\serialization\connectivity\hal\dtm_uart.c" 

    Best regards,

    H.O

  • Hi H.O,

    Sorry for the slow response. I must have missed that call to nrf_drv_uart_uninit() somehow.

    I think that this call may be redundant and may cause issues. nrf_drv_uart_uninit() is also called inside ser_hal_transport_close(), which is called right before dtm_start(). nrfx_uarte_uninit() will call nrf_uarte_disable(), which disables the peripheral. There seems to be no check if the peripheral is enabled before triggering the STOPTX/STOPRX tasks, and the corresponding events may not be generated if the peripheral is already disabled.

    Can you check the state of NRF_UARTE0->ENABLE register after ser_hal_transport_close() and before dtm_start() call? You may also try to remove the call to nrf_drv_uart_uninit() in uart_init(), to see if you get any error codes.

    Best regards,
    Jørgen

Related