Portenta H7 I2C clock speed

Hi all,

Hardware (Portenta H7 Lite, mid carrier) Software (Win11, Arduino IDE 2.3.4, Wire library)

We have working code for I2C communication which as default runs at the I2C clock speed of 100kHz. We want to be able to run at 40kHz, but if we try and use the setClock() function with 40000 it compiles, downloads then the H7 goes into SOS mode, which we have to then double click the reset button to get back from.

The libray documentation doesn’t seem to rule out any particular clock speeds and actually mentions 10kHz, but even this value results in the same SOS issue.

If we compile and run on an UNO, 40kHz works absolutely fine.

Is anyone aware of a way around this or is it a limitation of the Portenta H7? Considering the Portenta models are aimed at the professional market it seems a shame that an UNO can do something it can’t.

Any insight is greatly appreciated.

Mike

1 Like

Unfortunately, it's a limitation of the underlying mbed-os code for the STM32 chip. Only 100000, 400000 and 1000000 are supported. Line 725 will throw an exception for any other value. Given the end-of-life status, this is unlikely to change.

Hi steve9,

Thanks for the quick reply. So it seems that there is no point spending any more time on this and accept the 3 default I2C speeds.

Not really related to the original question but what is going end of life? There doesn’t seem to be anything on the website indicating H7 end of life?

Afraid so.

It's ARM's mbed-os that's going EOL. It underpins a few Arduino boards (inc. the Portenta). Arduino have there own fork of the mbed-os repo that they will continue to patch as necessary, but new features/improvements are unlikely. Arduino are currently working on a transition to another RTOS, Zephyr.