TWI (I2C) Between Teensy 3.6 and ATMEGA328P (Uno) Max Speed

Status
Not open for further replies.

dzalf

Member
Dear Teensy-ners

I am working on an instrumentation project where a Teensy 3.6 acting as Master Unit controls and communicates with a bunch (up to 10 at the moment) of ATMEGA328P MCUs (loaded with the Arduino Uno bootloader) which act as slave boards.

Each slave board is in charge of continuously reading and processing the signal from a group of sensors and send the values upon Master's request via the I2C bus.

So far, I've ran some tests setting
Code:
Wire.setClock(FAST);
where
Code:
FAST = 400000
on both Master and Slave units and they can write and read data bidirectionally without problems (more on that later)

My questions involve the maximum achievable speed for my current scenario.

I am well aware that I might be limited by the slowest device in the bus, ergo, the ATMEGA328P as the datasheet indicates that it can work at MAX 400 kHz.

Here my specific questions:

1. Is there any chance of increasing this speed? being that is the Master the one that sets the CLK for the bus to work.

I've noticed that clocking the _T3.6 at 256 MHz and requesting data from the slaves has a higher fail rate than when clocking the _T3.6 at 120 MHz. The fail is in the form of getting nan of ovf sometimes when requesting data too fast.

2. What is the safe spot in terms of the system clock for a reliable I2C clock source? Should I assume "the lower, the better"?

The reason for wanting a higher clock is that the Master will be doing other stuff, like driving an SPI OLED, reading a Rotary Encoder, a Matrix Keayboard, driving a DAC and sending data over USB.

Thank you for your kind feedback and stay safe

Cheers

dzalf
 
Status
Not open for further replies.
Back
Top