Skip to main content
Graduate II
April 23, 2024
Solved

Debug Connection Lost if NJTRST Set to Output

  • April 23, 2024
  • 2 replies
  • 1787 views

Developing on an STM32H563ZI chip with Cube IDE and ST-Link V2.  DEBUG is configured as JTAG with Trace Syncro (4 bits), which is 4-wire JTAG (JTMS, JTCK, JTDI, and JTDO).  

My project has allocated pin PB4(NJTRST) as a GPIO.  If left unconfigured, debugging is possible.  If configured as an output, the debugger loses its connection to the core with the execution of the line of code that configures the pin as an output.

Why does this happen, when I'm using 4-wire JTAG?  The NJTRST line doesn't even go to the JTAG header, so it's not like the ST-Link is "secretly" using that wire.

Is there maybe some option bit I need to set to make the chip happy in debug mode with NJTRST configured as a general-purpose output?

 

    This topic has been closed for replies.
    Best answer by Pavel A.

    Can you use SWD mode?

     

    2 replies

    Pavel A.Answer
    Super User
    April 23, 2024

    Can you use SWD mode?

     

    Brian HAuthor
    Graduate II
    May 1, 2024

    Hi Pavel,

    It looks like I can debug normally in SWD mode; I hadn't thought to try that before.

    I'd still like to understand why having NJTRST set as an output, when it's not assigned to JTAG, causes JTAG debugging to fail.

    Thanks!

    Graduate II
    May 1, 2024

    This is a long standing errata: Even on U5 in es0499 you find

    2.2.20: Full JTAG configuration without NJTRST pin cannot be used

    Brian HAuthor
    Graduate II
    May 1, 2024

    Interesting...one might think that CubeMX, with all its wealth of device-specific knowledge, would know that and not let a developer choose that option.  But one might also think that a developer should read the errata, which I obviously failed to do here. :grinning_face_with_sweat:

    Thanks!