I'm using Arduino DUE to read data from an IMU(inertial measurement unit) sensor (MIKROE-1577, MPU-6000)
This IMU sensor supports both Serial Peripheral Interface (SPI) and Two-Wire Interface (TWI, I²C). According to the datasheet,
- 400kHz Fast Mode I2C for communicating with all registers
- 1MHz SPI serial interface for communicating with all registers (MPU-6000 only)
- 20MHz SPI serial interface for reading sensor and interrupt registers (MPU-6000 only)
Note that the Arduino DUE can set the SPI clock using setClockDivider() and I generated 1MHz, 4MHz, 8MHz clock frequency.
My situation; I have to make a long wire to place this IMU sensor on a table.
I prefer to use SPI because it is faster than TWI.
But if I set the SPI clock frequency to 4 MHz or 8 MHz, I noticed that the SPI signals become a sawtooth wave, not like a pulse wave, if the wire gets longer.
I really want to read the IMU data with an SPI clock of 8 MHz. How can I calculate the wires' length, which doesn't distort the waveform strongly, if I want to set the SPI clock frequency to 8 MHz?
Also, in contrast, if I choose the 400kHz Fast Mode I2C, how long can I extend the wires?