You do have 2 additional serial ports if you are able to solder wires to the pads underneath the Teensy 4.0. I have found if I just solder wires directly to the pads, over time they come off.
if you upgrade to the Teensy 4.1, it has 3 extra serial ports on the external pins.
I recall Paul has said the latest OctoWS2811 library for Teensy 4.0 and 4.1 now allows you to pick which pins are used. Unfortunately the documentation does not seem to have been updated.
There are some breakout boards that bring out the bottom pins of the Teensy 4.0. I tend to prefer the Trainer4Edu/FRDM4236 board, but if you want to solder in the micro SD adapter, it can be tricky. One advantage of the Trainer4Edu board is it has the same pinout as the Teensy 4.1 for pins 24-33. Pins 34-39 in the Teensy 4.0 are for the micro-SD card, while in the Teensy 4.1, the micro SD card pins are only in the micro SD card, and pins 34-41 are new pins:
I put a list of other Teensy 4.0 breakout boards in the unofficial wiki:
Now in terms of audio pins. You
CANNOT use pin 5 (IN2) for pin 8 (IN1). This is because the Teensy 4.x has two separate I2S ports. However, the audio adapter only uses the standard I2S1 port. If you were using a different I2S device that connected via wires, you could use the second I2S port. For reference, the pins used by I2S1 are:
- Power/ground pins
- Pin 23: MCLK1
- Pin 21: BCLK1 (conflicts with RX5)
- Pin 20: LRCLK1 (conflicts with TX5)
- Pin 7: IN1 (conflicts with TX2)
- Pin 8: OUT1A (conflicts with RX2)
- Pad 32: OUT1B (underneath the Teensy 4.0, can be used for other signals, but it isn't used by the audio adapter)
- Pin 9: OUT1C (can be used for other signals, but it isn't used by the audio adapter)
- Pin 6: OUT1D (can be used for other signals, but it isn't used by the audio adapter).
Note, the audio adapter also uses the main I2C bus, which is a separate bus:
If you want to use the I2S2 bus, the pins are:
- Power/ground pins
- Pad 33: MCLK2 (underneath the Teensy 4.0, normal pin in 4.1)
- Pin 4: BCLK2
- Pin 3: LRCLK2
- Pin 5: IN2
- Pin 2: OUT2
The simplest approach is probably to upgrade to the Teensy 4.1, which has 8 serial ports that can be used (though like the Teensy 4.0, Serial2 and Serial5 cannot be used if you use the audio adapter).
If you use one of the breakout boards, many of them take a few weeks to make and ship. For example, I put my last OSH park order in on May 22nd. They shipped it via US post office from Oregon on June 1st, and I picked it up in Massachusetts on June 5th. If you are ordering from OSH park, you can add Teensy 4.0's to the order for $18.
If you are just interested in playing sounds but not actually doing any fancy processing, there are other options on the Teensy 4.x:
- Use an external I2S output board and use I2S2 instead of I2S1. The I2S output boards that I've used typically do not need MCLK connected, so you can use I2S2 without having to solder to pad 33.
- Use S/PDIF output and a S/PDIF to analog converter. You can use S/PDIF with I2S2, and you could use all 5 serial ports. If you use the native S/PDIF, you would not be able to use pins 14-15 (i.e. Serial3).
- Use MQS (pins 10, 12) to output analog sound and use an amplifier. The problem with this is you lose the main SPI bus (pins 11, 12, 13).
- Use something like the DFPlayer to emit sound. These are fairly cheap little cards that have a micro SD card, and you control it via either a serial port or possibly separate pins.
Some I2S outputs include: