Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(PeriphDrivers): Fix MAX32690 I2C Recovery Failures for TQFN Package #1065

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading