SWD with Teensy MicroMod?

jerryk

Well-known member
Hello!

Yesterday, I received a "Segger Jlink Edu Mini" debug probe. This is supposed to be compatible with all 3.3V ARM Cortex processors. It supports JTAG and SWD protocols. Or so they say...

Has anybody got SWD debugging working with the Teensy micromod?

When I try the connect command in the jlink software, it says:
-------------- snip -----------------
Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. <Default>: MIMXRT1062XXX6B
Type '?' for selection dialog
Device>
Please specify target interface:
J) JTAG (Default)
S) SWD
T) cJTAG
TIF>S
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>
Device "MIMXRT1062XXX6B" selected.


Connecting to target via SWD
InitTarget() start
InitTarget() end - Took 102ms
Failed to attach to CPU. Trying connect under reset.
InitTarget() start
InitTarget() end - Took 107ms
Error occurred: Could not connect to the target device.
For troubleshooting steps visit: https://kb.segger.com/J-Link_Troubleshooting
---------------------- endsnip ----------------------

I know that the micromod teensy still has the boot processor... could there be something I have to do to disable it?
 
@jerryk: I think this was already answered in your <other thread>. On all Teensy 4 varieties (T4.0, T4.1, T4MM), the JTAG interface of the IMXRT1062 is connected to the PJRC bootloader chip, so no external JTAG SWD is possible for any T4x processor board.

Remember that the micromod connector spec supports multiple processor families and/or processor types, so presence of the JTAG pins on the connector does not really ensure that JTAG SWD is available for all MM boards (just like a true RESET is not available for the T4MM boards).

Sorry for the disappointing news . . .

Mark J Culross
KD5RXT
 
You are so right! The two signals - SWDIO and SWDCK - are NOT CONNECTED at the Teensy. Geez, they could have mentioned that in the ad copy. That's a hundred fifty bucks down the drain. The artwork on the board is really small - probably beyond my ability to do "little green wires" mods.
 
Even if you solder tiny wires, SWDIO / SWCLK can not work. Teensy 4 uses JTAG, not SWD.

JTAG debug can theoretically work if you desolder the MKL02 chip (so it's not driving the JTAG pins) and then connect TDI, TDO, TCK, TMS, and make sure the JTAG_MOD signal is selecting ARM JTAG. If you neglect connecting JTAG_MOD, you'll end of with JTAG boundary scan rather than ARM debug JTAG.

Of course if you have the lockable version of Teensy, this is only possible while still in the original unlocked state. Once you lock the hardware into secure mode, JTAG debug is disabled.
 
Paul - if you are planning a Teensy 5... PLEASE bring it to us with debug. I'm begging you here :).
I think this is on a lot of peoples wish lists. Debugging using printf and IO pin toggling is fine for smaller projects but once you hit a certain level of complexity you need real debug access. With a part as powerful as the teensy that lack of debug is a big downside, it means that it's great for doing simple things quickly but not so good for doing complicated things.
 
For large projects I use Visual studio, writing to a "Phantom Teensy i.e. simulating the Teensy bits I am interfacing". That way I can single step where necessary and find the problems in my code.

I even use it with Nextion code, which is extremely difficult to debug..no serial.print.
Like the Teensy I simulate the Nextion in Visual Studio. Things (development) go a lot faster then (tnan on Nextion).
 
For large projects I use Visual studio

@BriComp, if you ever have time, it would help so much if you would put together a set of step-by-step instructions for installing Visual Studio and whatever other components are required. I've tried a couple of times and I just don't understand what pieces you are using, how you put them together, and how the environment relates to the standalone Arduino IDE. I would be happy to be the guinea pig to try it again.
 
@BriComp, if you ever have time, it would help so much if you would put together a set of step-by-step instructions for installing Visual Studio and whatever other components are required. I've tried a couple of times and I just don't understand what pieces you are using, how you put them together, and how the environment relates to the standalone Arduino IDE. I would be happy to be the guinea pig to try it again.
Ok, I will try and put something together. It might take a little while, I will have to set up a target system first.
 
I think this is on a lot of peoples wish lists. Debugging using printf and IO pin toggling is fine for smaller projects but once you hit a certain level of complexity you need real debug access. With a part as powerful as the teensy that lack of debug is a big downside, it means that it's great for doing simple things quickly but not so good for doing complicated things.
I just found a good deal on an NXP evaluation board. Hopefully it has enough I/O so I can use it to debug
my Teensy programs before moving them to the Teensy.
 
Ok, I will try and put something together. It might take a little while, I will have to set up a target system first.
Here goes the First Chapter, just dealing with installation.
Download Visual Studio Community [VS](free) from here.
Install the program..during installation the following screen will appear. I have selected all the items that I require but as a minimum you MUST select the two items circled….
VS Install-Select Components.png

…and press install (in the bottom right)—not shown above.

On first running VS the option to sign in to a Microsoft Account (or not) is presented…

VS Install-Sign in or not.png



I chose NOT TO.

Select your settings….
Select Settings.png

..I chose to stay with General Development Settings and Light theme.

When you start VS you will be presented with the form below….
VS Start Up.png

…. Select Continue without code.



You will now be presented with the following screen…
VS first start.png

Not a very helpful screen!

Select Extensions, then Manage Extensions.

VS Manage Extensions.png

Select to install Arduino IDE for Visual Studio 2022+
VS Install VS Micro.png

Now restart VS.…. Nothing will happen until you Exit VS. Exit VS to install Arduino IDE Visual Micro.

If you are not running in Administrator mode (as you should be) you will be prompted to enter an Administrator password.

A screen will then appear prompting to Modify or Cancel…select Modify.

As an aside, I should say that I use Arduino vs 1.8.19 and have my code under development at

C:\Arduino Programs (with a space) as shown below/overleaf…
VS Arduino Programs.png

Upon restarting VS you will see the screen below…
VS VM sub menu.png

…with the vMicro sub menu. You will also see Copilot Chat which I ALWAYS close.

That's Visual Studio and Visual Micro installed.
Chapter 2 to follow.
 

Attachments

  • VS first start.png
    VS first start.png
    93.2 KB · Views: 22
Back
Top