How to use uart on Zephyr?

Hi all,

I’m trying to control an E220-900T22L(JP)-EV82 LoRa module from a XIAO nRF54L15 over UART, and I’m running into two UART-related issues that I haven’t been able to resolve cleanly.

Setup

  • Board: Seeed Studio XIAO nRF54L15

  • Radio module: EBYTE E220-900T22L(JP)-EV82

  • SDK: nRF Connect SDK / Zephyr

  • UART tested with:

    • uart_poll_out()

    • Zephyr UART async API

  • UART output monitored using:

    • WCH-Link in serial-to-USB mode

Problem 1: Lower baud rates produce corrupted output

At high baud rates (for example 115200), UART output looks mostly fine.

However, as I lower the baud rate, garbage characters gradually increase. At 9600bps (the rate I actually need), the output becomes completely corrupted.

Interestingly, if I add a small delay before and after uart_poll_out() like this:

while ( some_condition ) {
    uart_poll_out(uart, c);
    k_busy_wait(1000);
}

the corruption disappears and 9600bps works correctly.

So this feels timing-related, but I’d like to understand the real cause and find a cleaner solution rather than inserting busy waits around every transmitted byte.

This same behavior occurs both with:

  • uart_poll_out()

  • UART async API

Problem 2: RX does not work

TX works (with the workaround above), but I cannot receive data from UART RX at all.

I tested:

  • polling API

  • async API

but neither receives any bytes.

Additional notes

  • The UART is connected directly between the XIAO nRF54L15 and the E220 module

  • I also tested using the WCH-Link serial monitor to inspect TX output

  • This issue appears independent of which UART API is used

  • I suspect either:

    • clock/timing configuration

    • pin configuration

    • hardware flow/timing issue

    • or something specific to the nRF54L15 UART peripheral / current Zephyr support

I uploaded the test code to GitHub Repo here:

Has anyone seen similar UART timing issues on the XIAO nRF54L15, especially at lower baud rates like 9600bps? Any ideas why adding delays around TX fixes corruption, and why RX might fail entirely?

Thanks,
Zhixuan

This is fix.

see DEVZONE.

Hi there,

Being it is used here, I’ll repost it so we can locate it easier.

THE fix;

"NRF_POWER->TASKS_CONSTLAT = 1;"
This register setting should be called if port2 pins are used in uart21

And to save power in sleep mode, it is better to call 
 "NRF_POWER->TASKS_LOWPWR = 1;" after the peripheral is no longer in use

Good stuff indeed :grin:

HTH

GL :slight_smile: PJ :v: