2021-06-17 06:31 AM
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?
2021-06-18 02:16 AM
The possible relationship to debugging is through the JTAG reset pin (NJTRST , PB4).
JW
2021-06-18 05:09 AM
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. Pulse period 515 ms, duration ~31 uS.
Why this pulses is generating, how it turn off and how to upload FW from Keil?
2021-06-18 06:29 AM
NRST is a bidirectional pin, if the debugger decides to perform a software reset, you'll see a pulse on it.
JW
2021-06-19 12:03 AM
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.
2021-06-19 12:56 AM
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
2021-06-19 01:12 AM
"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.
2021-06-19 01:19 AM
Empty FLASH should end up in bootloader, see AN2606.
JW
2021-06-19 07:21 AM
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.
2021-06-20 11:47 PM
"An analog capture would likely confirm." -
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.
RST impulses are still in place but wider)
Code downloading and debugging from Keil not possible.
2021-06-21 03:07 AM
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