Description
Describe the bug
The speed for the I2C5 peripheral is always ~16.8kHz and not the expected 100kHz on the Nucleo-H723ZG board and possibly other H7 variants. It does not change for different values of Wire.setClock(values)
. The other I2C peripherals behave as expected.
To Reproduce
Minimal reproducible example code:
#include <Wire.h>
void setup() {
// set Wire to Pins associated with I2C5:
Wire.setSDA(PC_10);
Wire.setSCL(PC_11);
Wire.begin();
Wire.setClock(100000);
// send any I2C message
Wire.beginTransmission(0x24);
Wire.write(0);
Wire.endTransmission();
}
void loop() {
}
Results in ~16.8kHz on SCL Pin PC11 (see image)
Expected behavior
Expect 100kHz clock speed.
Screenshots
Measurement of Pin PC 10 (red) and PC11 (brown):
Clock speed around 16.8kHz.
Desktop (please complete the following information):
- OS: Windows 11
- Arduino IDE version: 2.3.3
- STM32 core version: 2.81
- Tools menu settings: default
- Upload method: Mass storage
Board (please complete the following information):
- Name: Nucleo-H723ZG
- Hardware Revision: Rev E01
- Extra hardware: no
Additional context
I think that the issue is in the i2c_getClkFreq(I2C_TypeDef *i2c)
function. I single stepped the code and this snipped always returns 0 for the I2C5 peripheral clock frequency clkSrcFreq
:
Arduino_Core_STM32/libraries/Wire/src/utility/twi.c
Lines 415 to 424 in 42e0262
For the working I2C1 Peripheral with the same clock source there is handling for that case:
Arduino_Core_STM32/libraries/Wire/src/utility/twi.c
Lines 207 to 254 in 42e0262
Metadata
Metadata
Assignees
Labels
Type
Projects
Status