stm32/i2c: Add H7 I2C timing configurations.

Found the timing for full (400 KHz) and FM+ (1MHz) in the HAL examples, and
used CubeMX to calculate the standard value (100KHz).
This commit is contained in:
iabdalkader 2018-03-19 15:09:00 +02:00 committed by Damien George
parent 2ebc538d63
commit 24a9facd89
1 changed files with 13 additions and 2 deletions

View File

@ -131,9 +131,9 @@ const pyb_i2c_obj_t pyb_i2c_obj[] = {
#endif
};
#if defined(STM32F7) || defined(STM32L4)
#if defined(STM32F7) || defined(STM32L4) || defined(STM32H7)
// The STM32F0, F3, F7 and L4 use a TIMINGR register rather than ClockSpeed and
// The STM32F0, F3, F7, H7 and L4 use a TIMINGR register rather than ClockSpeed and
// DutyCycle.
#if defined(STM32F746xx)
@ -161,6 +161,17 @@ const pyb_i2c_obj_t pyb_i2c_obj[] = {
#define MICROPY_HW_I2C_BAUDRATE_DEFAULT (PYB_I2C_SPEED_FULL)
#define MICROPY_HW_I2C_BAUDRATE_MAX (PYB_I2C_SPEED_FAST)
#elif defined(STM32H7)
// I2C TIMINGs obtained from the STHAL examples.
#define MICROPY_HW_I2C_BAUDRATE_TIMING { \
{PYB_I2C_SPEED_STANDARD, 0x40604E73}, \
{PYB_I2C_SPEED_FULL, 0x00901954}, \
{PYB_I2C_SPEED_FAST, 0x10810915}, \
}
#define MICROPY_HW_I2C_BAUDRATE_DEFAULT (PYB_I2C_SPEED_FULL)
#define MICROPY_HW_I2C_BAUDRATE_MAX (PYB_I2C_SPEED_FAST)
#elif defined(STM32L4)
// The value 0x90112626 was obtained from the DISCOVERY_I2C1_TIMING constant