From 3347bc6bdee17270c6716a4e70edca235401fe03 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Fri, 21 Jul 2023 18:12:48 +1000 Subject: [PATCH] I2C testing --- source/Core/BSP/Miniware/Setup.cpp | 4 ++-- source/Core/BSP/Miniware/stm32f1xx_hal_msp.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/Core/BSP/Miniware/Setup.cpp b/source/Core/BSP/Miniware/Setup.cpp index 21e7dda6..ec9b9091 100644 --- a/source/Core/BSP/Miniware/Setup.cpp +++ b/source/Core/BSP/Miniware/Setup.cpp @@ -280,9 +280,9 @@ static void MX_ADC2_Init(void) { /* I2C1 init function */ static void MX_I2C1_Init(void) { hi2c1.Instance = I2C1; - hi2c1.Init.ClockSpeed = 150000; + hi2c1.Init.ClockSpeed = 80000; // OLED doesnt handle >100k when its asleep (off). - hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2; + hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_16_9; hi2c1.Init.OwnAddress1 = 0; hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; diff --git a/source/Core/BSP/Miniware/stm32f1xx_hal_msp.c b/source/Core/BSP/Miniware/stm32f1xx_hal_msp.c index b3b6007d..e8f23a1f 100644 --- a/source/Core/BSP/Miniware/stm32f1xx_hal_msp.c +++ b/source/Core/BSP/Miniware/stm32f1xx_hal_msp.c @@ -91,7 +91,7 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c) { GPIO_InitStruct.Pin = SCL_Pin | SDA_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; GPIO_InitStruct.Pull = GPIO_PULLUP; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(SCL_GPIO_Port, &GPIO_InitStruct); /* Peripheral clock enable */