NCS UART uart_poll_out with nordic,nrf-uart faulty TX, but works nordic,nrf-uarte

Hi folks,

The blocking transmit function uart_poll_out() works as expected with UARTE, but not with UART.

For our project low power is critical. Thats why I need to use UART (~300 uA) instead of UARTE (~1300 uA). Baud is very low, so DMA does not benefit us.

brd_test.overlay file -> uart0 ->  compatible = "nordic,nrf-uart";

Figure. UART - faulty transmission

brd_test.overlay file -> uart0 ->  compatible = "nordic,nrf-uarte";

Figure. UARTE - transmission OK.

I also tried calling uart_irq_tx_ready() inside ISR -without effect.



I took the echo_bot example and modified it. Here are the files that i modified (i removed RX code for cleanness sake):

5852.main.cpp7028.prj.confbrd_test.overlaybrd_test.dtsi

# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(echo_bot_2)

target_sources(app PRIVATE src/main.cpp)

Second issue is that calling uart_irq_tx_enable(uart_dev) ends in signal handler. Please test it by adding uart_irq_tx_enable() inside uart_tx(). I hoped to work around the faulty transmission by using interrupt driven api, but I cant even enable the tx interrupt in the first place.

Third issue is being able to disable receiver (only async api has RX enable/disable). Unfortunately I couldn't get the async api it to receive in a stable manner. Thats another rant.
For interrupt driven driver I managed to get the sleep power consumption down 2.7 uA by calling pm_device_action_run() manually (as seen in the code). Are there any caveats doing it?

Parents
  • Yes, I can indeed reproduce it on my end, just wanted to let you know. I will still need some time to take a proper look at your project to see what exactly is happening, but it seems like it's always the 8th bit (stop bit) that is warped on the UART, so something is off there. Note that I used a logic analyzer instead of a scope, but it's still easy to see that it is warped and that it only happens when UART is used instead of UARTE.

    I'll give you another update by end of week. Hopefully we'll be able to find something soon.

    Best regards,

    Simon

Reply
  • Yes, I can indeed reproduce it on my end, just wanted to let you know. I will still need some time to take a proper look at your project to see what exactly is happening, but it seems like it's always the 8th bit (stop bit) that is warped on the UART, so something is off there. Note that I used a logic analyzer instead of a scope, but it's still easy to see that it is warped and that it only happens when UART is used instead of UARTE.

    I'll give you another update by end of week. Hopefully we'll be able to find something soon.

    Best regards,

    Simon

Children
No Data
Related