Skip to content

Commit

Permalink
Fix MAX32657 SPI pin initialization
Browse files Browse the repository at this point in the history
Use correct pin numbers when initializing SPI on MAX32657.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
  • Loading branch information
ttmut committed Dec 12, 2024
1 parent eeb59b5 commit cd9e926
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions Libraries/PeriphDrivers/Source/SPI/spi_me30.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,30 +88,20 @@ int MXC_SPI_Init(mxc_spi_regs_t *spi, int masterMode, int quadModeUsed, int numS
//clear mask
gpio_cfg_spi.mask = 0;

// TODO(ME30): Validate pin assignments
// check rest of the pins
if (pins.clock) {
gpio_cfg_spi.mask |= MXC_GPIO_PIN_23;
gpio_cfg_spi.mask |= MXC_GPIO_PIN_6;
}

if (pins.miso) {
gpio_cfg_spi.mask |= MXC_GPIO_PIN_22;
gpio_cfg_spi.mask |= MXC_GPIO_PIN_4;
}

if (pins.mosi) {
gpio_cfg_spi.mask |= MXC_GPIO_PIN_21;
}

if (pins.sdio2) {
gpio_cfg_spi.mask |= MXC_GPIO_PIN_24;
}

if (pins.sdio3) {
gpio_cfg_spi.mask |= MXC_GPIO_PIN_25;
gpio_cfg_spi.mask |= MXC_GPIO_PIN_2;
}

if (pins.ss0) {
gpio_cfg_spi.mask |= MXC_GPIO_PIN_20;
gpio_cfg_spi.mask |= MXC_GPIO_PIN_3;
}

gpio_cfg_spi.func = MXC_GPIO_FUNC_ALT1;
Expand Down

0 comments on commit cd9e926

Please sign in to comment.