Higher level UART library that my ARM code can link to?

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
Posts: 7
Joined: Mon Oct 26, 2020 6:26 pm

Higher level UART library that my ARM code can link to?

Post by garya@arcimoto.com » Thu Dec 31, 2020 11:04 pm


I have a micropython project and am hooking up a module to a uart on a STM32F MCU. I have an existing C library that uses a COM port to communicate with a module. I'd really like to reuse that library on my micropython project.
I've looked through the lower level "drivers" such as uart.c and machine_uart.c as templates however whenever I attempt to compile and link them with my library I get way too many errors mostly from include and paths.
Is there a higher level abstracted uart.c module that can directly communicate with the STM32 MCU within the micropython build environment that I can link/use?
My interface from my library will have a micropython interface so I believe I have that covered.

Any help or pointers would be greatly appreciated.
Thanks in advance for any and all assistance.

User avatar
Posts: 3640
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada

Re: Higher level UART library that my ARM code can link to?

Post by dhylands » Thu Dec 31, 2020 11:38 pm

uart.h is the only interface to the UART library.

You could also use the UART code that comes with the HAL.

The various STM32 HAL: libraries can be found here: https://github.com/micropython/stm32lib ... d3a7f401ad

You'll need to pick whichevery directories are appropriate for the particular processor you're using. The HAL: libraries will require headers from CMSIS, which can be found in the CMSIS directory (from the HAL) and also here: https://github.com/micropython/micropyt ... /cmsis/inc

As far as include paths, you'll need to reference the cmsis/inc, and the stm32lib/CMSIS/PROCESSOR_FAMILY and the stm32lib/PROCESSOR_FAMILY_HAL_Driver/inc directories, along with the py directory and the ports/stm32 directory (and possibly a couple other directories - I'd need to see the exact errors that you're running into).

Post Reply