I have restarted VS code, updated platformio, reinstalled platformio, created a new project which is spaces free. None of these made a difference yet, but I have yet to uninstall virus protection/disable defender.
The custom debug tools almost work. It was able to flash the teensy once but then VS Code jumped to a random arduino lib and the arduino became unstable to where I couldn’t do anything and had to reflash it with JFlash. Not sure if that is a different issue or what.
I appreciate all the help… I’m still trying everything I can.
Well the base error is that PlatformIO doesn’t seem to be able to execute any commands from inside VSCode to the Jlink tools.
When I do “Start Debugging” in VSCode with the above platformio.ini, I do get the JLink output, telling me it failed to start (since no JLink is connected of course)
Please file a bug in Issues · platformio/platform-teensy · GitHub with reference to this thread, I have no idea why this hangs up. The standard platformio.ini from the first post should work.
As an extravangza test one could install VirtualBox + Ubuntu 20 + Guest extensions and test whether it works in that virtual machine, when the USB device is forwarded. But as said, the invocations work for me on my Windows 10 x64 system without problems.
with an upload.jlink file at the root of the project:
r
loadfile .pio\build\teensy41\firmware.hex
r
q
Thanks for helping @maxgerhardt
I’m still not sure what the underlying issue is, I doubt I will look into it much further but if a dev is interested I can work with them to figure it out.
How hard was the mod need to get this working, do you have pictures? I’ve put this off as I did not find any great guides as to the how to do it! hint hint
I have not seen anyone else do it with a Teensy 4/4.1 yet. The Teensy 3s are a bit easier to mod since they had debug pads on the board, but you still needed to remove the same chip. It requires good soldering skills, hot air station, microscope, magnet wire, etc. I am still in the early stages of the modification so it is a mess. I am waiting on a pcb to be made which should make this presentable.
Here are some pics.
The mod requires removing the MKL02Z32VFG4 to access the JTAG pads, connecting those to a J-Link, and reconnecting the chip to the other (non JTAG) pads to keep everything happy… And yes… that is the MKL02Z32VFG4 floating off to the right.
@datkins47 Let me know if you need guidance, if you decide to take it on.
credit due there, just wow! might wait before tackling that, love the teensy 4.1 with ethernet but not sure that’s ready for my solder blobbing skills, you thinking pcb to replace chip?
I designed a flex pcb that will be soldered in place of the chip and extrude out the right side of the board and breakout the pins so they can be jumpered over to the J-Link. It will involve de soldering the M0 chip, soldering the m0 to the flex pcb, and soldering the flex pcb back in place of the M0 on the Teensy. Then you have normal 2.54mm headers to jumper from.
I left the chip in the equation because it is handling a few things besides just programming, without it I believe the processor never starts up a DCDC converter. Also this way you can jumper the pins back to the chip and use it as normal.
Thanks for that great guide and all the information regarding the debugging.
I was able to set my teensy 4.1 up for the JLink connection.
With the platform.ini above, I was able to upload via JTAG and start the debugger, but the debugger kept jumping through the code in (at least for me) uncomprehensive steps.
As far as I understand, this is probably to some compiler optimization that does not work with the debugger. As this may be relevant to someone else trying this, here’s the platformio.ini that worked for me:
I changed the debug_protocol back to jlink, but overrode some of its parameters, which I guess left the rest of the compiler’s parameters untouched. Adding debug_build_flags = -O0 -ggdb3 -g3 did not work for me, but this did.
I used the upload.jlink file described here.
Thanks again for this thread, really glad I found it, if I had been successful at all, it would have taken a lot longer without it!
A few hints for you that might help you to solve this issue:
Make your config portable using Interpolation of Values. Replace hardcoded $PROJECT_PACKAGES_DIR and C:\Users\\\rovedo\\.platformio\packages values by ${platformio.packages_dir}/tool-jlink/JLink.exe
thanks a lot for your reply, I edited the script to incorporate your suggestion.
I think I didn’t make myself very clear reading over my text again:
The configuation I posted, which is slightly different to the one sp33 posted a while ago,
works perfectly for me (on multiple machines as well). Compiling, uploading and debugging are all running as expected.
I just wanted to post the ini in case someone else was struggling with debugging using the file originally suggested.
I am keen to give this a try, and have smd flex pcb tooling and experience. If it works I’d be happy to fab extras for the community. Might you be willing to share the schematic and layout or other advice? thanks very much!
I am willing to share what I have, it’s just not organized at the moment. Since posting this I have made multiple versions trying to come up with the best solution possible. Here are some pics of my progress.
Main issues I had were pads lifting when trying to accomplish a through hole style soldering method. Once I Switched to using hot air without through holes, lining it up was the hardest part. Let me know which one you are interested in trying out, I have some KiCad files they just are not versioned very well unfortunately.
Hi @sp33 , I’m very interested in what you might be able to share. Really… no matter the condition. I have a huge need to use debug facilities of the chip. I am willing to pay for that capability too. Any help you could provide please let us know.
Note that there’s also a chip that is “close” to the Teensy (NXP iMX.RT1062) and has an evaluation kit for $110: MIMXRT1060-EVKB. Not sure if you can just flash a Teensy + Arduino firmware on it without modifications, but they should be relatively close so that adaptation is minimal and you have can have a debugger on that thing.