ST 32F4xx debugging and NJTRST mystery - does it do anything? - Page 1
Forum section: electronics / general

author: peter-h
author_rank: Super Contributor
timestamp: May 07, 2021, 03:11:16 pm
content: Currently, on my target I have these two connectors(actually on J9, 3,5,7,9 are all GND)J6 connects to the 20-way big connector on the STLINK V2 / STLINK V3 debuggers. This works. NJTRST isn't connected. I originally did a lot of googling on this and found a vast number of people asking the same question, with no real answersJ9 is the "standard ARM debug" pinout documented by various debugger tool makers e.g. Keil, and is supported by STLINK V3 via its CN1 connector and the 14-way to 10-way cable they provide. This doesn't have NJTRST.I sort of understand this ST world isn't actually JTAG but an ST-special single wire debugging thingy. So maybe this is why NJTRST is not used. But it takes up PB4 which could otherwise be usefulCurrently I have a 10k pullup on PB4, just in caseThe data sheet is silent on PB4 mode. The ref manual describes how it can be used for stuff according to whether Jtag is configured, and it mentions an internal pullup but doesn't say whether this pullup is always present.

author: ataradov
author_rank: Super Contributor
timestamp: May 07, 2021, 04:52:38 pm
content: TRST only resets the TAP controller. It practice it does not do nothing useful, so it is often omitted. SWD is not ST specific, it is ARM standard across all Cortex-Mx cores. All unused programming pins can be used as GPIO.See Table 299. "Flexible SWJ-DP pin assignment" of the reference manual on all possible combinations of debug pins.

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 07, 2021, 05:01:30 pm
content: I've never used this signal myself.

author: peter-h
author_rank: Super Contributor
timestamp: May 10, 2021, 11:27:53 am
content: Thanks All.I had to google on "TAP controller" - it is something related to boundary scan and thus JTAG.Learn something every day... this shows how the four pins come up after reset, and it probably makes sense to have external resistors there which are aligned with this config.

author: newbrain
author_rank: Super Contributor
timestamp: May 10, 2021, 12:05:32 pm
content: Quote from: peter-h on May 07, 2021, 03:11:16 pmThe datasheet specifies PB4 is in NJRST mode after reset, as you show, and the reference manual shows the details: it's in ALT0 mode with pull-up at reset.This can be seen by checking the the reset values for GPIOx_MODER, GPIOx_PUPDR and GPIOx_AFRL).You can program it as any other GPIO, if you are not using it, including the pull-up/down mode (SWD is usually the preferred debug interface, even if the chips by default come up in JTAG mode).

author: harerod
author_rank: Frequent Contributor
timestamp: May 11, 2021, 09:48:42 pm
content: Quote from: newbrain on May 10, 2021, 12:05:32 pmInteresting statement. I am under the impression that when debugging increasing code/data size and complexity, JTAG behaves faster and more reliably. Never mind on an F0, but an F4 is more fun with a fast and steady debugger.

author: ataradov
author_rank: Super Contributor
timestamp: May 11, 2021, 09:55:21 pm
content: For the same clock speed JTAG is slower. It may be a lot slower depending on the way device is accessed.Reliability depends on the signal integrity and with a good connection (short cables, good ground) you will get the same reliability on both interfaces.SWD should always be preferred. I was surprised ST even leaves JTAG enabled for anything but boundary scan.

author: harerod
author_rank: Frequent Contributor
timestamp: May 12, 2021, 05:12:29 pm
content: ataradov, thank you for that input. I am pretty confident in my setups. The JLINK's JTAG has been operating reliably at 12MHz for a long time. For the next big debug session I will give SWD a shot. I have a couple of JLINKs, several STLINKs and an STLINKiso in the lab. We'll see.