USART Code-snippets

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
User avatar
tfAteba
Posts: 551
Joined: Fri Oct 16, 2015 11:03 pm
Has thanked: 91 times
Been thanked: 50 times

Re: USART Code-snippets

Post by tfAteba »

Hi Chudik,

The default baud rate is effectively 38400 bps, it is define in the halconf.h file locate in your project directory. You can change it threre.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: USART Code-snippets

Post by Giovanni »

Hi,

If you want to set more parameters for each serial port then you need to use a SerialConfig, in that structure you can set baud rate and the content for CR1, CR2 and CR3 registers. The structure is passed as pointer to sdStart().

See serial_lld.h for the structure definition.

Giovanni
User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Has thanked: 7 times
Been thanked: 1 time

Re: USART Code-snippets

Post by Chudik »

Giovanni wrote:Hi,

need to use a SerialConfig, in that structure you can set baud rate and the content for CR1, CR2 and CR3 registers. The structure is passed as pointer to sdStart().

See serial_lld.h for the structure definition.

Thanks. This posting reminded me to add headers files to my project :)

Looked at serial_lld.h.
Seems like need to use CubeMX to fill out those structure. Or read full datasheet. Using CubeMX is definitely easy ;)
How good would be to combine these two great products... :roll:
Post Reply