Skip to content

Commit

Permalink
fix(PeriphDrivers): Fix MAX32690 I2C Recovery Failures for TQFN Packa…
Browse files Browse the repository at this point in the history
…ge (#1065)
  • Loading branch information
Jake-Carter authored Jul 8, 2024
1 parent e8a069c commit 7179aa4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Libraries/Boards/MAX32690/EvKit_V1/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ SRCS += pb.c
SRCS += tft_st7735.c

PROJ_CFLAGS+=-DEXT_FLASH_MX25
# Define "MAX32690GTK_PACKAGE_TQFN", which some drivers use to work around MAX32690 Rev A2 Errata #16:
# https://www.analog.com/media/en/technical-documentation/data-sheets/max32690_a2_errata_rev2.pdf
PROJ_CFLAGS += -DMAX32690GTK_PACKAGE_TQFN

MISC_DRIVERS_DIR ?= $(MAXIM_PATH)/Libraries/MiscDrivers

Expand Down
11 changes: 11 additions & 0 deletions Libraries/PeriphDrivers/Source/I2C/i2c_me18.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,29 @@ int MXC_I2C_Init(mxc_i2c_regs_t *i2c, int masterMode, unsigned int slaveAddr)
*
* See MAX32690 Rev A2 Errata #16:
* https://www.analog.com/media/en/technical-documentation/data-sheets/max32690_a2_errata_rev2.pdf
*
* Additionally, note that the TQFN package does not expose some of the duplicate pins. For this package,
* enabling the un-routed GPIOs has been shown to cause initialization issues with the I2C block.
* To work around this, "MAX32690GTK_PACKAGE_TQFN" can be defined by the build system. The recommend place
* to do it is in the "board.mk" file of the BSP. This will prevent the inaccessible pins from being configured.
*/
if (i2c == MXC_I2C0) {
MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_I2C0);
MXC_GPIO_Config(&gpio_cfg_i2c0);
#ifndef MAX32690GTK_PACKAGE_TQFN
MXC_GPIO_Config(&gpio_cfg_i2c0a);
#endif
} else if (i2c == MXC_I2C1) {
MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_I2C1);
MXC_GPIO_Config(&gpio_cfg_i2c1);
#ifndef MAX32690GTK_PACKAGE_TQFN
MXC_GPIO_Config(&gpio_cfg_i2c1a);
#endif
} else if (i2c == MXC_I2C2) {
MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_I2C2);
#ifndef MAX32690GTK_PACKAGE_TQFN
MXC_GPIO_Config(&gpio_cfg_i2c2);
#endif
MXC_GPIO_Config(&gpio_cfg_i2c2c);
} else {
return E_NO_DEVICE;
Expand Down

0 comments on commit 7179aa4

Please sign in to comment.