Debugger Depression

brianmichalk

Active member
This is not a rant, and I hope that Paul will consider one developer's perspective.

I've bought maybe 75 Teensy3.2's from Oshpark, and use them to control my machines. I like the Teensy because the voltage tolerance, footprint flexibility, and compatibility with the Arduino libraries. However, the one major problem that I keep searching an answer for is the lack of a debugger. No, modifying the board is not an option.

Up to this point, I've used it for my own products, but I'm now getting work from another company that is also using the Teensy, and I am having a very difficult time working through the system without a debugger. Their system uses four Teensies in one machine. They are early enough in the development cycle that switching to a different Platformio supported chip won't be too difficult.

If Paul is like me, he's spending days and nights on his business. It's difficult deciding how to apply limited resources. This post is more informational than anything else. Instead of just disappearing, I thought it would be better to at least make my reasons known.
 
This is not a rant, and I hope that Paul will consider one developer's perspective.

I've bought maybe 75 Teensy3.2's from Oshpark, and use them to control my machines. I like the Teensy because the voltage tolerance, footprint flexibility, and compatibility with the Arduino libraries. However, the one major problem that I keep searching an answer for is the lack of a debugger. No, modifying the board is not an option.

Up to this point, I've used it for my own products, but I'm now getting work from another company that is also using the Teensy, and I am having a very difficult time working through the system without a debugger. Their system uses four Teensies in one machine. They are early enough in the development cycle that switching to a different Platformio supported chip won't be too difficult.

If Paul is like me, he's spending days and nights on his business. It's difficult deciding how to apply limited resources. This post is more informational than anything else. Instead of just disappearing, I thought it would be better to at least make my reasons known.

is there a debugging option for normal arduino boards ?
 
is there a debugging option for normal arduino boards ?

There is for at least some of them. I used to use a hardware debugger with some of the older AVR boards, using an ICE (search for AVR JTAG ICE)

Which connects up to the programmer connector of the boards and allowed you to do some source level debugging. Also was able to do some of this with some of the STM boards as well.

Been awhile since I played around with this.

I believe there are software options for debugging as well. Example Microsoft Studio:
https://devblogs.microsoft.com/iotdev/debug-your-arduino-code-with-visual-studio-code/

I believe VisualGDB also supports some Arduino boards: https://visualgdb.com/
 
I'm using a Segger JTag Edu and just ordered a JTag-Mini (for ~$20). This works great for Teensy debugging especially with vscode which has a supporting extension (Cortex-Debug) . However, you currently need to manipulate the board - which is not an option for the OP but might be OK for others.

Adapting a T3.6 / T3.5 is surprisingly simple and can be done in a few minutes if you have some soldering experience. https://hackaday.com/2017/05/01/adding-a-debugger-to-a-teensy-3-53-6/
 
um for some reason i just felt like saying that the debugger is really easy to use... and it was a great way of implementing it so it doesnt always get in the way..... Great job guys i would have never thought of making it another executable

;-)
 
A major contributing factor in choosing a T4.1 for my current project is that I remember seeing a photograph of the DC, DD and DE pins on the back of the board. Curse my imperfect memory! That was a T3.6 I was remembering, and those pins are gone on T4.x. I've spent a couple of hours looking around, but from what I can see hardware debug just isn't possible on the T4.x. I'd love to be corrected...
 
SWO debugging is disabled in Teensy 4.x by internal fuses in the MCU that can't be reversed. The JTAG pins go to the on board MKLO2 MPU which apparently uses JTAG Boundry Scan to implement the Teensy bootloader and other manufacturing/test procedures on the 4.x parts as well as handling various reset/boot details for the MCU. There isn't much if any info available about this and PJRC aren't disclosing much, probably because it's proprietary to their business, can't really blame them for that though. I think JTAG debugging would be possible but would require removing the MKLO2 part to get access to the JTAG pins and bring them out, and the MKL02 part is teensy just like the rest of Teensy. So it would IMHO be very difficult to do this plus it would also require handling the reset/boot stuff the MKL02 part handles now. Still thinking about this.... Meanwhile since the Teensy 4.x boards are such a nice platform I'm considering purchasing the NXP EVK board for the IMXRT1062 which has lots of debug options. The idea is to use the EVK board for software development/debug then port projects to Teensy. I've used the NXP MCUExpresso IDE to build some of the 100's of examples for the EVK that come with the IDE and they run on Teensy 4.x ok with a little tweeking, but the IDE is a complex tool and has a steep learning curve by itself, even if you're familiar with Eclipse based tools. Another gotcha is that the NXP EVK board costs about $120 so its not cheap, but it is full featured with lots of peripherals and stuff, so its probably worth it. One of the reasons the IDE is so complex is that it now includes a full featured set of config tools for their parts with very nice GUI interfaces so there is no wading through hundreds of #defines to figure it out. But it still requires that you be familiar with the technical reference manual for the part which ain't easy either, as the IMXRT1062 is a very sophisticated MCU. Translating between Teensyduino speak and NXP speak is challenging to. So, it might be easier (depending on your proclivities) to just byte (pun intended) the bullet and learn Teensyduino and debug with printf and GPIO pin toggling. PJRC has certainly put together an amazing tool for their very cool boards, hats off to them!
 
Thanks for your detailed response, John.

Adding PSRAM was nerve-wracking enough for my tastes. I'll leave the MLK02 where it belongs. Much as I'd love to play with it, I can't justify buying a devkit for this little hobby project. SerialDebug looks like it will suffice for my needs.
 
No need for a different IDE. When I really needed debugging, I compiled code in the teensy IDE and then ran it on an EVK board. It needed only a one line change to account for a crystal difference. But haven't tried this with Teensy 4.x.
 
Thanks for your detailed response, John.

Adding PSRAM was nerve-wracking enough for my tastes. I'll leave the MLK02 where it belongs. Much as I'd love to play with it, I can't justify buying a devkit for this little hobby project. SerialDebug looks like it will suffice for my needs.

Wise choice, Teensy4.x and Teensyduino make a great combination, Teensy 4.x is several orders of magnitude better than the old AVR based Arduino boards so the're a great way to go and not too expensive. However the MCUXpresso IDE is also an amazing platform, one of the best Eclipse based platforms I've ever used, even better than Xilinx's Vitis IDE which is pretty good. I broke down and bought the NXP EVK1060 board and have played around with it a bit, learning about the IMXRT1062 and the MCUXpresso IDE, it's a steep learning curve, but I typically do 5 - 10 embedded projects a year so I figured that the investment in tools for Teensy4.x was worth it over the long haul, plus I like learning new things. Plus, almost all my projects run on FreeRtos and the MCUXpresso debugger is FreeRtos aware, and I think a good debugger is essential for multi-threaded projects. Every program I've written in MCUXpresso worked on my Teensy4.1 but, admittedly they've been simple projects. The NXP documentation for the MCUXxpresso is excellent, the NXP documentation for some of the SDK library APIs are not so good or non-existent. There is a lot of NXP documentation and tutorials out there but some of it is hard to find. Good luck on your projects.
 
Back
Top