Skip to main content
sheng yang
Senior
July 17, 2020
Solved

wrong data receive with uart1 on stm32f103rct6

  • July 17, 2020
  • 5 replies
  • 4965 views

Nowadays. i debug the uart1 under linux with arm-none-eabi- cross compile.

Now i meet a problem,i config uart with 115200 baudrate and 8 databotlen 1 stopbit none parity.use Hsi for SYSCLK APB1 and APB2 CLK BOTH 36MHz. I can receive data from the chip right from the pc console.but when i send some data to the chip.it's mistake .for examplr i input **a** the chip get the value eq **0xa1** always the data is wrong?

I'm curious how could cause the chip tx right but rx wrong?

This topic has been closed for replies.
Best answer by sheng yang

the detial link

https://club.rt-thread.org/ask/question/425122.html

5 replies

Tesla DeLorean
Guru
July 17, 2020

Show code, show wiring, level translators etc.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
S.Ma
Principal
July 18, 2020

do the following: connect TX of MCU to RX of MCU (disconnect PC=>MCU wire), and send data out. Check the receive buffer = transmit buffer

If different, you have MCU side problem. (SW, HW...)

If same, use DMA to receive multiple bytes without interrupts so it's easier to look at incoming data from PC even if SW is breakpoint.

sheng yang
Senior
July 18, 2020

I found the solution after a check the rcc and uart1 relate regs.when i use the hsi clock, i lost calibrate the clock with rcc reg. after i config the reg.it's ok.

sheng yang
Senior
July 18, 2020

I found the solution after a check the rcc and uart1 relate regs.when i use the hsi clock, i lost calibrate the clock with rcc reg. after i config the reg.it's ok.

sheng yang
sheng yangAuthorBest answer
Senior
July 18, 2020