link a teensy 4.1 to an arduino mega 2560 R3

Status
Not open for further replies.

snowsh

Well-known member
I want to link a teensy 4.1 to an arduino mega 2560 R3.

What is the best way to hook these two together to exchange data? Serial? a parallel bus? SPI etc? Are there any libraries available to handle this?

What to do about the 3.3v to 5v and visa versa?
 
You can use serial, the Arduino Mega has 4 serial interfaces. You'll need a level converter for each direction, but at a
pinch you can use a resistive divider 1k:2k2 for 5v->3.3V and just directly connect for 3.3V->5V, since the Arduino will
recognize 3.3V as HIGH.

However a level converter is a safer option.
 
safer to protect the teensy tx pin should you misprogram the mega and shoot 5v down the line. You could always go with a Teensy 3.5 as it is 5v tolerant and will talk fine to mega directly wired with the uarts
 
I keep running into dead ends on this. Im thiking I will be moving midi over the serial lines from the t4.1 to the mega and back. Now I wonder if I go with opto isolators as you would with a midi input. Or is there a good IC anyone can reccommend to handle this?
 
I want to link a teensy 4.1 to an arduino mega 2560 R3.

What is the best way to hook these two together to exchange data? Serial? a parallel bus? SPI etc? Are there any libraries available to handle this?

What to do about the 3.3v to 5v and visa versa?

That depends on several factors: How much data do you plan to transfer and how fast do you need it to happen? Over what distance? Are they gonna be powered from the same power rail?

Unless you're gonna be sending a good amount of data (say beyond 100kbps), I'd go with Serial due to the dead simple wiring and buffered tx/rx queues, so you don't have to implement that yourself (Paul also seems to share of the same advice).

Level shifting from 5v to 3.3v with a resistor divider works for slower speeds, say < 38400 baud. On my devices for serial communications over a couple of meters at 115200 I've been using 74HCT245s but I reckon you could even go with something simpler such as a mosfet shifter.

As to what concerns a messaging protocol, again that depends on your needs. If you need something with a proper message queue, framing, checksumming etc you might want to look at TinyProto as well as this thread.
 
Level shifting from 5v to 3.3v with a resistor divider works for slower speeds, say < 38400 baud. On my devices for serial communications over a couple of meters at 115200 I've been using 74HCT245s

I stand corrected -- I've been using 74HCT245s to bump 3.3v up to 5v, not the other way around. For down converting you'll be looking at 74LV parts such as a 74LVC125 or a 74LVC245.
 
Status
Not open for further replies.
Back
Top