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

The possible relationship to debugging is through the JTAG reset pin (NJTRST , PB4).

JW

Nabekaite
Associate II

New information: logic analyzer connectet to SWD, USART Rx, nRST and NJTRST pins show me some interesting. I have short pulses on nRST pin of MCU. To this pin connected only pullup resistor 100k to 3.3 V.

If i connect to MCU by ST-Link Utility this pulses is gone. But when try to load FW from Keil pulses not gone and load fails. 0693W00000BbN4nQAF.pngPulse period 515 ms, duration ~31 uS.

Why this pulses is generating, how it turn off and how to upload FW from Keil?

NRST is a bidirectional pin, if the debugger decides to perform a software reset, you'll see a pulse on it.

JW

Nabekaite
Associate II

Look at the right part of diagram - there are pulses even without data on the SWD. This is not a debugger job. There is no NRST conneted to debugger, only SWCLK and SWDIO.

Maybe watchdog? Do you employ watchdog in your program, or do you have WWDG_SW active (i.e. 0) in option bytes?

Rx is PA10? What happens if you pull NJTRST pin up hard enough to overcome the CC Rd pulldown, e.g. using a 1kOhm pullup?

JW

Nabekaite
Associate II

"Do you employ watchdog in your program" - FLASH erased

"WWDG_SW active (i.e. 0) in option bytes" - to the best of my memory WWDG_SW set to 1 (factory value).

"Rx is PA10" - Yes.

"What happens..." - try this in moday. Device at work.

I had a stupid idea that these pulses are created by the MCU itself, reading all the empty memory sequentially. FF in memory, perceiving as a command NOP. After the end of memory, reset and everything from the beginning.

Empty FLASH should end up in bootloader, see AN2606.

JW

TDK
Guru

The pulses on JRST are correlated with RX. Probably just noise being transferred. An analog capture would likely confirm.

> I have short pulses on nRST pin of MCU. To this pin connected only pullup resistor 100k to 3.3 V.

You should have a 0.1uF cap on NRST to avoid parasitic resets. Probably not the issue, but could be.

If you feel a post has answered your question, please click "Accept as Solution".
Nabekaite
Associate II

"An analog capture would likely confirm." -

0693W00000BbUynQAF.png0693W00000BbUzqQAF.png 

Unsolder relay circuit (R43), add 1k pull up to JRST + 1.0 uF to nRST. Try 0.1 uF but only nRST pulse width change.

0693W00000BbV26QAF.png 

RST impulses are still in place but wider)

Code downloading and debugging from Keil not possible.

At this point, I'm out of ideas.

If connection with STLink-Utility works, and with Keil doesn't, then this may be some Keil-specific issue.

JW