1

I downloaded Stdperiph library and i want to make USART example run on STM32F4 - Discovery. I chose STM32F40_41xxx workplace, added stm32f324x7i.c file and compiled without any errors.

Issue is that I cant receive expected message in my terminal (using Hercules), also when I check RxBuffer it is receiving some bytes but not that I sent.

I checked baudrate, wordlength, parity several times. Do you have any idea what could I do wrong?

USART conf:

USART_InitStructure.USART_BaudRate = 9600;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_2;
USART_InitStructure.USART_Parity = USART_Parity_Odd;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

STM_EVAL_COMInit(COM1, &USART_InitStructure);

Thank you.

V.CHR.
  • 31
  • 1
  • 6
  • Are you _sure_ you should have 2 stop bits? Also, don't bother with flow control unless you really know what you are doing. At 9600, it really isn't an issue (until it is.) That all being said, this question is probably off-topic for [SO]. Maybe research over on one of the EE or embedded Stack Exchange sites? –  Jul 19 '18 at 17:21

1 Answers1

0

First of all if you want to use hihg level abstraction libraries stop using obsolete SPL and start using HAL. Install the Cube. Generate the code - import into your favorite IDE and compile. Should work.

Your code does not show anything as USART clock may be net enabled as well as GPIOs. GPIOs may be configured wrong way. You system and peripheral clock may have wrong frequency. There are many more potential problems.

0___________
  • 60,014
  • 4
  • 34
  • 74