Seeking advice on communication between two Teensy 4.1 boards

Status
Not open for further replies.

lrtjosh

Active member
Hi,

I am designing a custom PCB that will mount 2 x Teensy 4.1 boards side by side that represent two sub-systems of the same project. Lets call them Teensy A and Teensy B. Teensy A needs to send some very light weight data to Teensy B, as it gathers info from its attached sensors/inputs etc. The data basically takes the form of a stream of numerical value pairs. The data is not bidirectional - it's just a one way stream.

I had initially assumed using one of the SPI busses would be ideal for this, except after doing lots of reading on this forum I now see that Teensy (or Arduino) as SPI Slave is not part of the official SPI library. I have previous experience using I2C between multiple Teensy 4.1 boards using Richard Gemmell's outstanding teensy4_i2c library - so that's an option I have up my sleeve... however for this particular application I just want a simple interrupt to happen when new bytes arrive at Teensy B so I wonder if a simpler type of serial data is more appropriate.

I'm just looking for some advice from anyone with experience on this - what the best interface to use for this scenario? Is a plain-old single wire Hardware Serial pin the way to go, with a pre-agreed data rate? Or does that expose me to potential errors without a separate hardware clock pin like SPI or I2C would use? Again, the two boards will be very close together, simply connected by traces on the same PCB that physically mounts them.

Cheers,

Josh
 
Last edited:
I haven't got any experience with SPI, but I would use simple UART serial.

It's already done for you and would be so simple to get going.

If you want handshaking then rts/cts is available to you, but I can't imagine why you would.

Just invent a character sequence which indicates the start of a data packet and either send or have a pre-determined data length or a pre-determined end of data character sequence.

If you were simply sending text it could/would be CRLF.
 
I’d also recommend using serial. If the message is always the same data type, you could you a library like EasyTransfer if you don’t feel like writing code to parse the received bytes into the data fields.
 
Thanks @BriComp, that's helpful! Simplicity is good. I guess when using UART, the issue of not having a separate clock signal is mitigated by the fact that the receiving chip is using hardware features and not just randomly timed software serial?
 
I’d also recommend using serial. If the message is always the same data type, you could you a library like EasyTransfer if you don’t feel like writing code to parse the received bytes into the data fields.


Thanks Paul, I'll check out EasyTransfer!
 
I haven't got any experience with SPI, but I would use simple UART serial.

It's already done for you and would be so simple to get going.

If you want handshaking then rts/cts is available to you, but I can't imagine why you would.

Just invent a character sequence which indicates the start of a data packet and either send or have a pre-determined data length or a pre-determined end of data character sequence.

If you were simply sending text it could/would be CRLF.

IIRC on the Teensy 4.0 you only have 2 CTS pins, both of which are inconvenient locations. Teensy 4.1 has a 3rd CTS pin, also in an inconvenient location:
  • Pin 19 on Teensy 4.0/4.1 is CTS3. Unfortunately, pin 19 is the SCL pin for the main I2C bus;
  • Pin 35 on Teensy 4.0 and pin 43 on Teensy 4.1 is CTS5. Unfortunately this pin in the middle of the pins for the micro SD card reader; (and)
  • Pin 50 on Teensy 4.1 is CTS8. Unfortunately this pin is used for the two flash/PSRAM pads underneath the Teensy.
 
Status
Not open for further replies.
Back
Top