Link 5 teensy 3.1 with 2.4 mhz I2C

Status
Not open for further replies.

esapode688

Well-known member
I just noticed that teensy 3.1 supports I2C speed till 2.4 mhz.
This could be a great solution for my project but i'm wondering if it will work.

Let's say: i have 5 different pcbs equipped with teensy 3.1 and I want to link them in a daisy chain with I2C running at 2.4 mhz.

The distance between the first and the last board is approxximately 2 meters.

Lets say that the first board has got an ethernet module to send osc data to a computer.
The second and third board will constantly poll the distance value from 12 hcsr04 ultrasonic range finders (each board) and the 4th board is an led controller to run 678 rgb leds (dmx controlled over osc)


Will the system work without latency?

Will I2C hang or become unstable like i experienced in another thread?

Do i need to use cat5 cables between the boards?

What pullup resistors should i use?

(I don't have an oscilloscope; that's why i ask.)

Any experiences?
 
I2C for 2m is iff'y. If you know what you're doing with respect to cable capacitance, grounding, RF-like transmission in this situation, you can likely make it work.
Latency wouldn't be affected.

Lacking a 'scope, I think you need to research and duplicate a solution that worked well, where "well" means the bit error rate was measured and was good (say, better than 1 in 10^6 or better, bit errors)
 
The combination of 2.4MHz over 2m and no availability of an Oscilloscope makes this guesswork.
In my lighting systems use a Teensy 3.0 and 5 of my I2C controlled LED drivers over about 14ft of CAT5 cable at 1MHz

That works because I use I2C bus extenders (PCA9600).

I think this could be made work but would likely take some experimentation with the I2C bus frequency and you'd need a cheap oscilloscope so you can see at what frequency you get problems with signal integrity.

Another approach could be to use the bus extenders ( I have a tested and bread board ready layout at OSH park) and run the bus at 1MHz ( spec limit for the PCA9600). Also, the Teensy 3.1 has two I2C busses and you could run these in parallel. When you lay out your boards I'd recommend using RJ45 sockets and CAT5 cable with plugs. This avoids wiring mistakes ;-)
 
Usually RS485 is best for long wires. Teensy has Serail1.transmitterEnable() to automatically control the DE/RE pin on RS-485 chips, which should make this easier.

Of course, this does mean adding a 8-pin RS485 chip to each Teensy, which is a bit more complex than just connecting all the SDA, SCL and GND pins, and adding 2 pullup resistors somewhere. But RS-485 gives you the ability to work with very long wires easily and reliably.
 
Thank you for the help.

I thought about rs485 but it takes to long for me to implement and the distance is not so significant to require it.


I lack of a scope but...
If i can afford something like the bus pirate; do you think it will be able to help me diagnose the bus at that speed?
 
I doubt that a system on 2m of CAT5 cable with 5 I2C devices on the bus will be able to run the I2C bus anywhere close to 2.4MHz. 400KHz probably, 600KHz maybe...

If you want to stick with I2C then I'd really recommend using a bus buffer like the PCA9600. You'd need 5, one for each Teensy. It is FM+ compatible so can run at up to 1 MHz and more. I've actually tested it on 5m of Cat5 cable with 5 I2C devices at 1.5 MHz and signals still looked crisp on the oscilloscope. I was very hesitant the first time using it. In retrospect is is very easy to use.
If you are spinning your own boards I can post an Eagle schematic and board that I know works.

The image below shows the easiest configuration for the PCA9600 ( only one of the two i2c signals for clarity). The left side of it has a micro connected and on the right side there are two FM+ compatible devices that don't need the PCA9600 buffer. You'd need the left side for each Teensy. That only costs a little board space (the PCA9600 is available in TSSOP8 and that is tiny!!) and maybe $3 in components per Teensy.
image.jpg
 
Last edited:
I doubt that a system on 2m of CAT5 cable with 5 I2C devices on the bus will be able to run the I2C bus anywhere close to 2.4MHz. 400KHz probably, 600KHz maybe...

If you want to stick with I2C then I'd really recommend using a bus buffer like the PCA9600. You'd need 5, one for each Teensy. It is FM+ compatible so can run at up to 1 MHz and more. I've actually tested it on 5m of Cat5 cable with 5 I2C devices at 1.5 MHz and signals still looked crisp on the oscilloscope. I was very hesitant the first time using it. In retrospect is is very easy to use.
If you are spinning your own boards I can post an Eagle schematic and board that I know works.

The image below shows the easiest configuration for the PCA9600 ( only one of the two i2c signals for clarity). The left side of it has a micro connected and on the right side there are two FM+ compatible devices that don't need the PCA9600 buffer. You'd need the left side for each Teensy. That only costs a little board space (the PCA9600 is available in TSSOP8 and that is tiny!!) and maybe $3 in components per Teensy.
View attachment 2586


Hi yeah that would help.


what do you mean with spinning your own boards?

I'm designing my own custom boards if it is what you are meaning....
 
I lack of a scope but...
If i can afford something like the bus pirate; do you think it will be able to help me diagnose the bus at that speed?

No, the bus pirate or other logic analyzers won't show you the analog problems.

Even the most expensive Agilent or Lecroy oscilloscope won't magically make things run faster. They can show you how terrible the waveforms are, so you'll be able to see how marginal things look when it's "working" at the upper range of whatever data rate your cable can support.

Even without any scope, you can at least get it working at low speed (a critically important first step), then try fiddling with higher speeds and lower value pullup resistors.
 
Eagle I2C bus buffer PCA9600

Attached are the zipped Eagle files for a little breadboard able I2C bus buffer. This runs the Teensy at 3.3V and the buffered I2C bus at 5V to get a good balance between noise-to-signal ratio and signal rise times. This is recommended either in the spec sheet for the PCA9600 or in an Application Note for the PCA9600 (don't exactly remember where ;-)
 

Attachments

  • PCA9600_I2C_Buffer_Module.zip
    15.7 KB · Views: 218
Last edited:
Even without any scope, you can at least get it working at low speed (a critically important first step), then try fiddling with higher speeds and lower value pullup resistors.

Thanks Paul; I have a similar system working at 400khz over 1.5 meters. And its Actually Working quite well :D

Attached are the zipped Eagle files for a little breadboard able I2C bus buffer. This runs the Teensy at 3.3V and the buffered I2C bus at 5V to get a good balance between noise-to-signal ratio and signal rise times. This is recommended either in the spec sheet for the PCA9600 or in an Application Note for the PCA9600 (don't exactly remember where ;-)

Thanks a lot; I'll integrate them in my design and I give you credit of Course ;)


Would it actually help if I reduce the link lenght to 40 cm by using the second I2C port on each teensy to talk to the next one?
 
From a signal standpoint quality standpoint, yes.
The software would be a lot more complicated though as you'd loose the significant advantage of a bus system.
 
Status
Not open for further replies.
Back
Top