Skip to content

Commit 2aac3cb

Browse files
committed
Revert I2C timing overrides, reduce scope to module only
1 parent 750037a commit 2aac3cb

File tree

6 files changed

+18
-59
lines changed

6 files changed

+18
-59
lines changed

ports/stm/boards/stm32f746g_discovery/mpconfigboard.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@
5050
#define CPY_CLK_FLASH_LATENCY (FLASH_LATENCY_6)
5151
#define CPY_CLK_USB_USES_AUDIOPLL (1)
5252

53-
// Obtain I2C timing values for F7 and H7 boards from ST CubeMX
54-
#define CPY_I2CFAST_TIMINGR 0x00401959
55-
#define CPY_I2CSTANDARD_TIMINGR 0x00C0EAFF
56-
5753
#define BOARD_HSE_SOURCE (RCC_HSE_BYPASS) // ST boards use the STLink clock signal
5854
#define BOARD_HAS_LOW_SPEED_CRYSTAL (1)
5955

ports/stm/common-hal/busio/I2C.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,24 @@
3333
#include "shared-bindings/microcontroller/__init__.h"
3434
#include "supervisor/shared/translate.h"
3535
#include "common-hal/microcontroller/Pin.h"
36-
#include "clocks.h"
36+
37+
// I2C timing specs for the H7 and F7
38+
// Configured for maximum possible clock settings for the family
39+
#if (CPY_STM32F7)
40+
#ifndef CPY_I2CFAST_TIMINGR
41+
#define CPY_I2CFAST_TIMINGR 0x6000030D
42+
#endif
43+
#ifndef CPY_I2CSTANDARD_TIMINGR
44+
#define CPY_I2CSTANDARD_TIMINGR 0x20404768
45+
#endif
46+
#elif (CPY_STM32H7)
47+
#ifndef CPY_I2CFAST_TIMINGR
48+
#define CPY_I2CFAST_TIMINGR 0x00B03FDB
49+
#endif
50+
#ifndef CPY_I2CSTANDARD_TIMINGR
51+
#define CPY_I2CSTANDARD_TIMINGR 0x307075B1
52+
#endif
53+
#endif
3754

3855
// Arrays use 0 based numbering: I2C1 is stored at index 0
3956
#define MAX_I2C 4

ports/stm/peripherals/clocks.h

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,4 @@
2424
* THE SOFTWARE.
2525
*/
2626

27-
// F4 Series
28-
#ifdef STM32F401xE
29-
#include "stm32f4/stm32f401xe/clocks.h"
30-
#endif
31-
#ifdef STM32F411xE
32-
#include "stm32f4/stm32f411xe/clocks.h"
33-
#endif
34-
#ifdef STM32F412Zx
35-
#include "stm32f4/stm32f412zx/clocks.h"
36-
#endif
37-
#ifdef STM32F405xx
38-
#include "stm32f4/stm32f405xx/clocks.h"
39-
#endif
40-
#ifdef STM32F407xx
41-
#include "stm32f4/stm32f407xx/clocks.h"
42-
#endif
43-
44-
// F7 Series
45-
#ifdef STM32F746xx
46-
#include "stm32f7/stm32f746xx/clocks.h"
47-
#endif
48-
#ifdef STM32F767xx
49-
#include "stm32f7/stm32f767xx/clocks.h"
50-
#endif
51-
52-
// H7 Series
53-
#ifdef STM32H743xx
54-
#include "stm32h7/stm32h743xx/clocks.h"
55-
#endif
56-
5727
void stm32_peripherals_clocks_init(void);

ports/stm/peripherals/stm32f7/stm32f746xx/clocks.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,3 @@
6161
#ifndef BOARD_HSE_SOURCE
6262
#define BOARD_HSE_SOURCE (RCC_HSE_ON)
6363
#endif
64-
65-
// Obtain I2C timing values for F7 and H7 boards from ST CubeMX
66-
#ifndef CPY_I2CFAST_TIMINGR
67-
#define CPY_I2CFAST_TIMINGR 0x6000030D
68-
#endif
69-
#ifndef CPY_I2CSTANDARD_TIMINGR
70-
#define CPY_I2CSTANDARD_TIMINGR 0x20404768
71-
#endif

ports/stm/peripherals/stm32f7/stm32f767xx/clocks.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,3 @@
6161
#ifndef BOARD_HSE_SOURCE
6262
#define BOARD_HSE_SOURCE (RCC_HSE_ON)
6363
#endif
64-
65-
// Obtain I2C timing values for F7 and H7 boards from ST CubeMX
66-
#ifndef CPY_I2CFAST_TIMINGR
67-
#define CPY_I2CFAST_TIMINGR 0x6000030D
68-
#endif
69-
#ifndef CPY_I2CSTANDARD_TIMINGR
70-
#define CPY_I2CSTANDARD_TIMINGR 0x20404768
71-
#endif

ports/stm/peripherals/stm32h7/stm32h743xx/clocks.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,3 @@
6868
#ifndef BOARD_HSE_SOURCE
6969
#define BOARD_HSE_SOURCE (RCC_HSE_ON)
7070
#endif
71-
72-
// Obtain I2C timing values for F7 and H7 boards from ST CubeMX
73-
#ifndef CPY_I2CFAST_TIMINGR
74-
#define CPY_I2CFAST_TIMINGR 0x00B03FDB
75-
#endif
76-
#ifndef CPY_I2CSTANDARD_TIMINGR
77-
#define CPY_I2CSTANDARD_TIMINGR 0x307075B1
78-
#endif

0 commit comments

Comments
 (0)