Electronics > Microcontrollers

Multi-port DMA uart library for all STM32 series (f1,f4,h7,etc.) and pic32mk.


Download: stm32uart.zip - library with two usage examples (stm32cubeide ioc files with main.c for stm32f103c8t6).
How-to (using stm32cubeide configurator window):
1) Enable 3 uart ports
2) Enable global interrupt for each port
3) Enable TX and RX dma channels
4) Set all RX dma channel modes to circular
5) Generate code
6) Add uart.h, uart.c to path, include uart.h
7) Use COM_Init(handle,buffer,buffer_size,timeout) on each HAL port
8) Use COM_Select(), COM_Read(), COM_Write()

It is stripped down version of my UART library. Functions removed: CRC32, retry algorithm, PIC32 support, hexadecimal strings parsing, mem2mem, etc. I made this version for my tutorial in STM32. This version may have some bugs, but the method was tested on stm32f103,f407,f446,h750,h7b0. I tried to keep it simple, rs485 support not tested in this version. I'll post PIC32MK version later + add comments from tutorial.

3-port usage example (don't forget to enable 3 uarts, their global interrupts and circular mode for RX dma channels):

On STM32H7 you need to put uart buffer in DMA memory. Write functions can be modified to send data from non-DMA memory (copy to temporary buffer that can be accessed by dma).

Added video tutorials:

1. Step-by-step 5 port Uart DMA on STM32H750

2. UART Library on stm32f030 and stm32g030

Attached version with little fix for STM32F4. Latest version will be available here.

Thanx for the effort.

But I'll have to pass on the new uart lib for the F030.
Registering everywhere just to dl. a library is too cubersome , even if it's free (ATM)

Nice PDF guide  :-+



--- Quote from: bingo600 on December 03, 2023, 09:39:04 am ---Registering everywhere just to dl. a library is too cubersome , even if it's free (ATM)

--- End quote ---
Downloading these files does not require registration (if you came using link from my youtube channel)
email-free login link:

https://www.thundertronics.com/STM32_UART_Library/stm32uart-v1_0.zip (with fixed define for stm32f4: here)


[0] Message Index

There was an error while thanking
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod