cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429i-Discovery : USART issue & system_stm32f4xx.c

stephane
Associate II
Posted on February 12, 2014 at 14:42

Dear all,

I am using the STM32F429i-Discovery, and I experience some problems with UART communication: received symbols are differents from TX.

Discussing with some colleagues points out the baudrate might be in charge, so I have two options:

- using a scope to determine the real baudrate

- ensure the clock is correcly configured

For the second option, I was looking for the SystemInit and SystemCoreClock configuration. It seems the related file is system_stm32f4xx.c

In the differents example projects I noticed 2 versions of this file, one ''20-September-2013'' (ST lib V1.0.0), the other ''11-November-2013'' (ST lib V1.0.1).

For both of them,  ''This file is customized to run on STM32F429I-DISCO board only

''

They are quite differents, for PLL_M, M P and Q.

I know the HSE_frequency is the crystal frequency (8MHz).

What should be the correct PLL values ?

Thanks & Regards

5 REPLIES 5
Posted on February 12, 2014 at 18:12

Use the system_stm32f4xx.c from the Project Template directory.

STM32F429I-Discovery_FW_V1.0.1\Projects\Template\system_stm32f4xx.c

PLL_M needs to be 8 for the 8 MHz crystal, and the project must define HSE_VALUE of 8000000

Clone the project appropriate for the tool chain you use.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
stephane
Associate II
Posted on February 13, 2014 at 17:04

Hi Clive,

Thanks for your advice. Tried with the good file, but the problem still.

I am using a RF module connected to the UART, I am able to receive data and compare the data send to the received data. The LSB is correct, but not the MSB.

If you have some extra advice...

Regards

Posted on February 13, 2014 at 18:26

I don't really have enough insight into what specifically you are doing, and how.

For MSB issues, I might guess you're using parity. For 8E1 or 8O1 you need to program the USART in 9-bit mode, as the ninth bit is the parity, while for 7E1 or 7O1 you need to program the USART in 8-bit mode.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
stephane
Associate II
Posted on February 14, 2014 at 15:47

No parity for the UART

I tried generating a proper ''system_stm32f4xx.c'' with the excel sheet, but the characters read from the buffer aren't the same as the characters I have send.

I have pointed out something strange with the baudrate: I have to set the UART a different value than the data bitrate.

For example, setting the baudrate @ 115200 give wrong data in the RX buffer.

I changed to 9600, same thing, so I tried with non-standard bitrate and found a working bitrate.

Seems the UART clock isn't well configured.

Posted on February 14, 2014 at 16:07

Sounds like the HSE_VALUE is wrong, is the ratio for the working baud rate 1:3.125 ?

STM32F429I-Discovery_FW_V1.0.1\Projects\Template\stm32f4xx_conf.h

...
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4xx_CONF_H
#define __STM32F4xx_CONF_H
#if defined (HSE_VALUE)
/* Redefine the HSE value; it's equal to 8 MHz on the STM32F429I-DISCO Kit */
#undef HSE_VALUE
#define HSE_VALUE ((uint32_t)8000000)
#endif /* HSE_VALUE */
...

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..