cancel
Showing results for 
Search instead for 
Did you mean: 

Serial library for STM32

bernier-paul
Associate II
Posted on November 23, 2012 at 23:08

Hi,

Does exist any serial library for STM32 ? I searched on this forum and google and I found nothing, I'm looking for a traditional serial lib that allows to send other types of data than char (int32_t, float ...) and that has ''high level'' read functions (with a circular buffer). 

Thank you :)
6 REPLIES 6
Posted on November 25, 2012 at 16:30

Have you checked the documentation for whatever toolset(s) you're using - to see what support it/they provide(s)...?

bernier-paul
Associate II
Posted on November 25, 2012 at 21:38

Heu... I have got an STM32F4DISCOVERY, the only possibilities for the time being are to get and put one byte, that's why I was asking if some lib exists to allow more ''high level'' functions. Otherwise I'll implement it myself, it's just more boring (I already did it on AVR)

Posted on November 27, 2012 at 08:40

''I have got an STM32F4DISCOVERY''

You must also have some software development toolset - Keil, IAR, or whatever.

You need to study the documentation for that toolset - it will tell you what facilities are provided, and what you need to do to specifically customise them to your particular platform.

For Keil, this is known as ''retargetting'' - and they certainly do support things like gets()...

eg,

http://www.keil.com/support/man/docs/armlib/armlib_cjaghcgj.htm

bernier-paul
Associate II
Posted on November 27, 2012 at 21:29

Ok now I understand better what you mean, thank you. I use CoIDE and indeed there is a way to retarget printf to an UART. Unfortunately it doesn't look very convenient if I use several UART for example, isn't it ? By the way I wrote an .hpp quite nice to handle UARTs, I have to test and debug it further and then I'll upload it and share on github.

Posted on November 27, 2012 at 22:08

''Unfortunately it doesn't look very convenient if I use several UART for example, isn't it?''

 

 

But that's not essentially any different from using multiple devices on a PC - is it?

You have one ''default'' device - called stdout - used by printf, but any additional devices you'd have to open individually, and access via suitable fprintf calls...

bernier-paul
Associate II
Posted on November 29, 2012 at 13:07

As promised I put my lib on github. It's a very simple way to use the UARTs of the STM32F4 (transmission/reception). Feel free to make any comments and to report bugs :)

https://github.com/Absurdev/UART_STM32F4