I have managed to slow down the I2C bus but only by editing setClock(100000); to setClock(20000) in TwoWire::begin and hacking
part of TwoWire::setClock as follows:
If I don't change the value in TwoWire::begin but try using Wire.setClock(20000); it still runs at 100 khz.
Should/does Wire.setClock call TwoWire.setclock? from some Serial.println() debugging it looks like Wire.setclock calls TwoWire::begin and that calls TwoWire.setclock using the value fixed hard coded value in TwoWire::begin.
What else do I need to edit other to be able to use Wire.setClock to change the speed after the program starts?
part of TwoWire::setClock as follows:
Code:
#elif F_BUS == 36000000
if (frequency < 30000) {
port().F = 0x3A; // 20 kHz
}
else if (frequency < 400000) {
port().F = 0x28; // 113 kHz
} else if (frequency < 1000000) {
port().F = 0x19; // 375 kHz
} else {
port().F = 0x0A; // 1 MHz
}
port().FLT = 3;
If I don't change the value in TwoWire::begin but try using Wire.setClock(20000); it still runs at 100 khz.
Should/does Wire.setClock call TwoWire.setclock? from some Serial.println() debugging it looks like Wire.setclock calls TwoWire::begin and that calls TwoWire.setclock using the value fixed hard coded value in TwoWire::begin.
What else do I need to edit other to be able to use Wire.setClock to change the speed after the program starts?