MKR WiFi 1010 IoT Cloud & I2C Question...

Hi Arduino Experts!

I have a question regarding the I2C Speed Modes on my MKR WiFi 1010.
I would like to connect the BeeCounter Module (developed by Thorsten Gurzan - https://beelogger.de/?page_id=37) to my MKR WiFi 1010 and later to my MKR GSM 1400 Arduinos. I powered the BeeCounter Module with a extra 3,3V Breadboard Power Supply and interconnect the GND from the MKR and the BeeCounter (common GND). A MCP23017 GPIO Multiplexer is the main part on the BeeCounter Module. The I2C Bus is used for the communication with the MKR WiFi 1010 Board. See the attached picture below.

The I2C was used in 100kHz Mode and all works great. I simulate a Bee and the Serial Monitor shows me what sensor was triggered and counts the Bees (Bienen in German) correct!
(I tested with sensor 1, 2 and 3)
10 00 00 00 00 00 00 00 — BienenIn: 1 BienenOut: -1
00 00 00 00 00 00 00 00 — BienenIn: 1 BienenOut: -1
00 10 00 00 00 00 00 00 — BienenIn: 2 BienenOut: -1
00 00 00 00 00 00 00 00 — BienenIn: 2 BienenOut: -1
00 00 10 00 00 00 00 00 — BienenIn: 3 BienenOut: -1
00 00 00 00 00 00 00 00 — BienenIn: 3 BienenOut: -1

But when I activate the Arduino IoT Cloud with this command
void loop() {
ArduinoCloud.update();
….
I will run into a strange Problem. The I2C Bus was now operated with 1MHz and the MCP23017 response with nonsense. When I trigger the Sensor 1, 2 and 3 again, I got this output:
10 10 10 10 10 10 10 10 — BienenIn: 8 BienenOut: -1
00 00 00 00 00 00 00 00 — BienenIn: 8 BienenOut: -1
10 10 10 10 10 10 10 10 — BienenIn: 16 BienenOut: -1
00 00 00 00 00 00 00 00 — BienenIn: 16 BienenOut: -1
10 10 10 10 10 10 10 10 — BienenIn: 24 BienenOut: -1
00 00 00 00 00 00 00 00 — BienenIn: 24 BienenOut: -1

On my Scope I see a strange Spike from the MCP23017…

The MCP23017 Datasheet explains that the Speeds 100 kHz, 400 kHz and 1.7 MHz are supported.
The D21G18 Microcontroller from the MKR supports 100 kHz, 400 kHz, 1 MHz and 3.4 MHz.

So, I expect the MCP23017 does just not work with a 1MHz SCL Clock Rate, right?
Why was the MKR I2C Bus clocked with 1MHz when activating ArduinoCloud.update();?
Is it possible to use IoT but with 100KHz I2C Speed?

All help is welcome!
Thanks a lot Andreas

PS: I have also appended the Sketch - BeeCounter Sketch.txt

BeeCounter Sketch.txt (4.09 KB)

I have figured out that the ECC508 Chip can only use 1MHz I2C Speed. I expect that this is the reason for switching the SCL Clock - ECC was needed for the secure IoT Traffic.

Is there a chance to reduce the clock speed?

Thanks Andreas

Confused now: Previously I have the MKR Env Shield in use and the MKR WiFi 1010 was connected to the IoT Cloud. This works and the various sensors from the ENV Shield do also not support a 1MHz SCL Clock :expressionless: But it worked great.

What’s going on here - does the ECC Chip support 100 or 400 KHz?
Can the I2C Speed adapted by the Master to be compatible to different Slave ICs?

Has anybody any Info’s for me?

[u]New Status: Have found a workaround![/u]

I have tested again with the MKR Environment Module, remember the various sensors from the ENV Shield supports also only 100 & 400 KHz I2C clock speeds. But the Sensors work also with 1MHz and therefore I had no problems when activating the IoT Cloud communication.

But the MCP23017 I2C Multiplexer Chip from my BeeCounter Module has definitively a problem with the 1MHz Clock. So, the workaround is to reduce the Arduino MKR WiFi 1010 I2C (SCL) clock speed to 400KHz by using this command...

void loop() { ArduinoCloud.update(); Wire.setClock(400000); ...

I will dig deeper to find the reason why the Command ArduinoCloud.update(); will raise up the I2C Clock Speed to 1MHz frequency...

Have a nice day Andreas