2026-01-02 1:45 PM - last edited on 2026-01-03 2:17 AM by Andrew Neil
Zephyr RTOS 4.3.
I am trying to get this sample working on my STM32 Nucleo F767ZI board:
zephyr/samples/drivers/uart/async_api/
I created an overlay file.
nucleo_f767zi.overlay
dut: &usart3 {
dmas = <&dma1 2 STM32_DMA_PERIPH_TX>,
<&dma1 3 STM32_DMA_PERIPH_RX>;
dma-names = "tx", "rx";
};
&dma1 {
status = "okay";
};
Building and running the sample I get the following output:
*** Booting Zephyr OS build v4.3.0-929-g1d6e0d533a81 ***
[00:00:05.000,000] <inf> sample: Loop 0: Sending 3 packets
[00:00:05.000,000] <err> uart_stm32: Tx buffer should be placed in a nocache memory region
[00:00:05.000,000] <err> sample: Unknown error (-14)
[00:00:05.000,000] <err> uart_stm32: Tx buffer should be placed in a nocache memory region
[00:00:05.000,000] <err> sample: Unknown error (-14)
[00:00:05.000,000] <err> uart_stm32: Tx buffer should be placed in a nocache memory region
[00:00:05.000,000] <err> sample: Unknown error (-14)
[00:00:05.000,000] <inf> sample: RX is now enabled
I then updated my prj.conf adding nocache support:
prj.conf
CONFIG_LOG=y
CONFIG_NET_BUF=y
CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_NOCACHE_MEMORY=y
I then pulled over the macro definition for this line:
NET_BUF_POOL_DEFINE(tx_pool, LOOP_ITER_MAX_TX, MAX_TX_LEN, 0, NULL);
And changed:
static uint8_t __noinit net_buf_data_##_name[_count][_data_size] __net_buf_align;
to:
static uint8_t __nocache net_buf_data_##_name[_count][_data_size] __net_buf_align;
Thus putting the Tx buffer in nocache memory, but now I am getting these errors:
*** Booting Zephyr OS build v4.3.0-929-g1d6e0d533a81 ***
[00:00:05.000,000] <inf> sample: Loop 0: Sending 3 packets
[00:00:05.000,000] <err> dma_stm32: Memcopy not supported for device dma@40026000
[00:00:05.000,000] <err> uart_stm32: dma tx config error!
[00:00:05.000,000] <err> sample: Unknown error (-22)
[00:00:05.000,000] <dbg> sample: main: Queuing buffer 0x20022458
[00:00:05.000,000] <dbg> sample: main: Queuing buffer 0x20022470
[00:00:05.000,000] <inf> sample: RX is now enabled
[00:00:06.044,000] <dbg> sample: uart_callback: EVENT: 0
[00:00:06.044,000] <dbg> sample: uart_callback: TX complete 0
[00:00:06.044,000] <err> dma_stm32: Memcopy not supported for device dma@40026000
[00:00:06.044,000] <err> uart_stm32: dma tx config error!
[00:00:06.044,000] <err> sample: TX from ISR failed (-22)
[00:00:07.076,000] <dbg> sample: uart_callback: EVENT: 0
I also noticed in my build output the messages:
/home/myuser/Projects/uart_async_api/build/primary/zephyr/zephyr.dts:550.4-551.31: Warning (dmas_property): /soc/serial@40004800:dmas: cell 5 is not a phandle reference
/home/myuser/Projects/uart_async_api/build/primary/zephyr/zephyr.dts:550.4-551.31: Warning (dmas_property): /soc/serial@40004800:dmas: Could not get phandle node for (cell 5)
Is the above related to the issues I am seeing?
Does the STM32 Zephyr driver support the UART Async API?
If so, how can I get it working?
Thank you.
2026-01-20 1:50 AM
hello @digitalone
Regarding your question: Does the STM32 Zephyr driver support the UART Async API?
Yes, it does support the UART Async API, provided that:
CONFIG_LOG=y
CONFIG_NET_BUF=y
CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_DMA=y
CONFIG_NOCACHE_MEMORY=y
CONFIG_NOCACHE_MEMORY_STATIC=y
also, to fix the issues you are seeing:
Correct the DTS overlay so that it complies with the Zephyr binding for the STM32 DMA v2 implementation:
Zephyr implementation st,stm32-dma-v2
Example:
&usart3 {
status = "okay";
current-speed = <115200>;
dmas = <&dma1 2 1 (STM32_DMA_PERIPH_TX | STM32_DMA_PRIORITY_HIGH)>,
<&dma1 3 1 (STM32_DMA_PERIPH_RX | STM32_DMA_PRIORITY_HIGH)>;
dma-names = "tx", "rx";
};
&dma1 {
status = "okay";
};
with these adjustments, the samples/drivers/uart/async_api/ example works on the Nucleo-F767ZI with UART3 + DMA, with no DTS warnings and no DMA/UART driver errors.
best regrads,
Hamdi
2026-01-20 7:37 PM
Thank you for the reply.
I am getting compile errors now.
It occurs as soon as I add "CONFIG_NOCACHE_MEMORY_STATIC=y" to the prj.conf file.
I cannot find it defined anywhere, what does it do?
If I comment out the above and update the device tree overlay with what you provided above I get this error:
devicetree error: <Node /clocks/pll in ~/zephyrproject/zephyr/dts/arm/st/f7/stm32f7.dtsi:87> lacks #dma-cells
I don't understand this as when I look in that file I do see dma-cells.