Teensy 4.1 USB connection

bdoan

Well-known member
I am having a problem connecting the 4.1 through a "non-powered" USB hub.
I cut the connection between 5V and Vusb on the bottom of the 4.1 board.
If I power the 5V with a separate supply and connect the USB micro connector directly to the computer, the 4.1 shows up.

If I attempt to connect through the AT43301 hub device on my test board, it does not connect.

Any suggestions?

1729811351789.png
 
While not a good solution, try the easiest thing first... reprogram Teensy while Tools > CPU Speed is set very slow, like 150 or even 24 MHz. It will use less power.

Slightly more difficult would be editing usb.c to force 12 Mbit/sec mode. Maybe try separately and together, as the hub will also use more power if Teensy connects at 480 Mbit/sec. Or if 12 Mbit/sec speed works, try overclocking so Teensy uses more power.

The basic idea is to try to figure out if the power is power limit and whether the speed also plays a factor.
 
Yet another issue you might be facing is inrush current during hot plugging. Mentioning this because I see only a 22uF capacitor on your schematic. USB spec says to use at least 150uF.

Make a point to test with keeping everything plugged together. With USB hot plugging is the norm and almost everyone does it without much thought. But the USB spec requires specific design so a hot plug event won't cause too much voltage drop.
 
The Teensy is powered by a separate regulated 5v supply, not the Vusb.

I have separated the pad jumper under the 4.1 board.

I can see that the Teensy only enumerates when I connect it to the computer directly and also supply 5v

I will try the 100uF on Vusb

I have a similar arrangement on other boards using a PIC45K50 and that works fine.
 
You may have something like this below in setup().
Code:
    Serial.begin(115200);
    while (!Serial);
If so change it to:-
Code:
    Serial.begin(115200);
    while (!Serial && (millis() < 3000));

What's happening is the top code waits until the USB serial enumerates...i.e. the PC USB becomes available, but when powered from the separate 5V supply the PC is NOT plugged in so will never be available and the Teensy will LOOP FOREVER.
The second code waits for just 3 seconds before carrying on.
 
You may have something like this below in setup().
Code:
    Serial.begin(115200);
    while (!Serial);
If so change it to:-
Code:
    Serial.begin(115200);
    while (!Serial && (millis() < 3000));

What's happening is the top code waits until the USB serial enumerates...i.e. the PC USB becomes available, but when powered from the separate 5V supply the PC is NOT plugged in so will never be available and the Teensy will LOOP FOREVER.
The second code waits for just 3 seconds before carrying on.
If I use a (commercial) powered hub or direct connection to the computer, the USB, 5v power sequence does not matter.
 
Yet another issue you might be facing is inrush current during hot plugging. Mentioning this because I see only a 22uF capacitor on your schematic. USB spec says to use at least 150uF.

Make a point to test with keeping everything plugged together. With USB hot plugging is the norm and almost everyone does it without much thought. But the USB spec requires specific design so a hot plug event won't cause too much voltage drop.
Is the Teensy trying to enumerate at Full Speed or High Speed?
I'm running UART and USB Audio.

Also, if I separated 5v (Teensy supply voltage) from Vusb, is the Teensy still monitoring Vusb to start enumeration??
 
Last edited:
That hub IC only supports full speed but the Teensy can enumerate as either high speed or full speed.
 
If what you did works for you, great. I don’t believe it addresses my issue. I may have a USB speed compatibility issue with the hub
If you are powering the Teensy by 5V and it is not connected to a PC by the uart serial port and your start-up software is like the first/top sample of code it will just sit there going around in circles until a PC is connected.
 
If you are powering the Teensy by 5V and it is not connected to a PC by the uart serial port and your start-up software is like the first/top sample of code it will just sit there going around in circles until a PC is connected.
Please read the entire thread.

It connects properly when connected directly to the PC. The problem is with the home built Hub
 
Please read the entire thread.

It connects properly when connected directly to the PC. The problem is with the home built Hub
@bdoan:

Let me see if I can add yet another perspective without further muddying the waters: I don't believe that it is 100% clear when using your home built hub, whether a PC is also connected to your home built hub or not ("If I attempt to connect through the AT43301 hub device on my test board, it does not connect."). If you have the code pointed out by BriComp, the very valid point being made is that, no matter what collection of devices you have connected to the Teensy (commercial hub, home built hub, etc.), if a PC is not somehow connected to your Teensy (presumably, thru whichever hub, etc.), that code will wait forever for a PC to be connected. Plain & simple, as is the solution/resolution.

A couple more follow-up questions (having only the limited & incomplete view of your schematic . . . wanting not to guess wrong):
- is your home built hub powered by the same 5VDC that your Teensy is (externally) powered by ??
- do your Teensy and your home built hub share a common ground ??
- can any other USB devices successfully connect thru your home built hub ??

A little advice: @jmarsh & @BriComp are just two of the very talented, very knowledgeable, and very kind forum members who are quick to offer detailed help & suggestions, and of course, @PaulStoffregen is the creator of this wonderful family of devices & capabilities.

There is nothing more discouraging than to have someone ask a question, others jump in to offer help, expertise, and/or suggestions, then to have the original inquirer simply & completely dismiss the value of the suggestion that has been made !! It works much better to graciously accept any offered solutions, and it would be even better to have actually tried them, then simply report back the results, be they positive or negative. No need to be insulting and/or dismissive in any way in your response. And most of all, try not to let any conclusions that you may have already drawn interfere with the ability for others to attempt to help. After all, you did come here asking for help !!

Quite often, the simplest of questions will result in the greatest of insights . . .

Hope that helps . . . and those that offer help are truly trying to be helpful !! This community of users is great !!

Mark J Culross
KD5RXT
 
@bdoan:

Let me see if I can add yet another perspective without further muddying the waters: I don't believe that it is 100% clear when using your home built hub, whether a PC is also connected to your home built hub or not ("If I attempt to connect through the AT43301 hub device on my test board, it does not connect."). If you have the code pointed out by BriComp, the very valid point being made is that, no matter what collection of devices you have connected to the Teensy (commercial hub, home built hub, etc.), if a PC is not somehow connected to your Teensy (presumably, thru whichever hub, etc.), that code will wait forever for a PC to be connected. Plain & simple, as is the solution/resolution.

A couple more follow-up questions (having only the limited & incomplete view of your schematic . . . wanting not to guess wrong):
- is your home built hub powered by the same 5VDC that your Teensy is (externally) powered by ??
- do your Teensy and your home built hub share a common ground ??
- can any other USB devices successfully connect thru your home built hub ??

A little advice: @jmarsh & @BriComp are just two of the very talented, very knowledgeable, and very kind forum members who are quick to offer detailed help & suggestions, and of course, @PaulStoffregen is the creator of this wonderful family of devices & capabilities.

There is nothing more discouraging than to have someone ask a question, others jump in to offer help, expertise, and/or suggestions, then to have the original inquirer simply & completely dismiss the value of the suggestion that has been made !! It works much better to graciously accept any offered solutions, and it would be even better to have actually tried them, then simply report back the results, be they positive or negative. No need to be insulting and/or dismissive in any way in your response. And most of all, try not to let any conclusions that you may have already drawn interfere with the ability for others to attempt to help. After all, you did come here asking for help !!

Quite often, the simplest of questions will result in the greatest of insights . . .

Hope that helps . . . and those that offer help are truly trying to be helpful !! This community of users is great !!

Mark J Culross
KD5RXT
Thank you for all your advice.

I am specifically looking for conditions that would cause the AT43301 hub to fail.

A TUSB2046 hub works, a Belkin powered hub works and direct connections to the PC work. Therefore, I am ruling out code or configuration issues.
 
Maybe it's related to 12 vs 480 Mbit speed? Did you find usb.c and try editing to force use of only 12 Mbit speed?
I have not attempted firmware solutions. My hunch is that the AT43301 has some limitations that the TUSB2046 and other hubs do not.

At 12 Mbit, will the Teensy have enough bandwidth to handle UART and USB audio (simultaneously)?

Also, I do not see usb.c in the includes:

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <SPIFlash.h>
 
It's a .c file, not a header/.h so it wouldn't get included. Regardless it is part of the core library that gets linked with every project.
 
Thank you for all your advice.

I am specifically looking for conditions that would cause the AT43301 hub to fail.

A TUSB2046 hub works, a Belkin powered hub works and direct connections to the PC work. Therefore, I am ruling out code or configuration issues.

I have not attempted firmware solutions. My hunch is that the AT43301 has some limitations that the TUSB2046 and other hubs do not.

Just in case you missed this point earlier: And most of all, try not to let any conclusions that you may have already drawn interfere with the ability for others to attempt to help.
Mark J Culross
KD5RXT
 
Just in case you missed this point earlier: And most of all, try not to let any conclusions that you may have already drawn interfere with the ability for others to attempt to help.
Mark J Culross
KD5RXT
Mark,
If the Teensy works properly with other hubs, how does initialization timing (start serial) affect enumeration of the USB?
 
@bdoan: I am by no means a USB expert of any kind. My knowledge of hubs & how they work/interact with the Teensy (mostly from my personal development of my TeensyMIDIPolySynth (TMPS) project, which gets other MIDI devices plugged into its USBhst port) only goes as far as "define & initialize a USBhost object in my sketch, plug in my devices, & they work." I acknowledge that this has absolutely nothing to do with what you are currently trying to figure out (you're plugging the Teensy into a USB hub, not the other way around like my TMPS uses).

I know absolutely nothing about the USB enumeration process, and/or how the Teensy hardware & software interact with the USB host, with or without a hub in between. Sorry, I can't offer any insight into any of that. However, I did ask a few very simple questions in an earlier post that should not be difficult at all to answer, the answers to which might help with additional troubleshooting. Successfully determining the actual problem is usually just a matter of properly interpreting the clues that are there. We really are trying to help, but you have to help us to help you !!

Mark J Culross
KD5RXT
 
Back
Top