cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] UART problem not working (STM32NUCLEOL476RG)

HHair.1
Associate II

Dear All,

This is the first time that I make a question on a forum. I am an engineering student with any experience with this kind of boards/community, but I hope I can explain it as well as possible :) . ​

​Now I am working on making a serial connection between an STM32L476RG and a peripheral.

The STM board is connected by an USB, and the UART pins are connected directly from the board to the sensor. The pins are RX to TX and TX yo RX between both elements.

The problem is that when I connected them, I saw with the RealTerm that the info was being sended, but any response​ came from the sensor. When I analysed with the oscilloscope, any signal was being sent. It is on a permanent high state

I am a little confused. The sensors are new and it seemed that they were working​, and the cables are well connected. The information was appearing on the program perfectly, and I do not know if It can be any configuration as jumpers or this kind of things.

I simplified the code as simple as I can (generate code by STMCubeIDE and Hal transmit with some random data), but same problem: It appeared on real term, but any signal was on the​ board.

It looks like this data was being sended to the computer but not the uart, maybe (?), but I configure the pins on the configuration as the uart ones and I used that ones.

I tried with both usart2 and uart4.

Any informatiom/idea​ is welcome,

Thanks!

Xavier​

1 ACCEPTED SOLUTION

Accepted Solutions

Hi!

Finally, I could solve the problem. I was using the USART2, but with the UART4 it was working well​. I think that the USART2 was configured to send the information to the computer, even I configuré the ports. It explains that It only appeared on the computer.

Thx!

X​

View solution in original post

3 REPLIES 3
S.Ma
Principal

You can use exti on tx rx pin to manually debug using thr hw register window to check if edges are detected in the mcu ffom the sdnsor. Maybe rx tx swapped?

HHair.1
Associate II

Hi . ,

Thanks for the reply!

​I will try to see what you say about the registers as soon as I can.

I have seen cables and they are not swapped.

I analysed with oscilloscope both cables too and I do not see any signal from any of them. It must be connected to a sensor to see the signal ? May I need to make a previous configuration, as jumpers or something like that, to connect with a peripheral, but no with the computer ? It is the first time I use this board.

Hi!

Finally, I could solve the problem. I was using the USART2, but with the UART4 it was working well​. I think that the USART2 was configured to send the information to the computer, even I configuré the ports. It explains that It only appeared on the computer.

Thx!

X​