Re: Using UART on STM32-H753 with Asynchrnous API

Weiberg, Bernd

Thanks for the quick reply!

Meanwhile I found some device tree related stuff under zephyr/tests/drivers/uart/uart_async_api/board/nucleo_h743zi.overlay

&usart2 {

                dmas = <&dmamux1 2 44 0x440>,

                               <&dmamux1 3 43 0x480>;

                dma-names = "tx", "rx";

                pinctrl-0 = <&usart2_tx_pd5 &usart2_rx_pd6>;

                pinctrl-names = "default";

                current-speed = <115200>;

                status = "okay";



&dma1 {

                status = "okay";



&dma2 {

                status = "okay";



&dmamux1 {

                status = "okay";


I copied the dma settings from the uart to my device tree and also enabled dma2 and dammux1 (not sure if that is really important).

But now I’am able to build again and uart_callback_set() doesn’t return an error anymore.

Now I got ENODEV when trying to receive by calling uart_rx_enable().

The driver code there is something like:

static int uart_stm32_async_rx_enable(const struct device *dev,

                               uint8_t *rx_buf, size_t buf_size, int32_t timeout)


                struct uart_stm32_data *data = dev->data;

                USART_TypeDef *UartInstance = UART_STRUCT(dev);

                int ret;


                if (data->dma_rx.dma_dev == NULL) {

                               return -ENODEV;


So it seems that there is no dma associated with my uart.

Perhaps the reason is that I am using usart3 and not usart2 (as it is the case in the example above).





Von: Jason Bens <Jason.Bens@...>
Gesendet: Donnerstag, 17. Februar 2022 15:16
An: Weiberg, Bernd (SMO RI R&D DF 1) <bernd.weiberg@...>; users@...
Betreff: RE: Using UART on STM32-H753 with Asynchrnous API


There’s not a lot happening behind the scenes.  This is the definition of uart_callback_set():


static inline int uart_callback_set(const struct device *dev,

                                                                uart_callback_t callback,

                                                                void *user_data)



               const struct uart_driver_api *api =

                                             (const struct uart_driver_api *)dev->api;


               if (api->callback_set == NULL) {

                              return -ENOSYS;



               return api->callback_set(dev, callback, user_data);


               return -ENOTSUP;




Have you confirmed that CONFIG_UART_ASYNC_API is being set as expected in /include/generated/autoconf.h?


  • Jason


From: users@... <users@...> On Behalf Of Weiberg, Bernd
Sent: February 17, 2022 2:42 PM
To: users@...
Subject: [Zephyr-users] Using UART on STM32-H753 with Asynchrnous API


External Email:

Hello everybody,

has anyone expirence with the asynchronous API and the uart on a STM32?

The API is quite simple to handle, but I got -ENOTSUP when I call uart_callback_set().

I have set the following Kconfigs:





I think that this has something to do with the dma controller.

I have just tried to enable it, by settings it status to “okay” in my board device tree:

&dma1 {

    status = "okay";


This won’t be enough.

Now I can’t even build my application due to errors on undeclared DMA_CHANNEL:

/home/zephyrproject/zephyr/drivers/dma/dma_stm32_v1.c: In function 'dma_stm32_slot_to_channel':

/home/zephyrproject/zephyr/drivers/dma/dma_stm32_v1.c:42:3: error: 'LL_DMA_CHANNEL_0' undeclared (first use in this function); did you mean 'LL_DMAMUX_CHANNEL_0'?


Is there any example project out there, where a uart on a stm32 was used with the asynchronous API?



Join to automatically receive all group messages.