Skip to main content
sheng yang
Senior
Jul 17, 2020 11:09 PM UTC
Solved

wrong data receive with uart1 on stm32f103rct6

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.
sheng yang
sheng yangBest answer
Senior
Jul 18, 2020 12:04 PM UTC

5 replies

Tesla DeLorean
Guru
Jul 17, 2020 11:18 PM UTC

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
Jul 18, 2020 9:14 AM UTC

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
Jul 18, 2020 12:01 PM UTC

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
Jul 18, 2020 12:01 PM UTC

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
Jul 18, 2020 12:04 PM UTC