cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4+ USART RX+Interrupt Not working

ControlFreak
Associate III

Hello,

I am trying to configure USART1 on Nucleo-32 board using HAL. Code is suppose to first it receive the message and then it transmits the same message.

My problem is RDR is showing reading garbage value. Can someone point out was is wrong?

(Please ignore my indentation of code- this is just my test run)

15 REPLIES 15
ControlFreak
Associate III

0690X000006CDqeQAG.png

T J
Lead

this code is blocking code,

I hope you clear that flag in the loop now...

It wont work without it.

Can you stop the processor and look in the tables ?

T J
Lead

this code is blocking code,

I hope you clear that flag in the loop now...

It wont work without it.

Can you stop the processor and look in the tables ?

ControlFreak
Associate III

if you mean by clearing rx_cplt flag, printscreen is after I have cleared flag in main loop. As I have mentioned it earlier, that even if I debug my code my RDR show 0c0,0xf8 etc.

T J
Lead

the RDR only has 16bits, and only 8 bits of that is used for Char transfers. ( 1 byte only)

don't look at the RDR you must look in the receiving buffer.

otherwise, try to use the DMA functionality, it works very well.

ControlFreak
Associate III

Sorry for late updates. I have solved this issue. There was couple of problems

1) connection between Trans receiver and Computer were wrong

2) the was more then 3% error in my baud rate

4) as pointed by BobS, timing issue

Special thanks to Bob S and T J for prompt reply.