cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G473 can't start debugging with incoming data stream on USART1 Rx pin

Nabekaite
Associate II

On my board i use USART1 and USART3 to connect my device to other by dual RS-485. 485 tranciever connected to MCU throw digital isolator (4 tx, 2 rx SI8662). If 485 line of USART1 not connected ti device i can start debugging in Keil without problem. If i connect 485 line debug session immediately fail. If i connect line before debuging then i can't enter debug. Even ST-Link Utility can't connet to MCU with connected 485 line. I can load programm to MCU, connect 485 line an device will work fine by self. With 485 of USART3 no eny problem.

There is no galvanic connection between MCU and 485 tranciever, no ground connected. Power of both part of device is fine, no any noise.

Boot0 on MCU connected to GND. I use ST-Link v2 and SWD-connection.

Why debugging not work with incoming data stream on USART1?0693W00000BbGiqQAF.png

28 REPLIES 28
Nabekaite
Associate II

With STLink-Utility not all is ideal. 

When i try download FW from Keil end got error, then i checked FLASH by STLink-Utility and see that some FLASH was flashed. After that i can't erase chip because " Error occured during flash mass erase!"

Paul1
Lead

Just guessing...

  • Rx Interrupt handling preventing getting to debug code when excessive Rx? Put breakpoint before enable Rx Interrupt,
  • Floating pin picking up nearby signal? Ensure all unused pins have Pullup/pulldown, or are set as disconnected (option in MX). Maybe an input that has nothing connected at the moment?
  • Sufficient MCU Capacitance on power pins? (Power Dropouts)
  • Appropriate Decoupling caps on all power pin pairs? (Else noise or power dropouts)

Maybe you should try this on a "known good" hardware i.e. a Nucleo board.

JW

Nabekaite
Associate II
  1. I can't enter debug. I can't load full FW, only some little part.
  2. All unused pins set as disconnected (CubeMX default state)
  3. Every Vcc pin have 0.1 uF cap. Oscilloscope show no glithes on 3.3 V rail.

Noise in power rail can be cause of periodical nRST pulses?

TDK
Guru

I'm having a hard time believing the two plots are from the same data. One shows a perfect correspondence between RX and JRST. The other shows only occasional spikes on JRST.

0693W00000BbZVrQAN.png

If you feel a post has answered your question, please click "Accept as Solution".
Paul1
Lead

*You can't load full FW, or small FW.

a) Maybe a poor STLink connection, maybe the STLink ribbon cable is pulled apart?

Test the STLink and ribbon cable on a different PCB.

b) Maybe a bad Power supply connection on 3V3 or Gnd.

c) Like JW suggests, try it all on a known good board.

d) Start with a clean project. New MX File. Minimal features. Test.

Then slowly add code&features till stops working.

That may narrow down where bug actually is.

e) Check connection of any BOOT or BOOT0 pins

Look at the voltage level of blue plot. i think logic analyzer can't catch too small amplitude correct. I can pull up JRST pin and shift avg voltage level, if it can help.

a) On other PCB this ST-Link and cable works great. I try another ST-Link on my PCB and there is no difference. My colleagues faced the same problem on similar boards (3 identical boards were made).

b) Checked this several times.

c) we have troubles only with STM32G473 boards but not with all. One device with same MCU works great.

d) Try this, nothing change

e) Checked this. Even try use Flash Loader but MCU did not answer on USART1 Tx (oscolloscope show only constant level).

Nabekaite
Associate II

"WWDG_SW active (i.e. 0) in option bytes" - you was too close. IWDG_SW bit make me feel pain in ***.

After checking this bit in ST-Link Utility reset pulses gone.

Now we start testing debug with RS-485 line.