cancel
Showing results for 
Search instead for 
Did you mean: 

wrong data receive with uart1 on stm32f103rct6

sheng yang
Senior

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?

1 ACCEPTED SOLUTION

Accepted Solutions
5 REPLIES 5

Show code, show wiring, level translators etc.

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

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

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

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