XIAO SAMD21 I2C 400kHz speed

Hi,
I’m using XIAO SAMD21. So far I2C speed is 100kHz. I want to increase it to 400kHz by

Wire.begin();
Wire.setClock(frequency);

but it did not change the speed.
Does anybody know an another solution ?
Thanks
Hubert

Wire.setClock(400000); 

didn’t work?

What method did you use to check?

thanks for reply. I investigated a little bit more now. 400kHz work at the begining, but a a certin time it swiches back to 100kHz. I’m using varius I2C devices (EEPROM, PCF8574, BMP280). I need to check now when this happens. (I’m using logic analyser)

The library of the connected device may have changed the clock frequency.

1 Like

Hi there,

So they max is 100K , check the data-sheet for this device.

HTH
GL :slight_smile: PJ :v:

2 Likes

ok, you are right :wink:

Hi there,

Yea, the DATA-sheet is the go to when stuff goes wacky…
Mark the answer post as the solution so others can find it also. :+1:

GL :slight_smile: PJ :v:

ok,but thats only partly the solution. The question was why does


wire.setClock(400000L);

not change the I2C clock? It changes it but the reason why I can’t see it was that in the PCF8574 lib which I’using the wire.begin() was called again which sets the clock back to 100kHz even if I change it in setup.
Without this lib it works fine !

LOL, Glad YOU figured it out…

GL :slight_smile: PJ :v: