JTag Daisy-Chaining STM32G431 MCU’s

This blog shows how to connect two Nucleo STM32G431 boards in a J-Tag chain and debug using the Segger J-Link EDU. My objective in doing this is to show proof of concept for a product that will have four chained MCU's. The J-Tag in this instance is for board debugging not application code programming. The results were successful though I had a problem using the Keil debugger and resorted to using Ozone with Keil as an external debugger.

Interconnection

First, the onboard ST-Link needs to be disabled. To do this perform the following:

a) Add a jumper to JP1 to hold the ST-Link in reset

b) Change the jumper at JP5 to pins 6-8 on both boards to 5V_CHRG, this allows the G431 to power up with the ST-Link held in reset.

One board will receive power from the CN1 micro-USB connector. To power the other board, we need to wire GND and +3.5V between the two boards. Connect the 3.3V together (CN7 pin 16) and connect the GND together (CN7-8) on the two boards. Refer to the connection diagram below.

By convention, the MCU driving its TDO to the J-Tag TDO is device #0 and considered the 1st device in the chain. The MCU receiving TDI from the J-Tag TDI is the last device in the chain. This is the order in which the J-Tag receives data from the devices.

Note, in the diagram above the connection labeled ‘wire’ are soldered to the board at SB15. The other connections use the female-to-female jumpers.

Next the J-Tag lines need to be chained between the two MCU.

The diagram as drawn implies there are multiple J-Tag devices in each MCU. For example, for the G431 and F302 there are two devices per MCU. Check the reference manual for the J-Tag TAP configuration for your device.

The pins of interest for the STM32L431RB are on CN4:

CN7 has pins and I used female-female jumpers to make the connections (such as Adafruit)

Remove solder jumper SB15 to isolate TDO on the last device (MCU #1). I would verify this by a voltmeter check across SB15. Now connect a wire from the MCU #1 TDO pin to TDI on MCU #0 (CN7-17). Next, to connect MCU #0 TDO to the TDO J-Tag, add a wire from the opposite side of SB15 on MCU #1 to CN10-31 (or CN6-10) on MCO #0.

Make the three parallel connections between MCUs (TMS CN7-13), TCK (CN7-15) and T_NRST CN7-14).

Recommended Default voltage levels on the J-Tag target

These are the target default voltage with the debug adapter not plugged in. Custom boards should use the recommended pull-ups / pull-downs to set the states.

Power Up

Connect the ST-Link to either Nucleo board then plug the USB into the computer. This supplies power to both Nucleo boards with the ST-Link held in reset. LD3 should be green and if a 'blinky' code is running, LD2 should be blinking.

Now plug the J-LINK into CN4 on MCU #1 (last device) and connect the USB to the computer.

In Keil µVision select Project->Options for target->Debug->Settings.

The J-Tag Device chain should show a list of devices with device #0 being the top of the list and the last device at the bottom of the list. For each device it also shows the IDCODE of the device and the length of the device Instruction Register (IR). There will be “unidentified” devices that cannot not be accessed. These need to be in the list so the J-Tag knows the IR length to shift.

This is the screen shot of the J-link device:

There are two ARM CoreSight JTAG DP with ID code 0x4BA0047 and IR 4. There are also two Unknown JTAG Devices with ID 0x16468041 and IR 5. Use the slider bars (up/down, left/right) to see the whole window. The selected device has the ‘x’ next to the ID code.

Here is a screen shot of the µVision window during connection. The four devices are seen listed.

At this point we should be able to select the device we want to debug. Using JLink.exe as a command line debugger I was able to select ‘connect’ followed by ‘Device’ STM32G431RB and ‘JTAG’ and set JTAGConf as 9,2. This is the 3rd device in the chain. Doing this I could issue ‘h’ to halt the MCU and ‘g’ to run. By setting JTAGConf to 0,0 then running connect again I was able to access the 1st device and halt and run its core.

Unfinished Issue

At this point my only open issue is that running Keil µVision 5.30 and connecting to the JTag daisy chain with the Segger JLink EDU I can see the four devices but have not been able to access device #3. Whatever I do I seem to only access device #1.

My resolution of this problem was to use Ozone (from Segger) as my debugger. I can edit and compile in Keil µVision then within Ozone load the *.axf file and debug in a source code window on Ozone

Conclusion

This article shows that multiple STN32G431 can be chained on a J-Tag link using a Segger J-link EDU using JLink.  Note the EDU version is the same as the Basic version but must only be used for non-commercial projects.

It would have made this project easier if the Nucleo board used a 2-pin jumper instead of the solder bridge at SB15. With the 2-pin jumper removed we could have simply used the female-to-female jumpers to connect the boards. Also, a note from ST on exactly what SB15 isolates would have made viewing the Gerber files an unneeded task. All in all, the STM32G431 Nucleo board is a powerful and inexpensive for the hobbyist or professional wanting to prototype an idea and multiple boards can be chained. More recent information from Segger says up to 32 devices can be chained with a maximum of IR length of 255 and a maximum DR length of 64. Chaining four STM32G431 MCU’s would be 8 devices with a total IR length of 18 and a maximum DR length of 14.

 

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top