Teensy 4.1 Development Board and Adafruit TCA9548A

Status
Not open for further replies.

teensy_teen

Active member
Hi, are these two products fully compatible with each other? Is it as simple as plug and play like using the TC9548A with other Arduino controllers?
 
Should be unless they use specific registers that doesn't exist on another platform, it all depends where you source the library

you can try loading it in the IDE with teensy 4.1 selected in drop down, then see if it compiles successfully, as a start
 
Hi, are these two products fully compatible with each other? Is it as simple as plug and play like using the TC9548A with other Arduino controllers?

I haven't used it, but it looks compatible:
  • It has 10K pull-up resistors, so you won't need to add pull-up resistors on the Teensy;
  • It can run at 3.3v voltage level;
  • It claims to be able to do voltage-level shifting, so if you had some old 5v only devices, you could run them on one of the 8 I2C buses at 5v, and it would translate it to 3.3v for the Teensy;
  • 10K resistors are a little high, so it might be possible that you couldn't run it at the highest I2C speeds -- you may need to use the intermediate or default low speeds.
 
Thanks. In case I want to run at the highest I2C speeds, what should I do?

I can't try it myself as I have not bought a Teensy yet. I will buy it after confirmation of compatibility.

If the breakouts and sensors can take either 3.3V or 5V, in general is it better to give them 5V?
 
it is better to run them at 3.3

beware that some breakout boards require 5v with very few having 3.3 on the communication lines. Most chips don't do this but few do. Thats why its better to check the datasheet of the chip, as well as the scematic of the breakout board, as this too has influence on any attached circuits.
 
according to adafruit
Code:
Vin is connected to 5V (on a 3V logic Arduino/microcontroller, use 3.3V)

so you need to connect it to 3.3v, teensy 3.6 -> 4.1 gpios only support 3.3v max, they are not 5v tolerant.

it's that or introducing a level shifter, which is just extra baggage
 
Thanks. In case I want to run at the highest I2C speeds, what should I do?

I can't try it myself as I have not bought a Teensy yet. I will buy it after confirmation of compatibility.

If the breakouts and sensors can take either 3.3V or 5V, in general is it better to give them 5V?

Maybe it will work with 10K pull-ups, maybe it won't. I'm a software guy, but IIRC, it depends on the total length of the I2C bus, the number of devices on the bus, how well the wiring conducts currents (both wires and through solder). If the resistors are too high to run at the fastest speeds, you essentially have 4 options:

  • De-solder the pull-up resistors from the Adafruit board (making sure you don't have unintended solder bridges and you didn't mess something up), and add new resistors;
  • Find the chip elsewhere and build your own version (or see if there is an alternate supplier with smaller pull-up resistors);
  • Try the highest speed, and if it doesn't work, back off to the intermediate speeds (I tend to recommend this as being the simplest); (or)
  • If you only need to connect 3 devices, connect each one to a separate I2C bus. Depending on the devices, you may need to tune the library, since a lot of I2C device drivers assume there will be only one I2C bus. You might or might not need to add 2.2K pull up resistors on each of the 3 buses (i.e. 6 separate pull-up resistors).

Note, that not all devices run at the highest I2C speeds anyway. And as I said, it can be tricky to get all of conditions satisfied to run at top speed. In general, concentrate first on getting it to run, and then after it runs, you can try to optimize it. In order to optimize it, you may need to redo parts. It is an iterative process, and part of it is spending time to learn about the trade offs. Even if you have to eventually redo things, if you have a working example, that is good enough, you are still ahead of the game compared to having a theoretical 'fastest' device that never runs.

Particularly if you are dealing with humans, human reaction time is so slow compared to computer time, that it may be wasted time spent getting it to run at the fastest speed in theory. Sure, there are times when you need to absolutely run as fast as possible.

And in general note, that I2C is a relatively slow interface. If you really need the speed, you may need to switch devices to something faster, though of course each way has its own pluses and minuses.

In terms of 5v vs. 3.3v, the Teensy 4.1 runs at 3.3v. As others have said, you can damage your Teensy if you feed it 5v from an I2C bus.

With a few exceptions, you want to run your I2C bus at 3.3v. The main exceptions are devices designed years ago for the Arduino Uno, which ran at 5v. If you have a choice of devices, choose devices that can run at both 3.3v and 5v, or just 3.3v. I imagine there are a few devices that just need 5v and not 3.3v. That being said, the TCA9548A appears to already have the voltage shifting circuitry in place, so it is a matter for the 5v devices hook up 5v VDD, but hook up 3.3v to the part that connects with the Teensy.
 
if adafruit posted what i quoted above, i wouldnt drive the Vin at 5v, the pullups may be pulled to Vin (didnt check schematic, just the quote)

plus as per their PDF:
Code:
Power Pins:
Vin - this is the power pin. Since the sensor chip uses 3-5 VDC. To power the board, give it the same power as
the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V
GND - common ground for power and logic

The datasheet also mentions:
Code:
The TCA9548A may also be used for voltage translation, allowing the use of different bus voltages on each
SCn/SDn pair such that 1.8-V, 2.5-V, or 3.3-V parts can communicate with 5-V parts. This is achieved by using
external pull-up resistors to pull the bus up to the desired voltage for the master and each slave channel.

But that may be a tricky subject, will 5V devices work on the chip if it's 3.3V powered?
 
Yeah, I miss read the pinout. I thought there were separate power poles for each of the sub I2C buses. I don't see how it could do voltage translation without having a power for the output, and 8 separate power/grounds for the I2C elements.

There is a device that does allow you to do an I2C mux over 4 I2C buses, and you can independently change the power of each of the 4 buses (though you have do it via cutting a solder jumper, and separately powering the power pin for the sub-bus. I bought this in the distant past, but I never actually used it, since I don't have I2C devices that have the same address.


And note, this device also has 10K pull-ups. In this case, it has the pull-ups on both sides (one set of pull-ups where you would connect the Teensy, and 4 set of pull-ups for each I2C sub-bus).

I have simplified things by retiring the 1-2 displays I had from my Arduino days that needed 5v, and when I do I2C things, I only use 3.3v devices. But when I was mixing I2C voltages, I used a simple level shifter made for I2C devices. For me, the above device was over-kill.

I generally don't play with I2C speeds. The warning just comes from the I2C documents that say the higher the pull-ups, the slower the speed:


Here is the quote from the TI document:
A smaller resistor will give a higher speed because of smaller RC delay, and a larger resistor will give lower power consumption.

Since I rarely have more than 1-3 I2C elements, and everything is 3.3v, when I add explicit pull-up resistors, I tend to use 2.2K, which is what Paul uses in the audio and prop shields on 3.3v systems. Generally, for 5v systems, people use 4.7K resistors as the default value. And a lot of places use 10K resistors like Adafruit and SwitchDoc labs. I assume there is an electrical reason why they prefer 10k resistors.

Back with Teensy LC/3.x microprocessors, you needed at least one set of pull-up resistors, or the I2C scanner would hang. So, I tended to put in pull-up resistors to pins 18/19 on every board, even if I wasn't using I2C at the time.

If you have multiple resistors on the bus, it is additive (i.e. two 2.2K resistors would act like a single 4.4K resistor). So, if you have a complicated bus, you may want to remove the extra pull-up resistors.
 
Last edited:
If you want to strengthen the pull-ups from 10k to 5k, all you need to do is piggy-back extra 10k resistors on top of
(and thus in parallel with) the existing pull-ups on the PCB. This is easier and less risky than replacing the existing ones.
 
If you want to strengthen the pull-ups from 10k to 5k, all you need to do is piggy-back extra 10k resistors on top of
(and thus in parallel with) the existing pull-ups on the PCB. This is easier and less risky than replacing the existing ones.

Excellent idea! I don't have the board with me. Which is the dimension of the 10k resistors to use?
 
if adafruit posted what i quoted above, i wouldnt drive the Vin at 5v, the pullups may be pulled to Vin (didnt check schematic, just the quote)

plus as per their PDF:
Code:
Power Pins:
Vin - this is the power pin. Since the sensor chip uses 3-5 VDC. To power the board, give it the same power as
the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V
GND - common ground for power and logic

The datasheet also mentions:
Code:
The TCA9548A may also be used for voltage translation, allowing the use of different bus voltages on each
SCn/SDn pair such that 1.8-V, 2.5-V, or 3.3-V parts can communicate with 5-V parts. This is achieved by using
external pull-up resistors to pull the bus up to the desired voltage for the master and each slave channel.

But that may be a tricky subject, will 5V devices work on the chip if it's 3.3V powered?


Given that the Teensy's Vin accepts 3.6 to 5.5V and the TCA9548A accepts 1.8-5V, can I power both of them using one or two 3.7V LIPO battery? I have a few spare ones with JST-PH connector.

How do we connect a battery to the Teensy 4.1? I don't see any connector mounted on the Teensy 4.1 board. Are we supposed to put it in a breadboard first and then power it from battery via the breadboard?
 
Given that the Teensy's Vin accepts 3.6 to 5.5V and the TCA9548A accepts 1.8-5V, can I power both of them using one or two 3.7V LIPO battery? I have a few spare ones with JST-PH connector.

How do we connect a battery to the Teensy 4.1? I don't see any connector mounted on the Teensy 4.1 board. Are we supposed to put it in a breadboard first and then power it from battery via the breadboard?

At the simplest, just attach a JST-PH connector to VIN and Ground. On the Teensy 4.0 and 4.1, you can use the ground pin between VIN and 3.3v or the other two ground pins (one next to pin 0 on the other side, or the ground pin at the set of 5 pins at the end of the Teensy 4.0 or the the set of 5 pins just before the micro SD card on the Teensy 4.1. Just make sure you remove the battery when you plug the Teensy into the USB connection for programming. You could do it with wires, or since the pins are adjacent, you could use one of these JST PH connectors using other pins in a breadboard, soldering header pins to the '+' and '-' pins that are adjacent:

There is a solder jumper pad underneath the Teensy that controls whether the VUSB pin is linked to the VIN pin. This solder jumper pad is normally connected. If you cut the solder connection, when you plug in the USB cable, it will not power the Teensy. So you would need to use the battery power to power the Teensy.

Alternatively, if you cut the jumper, you could use the 3 pins, VIN, VUSB, and ground, and hook up a battery charger. Note, you would need to connect the VUSB pin directly, since it is not normally connected, and you wouldn't be able to use it in a normal breadboard setup. For example, this little unit can be used, using jumper wires to connect the 3 pins:

If you are willing to solder the Teensy, these boards were designed to match the Teensy LC, 3.x, and 4.x pinout:

I prefer the first one to the second, as it charges larger batteries faster. It also does not use pin 1 as the charging status (using pin 1 would prevent you from using the first Serial port).

Adafruit made this Teensy -> Feather adapter that includes a JST-PH connector and automatic charging support. With the Adafruit board, you do NOT need to cut solder jumper between VIN and VUSB. Instead, the board uses VIN, and if there is power available on VIN, it will use that power to charge the battery. If there is no power on VIN, it will connect the battery to provide power.

The Teensy 4.0 is the same shape as the Teensy 3.2 that the Feather Adapter was made for. If you wanted to use the Feather adapter to connect to Adafruit Feather wings, there are a few things you need to do:

For the Teensy 4.1, you need to adjust how you would connect the Teensy, since the Teensy 4.1 is longer. Either you use female headers to raise the Teensy up, so the board clears the JST PH connector, or you mount the Teensy underneath the feather adapter.

I prefer the Teensy Feather adapter to the other methods because the JST PH connector is more solidly attached. When I've soldered a JST PH connector to a prototype board, I have to be real careful in removing and attaching a battery. I have pulled off the JST PH connector a few times.

Generally, I use stacking headers on the Teensy, so that I can mount things either below or above the Teensy.
 
At the simplest, just attach a JST-PH connector to VIN and Ground. On the Teensy 4.0 and 4.1, you can use the ground pin between VIN and 3.3v or the other two ground pins (one next to pin 0 on the other side, or the ground pin at the set of 5 pins at the end of the Teensy 4.0 or the the set of 5 pins just before the micro SD card on the Teensy 4.1. Just make sure you remove the battery when you plug the Teensy into the USB connection for programming. You could do it with wires, or since the pins are adjacent, you could use one of these JST PH connectors using other pins in a breadboard, soldering header pins to the '+' and '-' pins that are adjacent:

There is a solder jumper pad underneath the Teensy that controls whether the VUSB pin is linked to the VIN pin. This solder jumper pad is normally connected. If you cut the solder connection, when you plug in the USB cable, it will not power the Teensy. So you would need to use the battery power to power the Teensy.

Alternatively, if you cut the jumper, you could use the 3 pins, VIN, VUSB, and ground, and hook up a battery charger. Note, you would need to connect the VUSB pin directly, since it is not normally connected, and you wouldn't be able to use it in a normal breadboard setup. For example, this little unit can be used, using jumper wires to connect the 3 pins:

If you are willing to solder the Teensy, these boards were designed to match the Teensy LC, 3.x, and 4.x pinout:

I prefer the first one to the second, as it charges larger batteries faster. It also does not use pin 1 as the charging status (using pin 1 would prevent you from using the first Serial port).

Adafruit made this Teensy -> Feather adapter that includes a JST-PH connector and automatic charging support. With the Adafruit board, you do NOT need to cut solder jumper between VIN and VUSB. Instead, the board uses VIN, and if there is power available on VIN, it will use that power to charge the battery. If there is no power on VIN, it will connect the battery to provide power.

The Teensy 4.0 is the same shape as the Teensy 3.2 that the Feather Adapter was made for. If you wanted to use the Feather adapter to connect to Adafruit Feather wings, there are a few things you need to do:

For the Teensy 4.1, you need to adjust how you would connect the Teensy, since the Teensy 4.1 is longer. Either you use female headers to raise the Teensy up, so the board clears the JST PH connector, or you mount the Teensy underneath the feather adapter.

I prefer the Teensy Feather adapter to the other methods because the JST PH connector is more solidly attached. When I've soldered a JST PH connector to a prototype board, I have to be real careful in removing and attaching a battery. I have pulled off the JST PH connector a few times.

Generally, I use stacking headers on the Teensy, so that I can mount things either below or above the Teensy.


Thank you for the detailed explanation. Do you know if https://www.sparkfun.com/products/16996 is tall enough to clear the JST PH connector of the Feather Wings? I guess another option is to just plug the Teensy 4.1 with headers from Sparkfun and Adafruit 1863 into a breadboard. Then, cut the solder connection at the pad to have automatic power switching between the battery and PC's USB port.

From the diagram, it states that for 3.3V input, 250mA is the max. What is the maximum mA for Vin (3.6 to 5.5 Volts)? I probably just use one of those Adafruit 3.7V LIPO batteries that I already have.

https://www.pjrc.com/store/teensy41.html
 
Status
Not open for further replies.
Back
Top