Teensy 4.1 w/ Zephyr, VSCode, and PlatformIO HOWTO?

impcc

Active member
Hi all,

I have been trying for multiple days now to get up and running with VSCode, Zephyr, and my recently delivered Teensy 4.1, but I've not been able to even get to "Hello, World!" Does anyone have any recommended links for getting up and running with this combo? I've got 20+ years of software engineering experience (with a lot of embedded stuff in there, including Teensy 3.0), but just nothing I try seems to work. Has anyone spelled this out step-by-step? I've found pages that say that PlatformIO doesn't support Zephyr, but their own docs say they do. Is this hopeless? Anyone doing this?

Edit to add: I did solder on the USB Host pins before booting it for the first time, since that's a primary feature for me. I don't think anything went awry, and this ain't my first rodeo, but...

Thanks,
Ian
 
Lots of people on here use PlatformIO, but I've never seen a step-by-step procedure or how-to guide for using it. I had not heard of Zephyr, but I looked at their site, and they build with Cmake/Ninja. Have you tried that?

I did find the thread below, which seems to imply that the OP has Zephyr up and running on a T4. If you get it to work, it would be great if you would write up how you did it.

 
The PlatformIO Zephyr support supposedly wraps/hides the whole Cmake/Ninja part of it from you (which, frankly, having suffered in the Cmake/Ninja mines before, is pretty much a pre-requisite to me.)

The conclusion I'm coming to is that Zephyr is still a pretty niche stack, and that I should probably just prototype using the Arduino stack and determine later if I actually need the RTOS stack. Part of my snarky comment above is that I would rather spend time getting stuff done than fighting with a complex build system. There have been weeks and weeks of my professional life spent fighting with Cmake that I can never get back, so the prospect of spending more time trying to figure this out for a hobby project isn't exactly appealing.

If I happen to get it working at some point, I'll report back.
 
So, I think I found at least part of the problem: The microUSB jack on my Teensy appears to be flaky. I have to kinda wiggle it around just so to get it to power up at all. I guess I'll look into that next.

Edit: Well I'll be! I tried a different cable and it worked much more reliably. It's weird because the original cable I was using has worked great for other applications for years.
 
Last edited:
So, I switched to using the Arduino stack on PlatformIO, and I can't say it's been a breeze, but at least I got it to work. The Arduino IDE is such hot garbage that I'll deal with PlatformIO's difficulties, but man oh man could this have been easier.
 
Lots of people have had problems with bad cables, as opposed to the connector on Teensy.
OK, I ordered another Teensy 4.1 recently and I have to wiggle the cable on it, even using the cable that was "good" for the other Teensy 4.1 I bought previously.

I hate to be a negative Nelly, but this, by empirical process of elimination, indicates that there is a systemic problem with the USB Micro-B jacks on Teensy boards, or at least the 3 Teensy boards I have (2x 4.1, and a 3.-something-or-other). I have tried half a dozen cables from different vendors, and none of them work without 'wiggling', and on the latest 4.1, only one cable works even with wiggling, and fails intermittently unless taped in place to put tension on the cable.

I don't really understand what's going on here. I have a dozen different other USB Micro-B peripherals, and they all work fine with all these cables, with no wiggling, so it seems there is a problem here that is less the cable and more the device.

What do folks conclude is the underlying problem here? How do you work around it?

Ian
 
I have probably built somewhere on the order of 30-40 projects, all with either a T4.0 or a T4.1 as the heart of the system, mostly purchased directly from PJRC in multiple batches over the years. I acknowledge that "always" and "never" are broad-brushed words that are not usually good to use when describing things, but I have truly never had any trouble with any of my Teensy projects WRT having to wiggle any cables and/or connectors. I still have my original (purple board) Teensy 4.0 that I acquired by adding it to a PCB order from OshPark many moons ago. I regularly use it as my development T4.0, and it continues to be rock solid, even after enduring (an estimated) thousands of plug/unplug cycles, always being 100% reliable, never showing any signs of any intermittent connection. Are you certain that the problems you are seeing are at the Teensy end ?? My experience with cheaper cables is that USB-A is very finicky and not stress tolerant, so possibly you wiggling the cable is actually affecting the PC end of the cable, rather than the Teensy end of the cable ?? At this point, if you are truly experiencing a problem with the Teensy/cable interface, I would say is it a strong likelihood that either you are doing something wrong with your Teensy(s) and/or you are doing something wrong with your cable(s). I use Anker brand cables for many varieties of USB cables (USB-A to microUSB, USB-A to USB-C, USB-C to USB-C, etc,), and have never had to replace even one (with the exception of when our cat chews one into multiple parts !!). Just as another data point, maybe you could try that brand (yes they are slightly more expensive, but you usually get what you pay for) to see if you find any improvement.

Mark J Culross
KD5RXT
 
All of my Teensies were purchased directly from PJRC. All 3 of them, so not a huge sample, but not an N of 1 either.

I would be willing to consider the issue being on the USB-A end if I hadn't tried half a dozen different cables, or if other, non-Teensy, devices had issues, and if wiggling the Micro-B ending wasn't always the thing that made it work, when it ever worked at all.

If you've had 100% good luck with Anker cables, I'll order me up some. I'm not being stingy here. And TBH, the one cable that has worked best for me (at least somewhat reliably) was actually an 'Amazon Basics A->Micro-B' cable.

I'm just sitting here feeling like: I've got all these other devices (digital camera, microSD card reader, headphones, crappy phone I use for hiking, 2x USB<>RS232 interfaces) that all work flawlessly (i.e. with no wiggling required, ever), with all of these 6 cables, and then I've got these three Teensies, that work with exactly one of these cables, and even then only if I wiggle it around a bunch, and tape the cable in a certain orientation.

I'm nothing if not an empiricist first, and that truth table of evidence tells me that it's the Teensy connectors that are the problem here. If others have found a reliable solution, I'd love to hear about it, and if the answer is "buy this one, specific, more expensive, cable and tape it in place" I'm actually 100% fine with that too, I just want to be able to do my development day to day.

Any additional thoughts? TIA!

- Ian
 
As another example, I use micro-B "CNC Tech" cables (102-1092-BL-F0200) purchased from Digikey: 1175-1856-ND, rated for 480Mbps. No problems after 8 years using them. Note: the other end is Standard Type-A and 6.5' length.

Never had to wiggle the cable to get a good connection.
 
I reinforce the jacks with a bit of solder on the mounting tabs., and now check just about everything that has a micro usb to see if it needs the same. This has prevented a lot of problems
 
I reinforce the jacks with a bit of solder on the mounting tabs., and now check just about everything that has a micro usb to see if it needs the same. This has prevented a lot of problems
I did this earlier today. No difference for me. *shrug*
 
I just looked at my Teensy's. Wow! Almost no solder on the micro USB connector shield. Barely a trace of solder on pcb top side. Bottom side holes are void of any solder. Thanks for the heads up ETMoody3. My T3.5's have much more solder from factory vs T4.x.

BTW, impcc, the CNC Tech cables are very tight. Be prepared to hold Teensy in place. I hope it doesn't rip the connector off the pcb. And, I wonder if the plastic molding on your cable is trying to lift upwards against the proto board?
 
I just looked at my Teensy's. Wow! Almost no solder on the micro USB connector shield. Barely a trace of solder on pcb top side. Bottom side holes are void of any solder. Thanks for the heads up ETMoody3. My T3.5's have much more solder from factory vs T4.x.

BTW, impcc, the CNC Tech cables are very tight. Be prepared to hold Teensy in place. I hope it doesn't rip the connector off the pcb. And, I wonder if the plastic molding on your cable is trying to lift upwards against the proto board?
There appeared to be zero solder at all on the shield thru-holes of my connectors. I soldered them up, but it didn't improve anything w/r/t connectivity.
 
At this point I have to wonder what you expect done.
I just want to be instructed as to how to get work done with my Teensies. That's it, and that's all. If the answer were "re-solder the micro-b connector" that would be fine -- I tried that; it didn't help. If the answer is 'buy this one, specific 'CNC Tech' brand A->micro-B cable', that's fine too! I've ordered one. I'll let y'all know how it works out.

When I bought my first T4.1, as this thread chronicles, responders blamed my difficulties on "bad cables", so I bought a bunch of different cables, and had the same issues with all but one (the Amazon Basics one, which works with my old T4.1 pretty reliably, but only works with my new T4.1 in the presence of scotch tape as shown in the photo).

I guess my point here is that there very much does appear to be a systemic problem here. When I have a half dozen cables that work with a half dozen different non-Teensy accessories, in all their various permutations, and I can only get one of these cables to work at all with my latest Teensy board, and only then by scotch taping it into place with a particular direction of tension? That feels like a problem to me.

If Paul wants to jump up on this thread and explain how I'm 'doing it wrong', I'm all ears -- 100% seriously. If Paul wants to get up on this thread and say something like, "yeah, I got a batch of finicky connectors -- I'm aware of the issue -- here's how I recommend working around it..." that's fine too.

A bunch of people telling me that I'm doing it wrong, without telling me how to do it right, is not useful. "what [do I] expect done[?]" realistically? Nothing. I was hoping that the community would swoop in and say, "I had similar problems, and this is how I addressed them, to arrive at a reliable setup..." but that doesn't seem to be what's happening. Instead, I appear to be effectively told to stop talking about it.

So, what do I expect? Nothing. My experience is lining up with my expectations. I guess that means I'm 100% satisfied. I was, perhaps foolishly, hoping for better info. Hopes and expectations are clearly not the same things.

Thanks to all who provided tips, and best of luck to all who will follow in my footsteps in the future. Scotch tape FTW!

-Ian
 
Last edited:
Your experience obviously isn't normal, which begs the question: "what could possibly be causing this?"
One answer could be that one of the cables you've tried (probably the very first one) is bent out of shape and is trashing the connector on any plug you attempt to use it with...
 
But why aren't these 'purportedly poison' cables destroying other devices? And the first one I tried on this new T4.1 was the exact same Amazon Basics one I've been using primarily on my previous T4.1 (I have tried it on other devices to try and diagnose this issue), so it really just doesn't make sense. If that cable is 'poison' then either T4.1 #1 made it that way, my other devices are somehow immune to its maleficence, or there's a coincidence of epic, truly unlikely proportions going on here.

Also, how is my experience obviously not normal? Because more people should be complaining if it's not?

I'm not trying to be an ass about it, but this all points to a systemic problem as best I can tell. If it were an N of 1, I would've shut up by now, but that's not where we are.
 
Last edited:
Yes. The only common factor here is you and your equipment.
My experience and my equipment are the only things I have to go on here.
  • Number of Teensies I've used: 3
  • Number of Teensies I've had USB connectivity problems with: 3
  • Number of A -> MicroB cables I've tried with these boards: 6 (at least, if not more.)
  • Number of years I've spent working in tech, including µC hardware design (back to 6502, Z80, 68008, 68332, etc): 30+.
  • Number of data logging instruments I've contributed work to, doing multi-decade deployments on the bottom of the ocean: 50+.
  • Number of data logging instruments I've contributed work to on F1 engine management systems: 3+.
I'm not trying to thump my chest here, my point here is: I'm not an idiot, I wasn't born yesterday, and I'm not a noob to embedded development (although, I concede, this is not the toolchain I am most familiar with). This is not the "hard" stuff. This is a basic USB connectivity problem. I try to be as humble as possible here, but there is definitely a problem here, at least as it relates to "[me] and [my] equipment".

Put the blame on me if you genuinely think that's where it belongs. If I need to, in order to get my product to market, I'll just port my project to a different platform. I like the Teensy development platform a lot, and I try to support smaller businesses in general, but if I have to spend multiple hours sorting out basic USB connectivity every time I get a new dev board? Then it's not nearly as nice of a platform any more. I currently have a problem here (that I'm solving using Scotch tape -- a solution with which I cannot go to market.) I've never had these connectivity problems with RPis or first-party Arduinos.

I was trying to get to the bottom of this issue by discussing it here on the forums. Just telling me that the "common factor is [me] and [my] equipment" is neither probative, nor does it get me any closer to solving the issue I'm having.

If this really is a 99.999:0.001 problem, and I'm the 0.001, then it probably makes the most sense for me to simply give up on Teensy and move to a different platform. My current feelings are that Teensy is a lovely platform, with some problematic USB Micro-B jacks. But just telling me it's all my fault, without providing any suggestions about how to work around the issue? That's not helpful. I hope that makes sense.
 
What you are doing, with an improbably high word count, is rejecting any suggestion that doesn't fit the answer you have chosen.

I have never had an issue with a loose usb socket. Only one tearing right off.

One.

A suggestion in general :

Gently pry up the tiny tabs on any usb micro *plug* when they wear. I use the tip of a hobby knife.
These tabs accept the majority of the physical stress.
 

Attachments

  • IMG_3087.jpeg
    IMG_3087.jpeg
    435.1 KB · Views: 28
And we circle right back around to where we started. In one of the early replies to your wiggling post, it was noted that the most common problem is actually caused by bad cables. You noted in a follow-up that you are using your best cable. Neither of those facts negates the other. However, you keep insisting that there is a systemic problem. The important question is "the systemic problem is with what and/or where" ?? If the problem was truly with the connector on the Teensy, then the forum should be rife with complaints to that effect. In order to establish whether this was actually the case, I searched the forum for the word "wiggle", which returned multiple matches, (discounting your most recent posts) only three of which specifically referred to the microUSB on the T4.1. This is hardly a tidal wave of complaints. Unfortunately, I don't have any "silver bullet" recommendations to offer. I can only hope that either one of the alternative cables suggested earlier works for you, or someone who has had a similar experience to yours reveals their resolution. In the meantime, good luck (seriously) !!

Mark J Culross
KD5RXT
 
Back
Top