Skip to content

Commit 751191c

Browse files
committed
ports: analog: Fix pin issues for MAX32650 & MAX32665
- Add MCU-specific includes in peripherals/pins.h for MAX32650 & MAX32665 - Fix some issues with SPI pins not matching the datasheet / MSDK for MAX32650 / MAX32665 Signed-off-by: Brandon-Hurst <brandon.hurst97@gmail.com>
1 parent 866e5e5 commit 751191c

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

ports/analog/peripherals/max32650/max32_spi.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515

1616
const mxc_gpio_cfg_t spi_maps[NUM_SPI] = {
1717
// SPI0
18-
{ MXC_GPIO2, (MXC_GPIO_PIN_27 | MXC_GPIO_PIN_28 | MXC_GPIO_PIN_29),
19-
MXC_GPIO_FUNC_ALT2, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 },
18+
// NOTE: SPI0 CS not enabled automatically
19+
{ MXC_GPIO3, (MXC_GPIO_PIN_1 | MXC_GPIO_PIN_2 | MXC_GPIO_PIN_3),
20+
MXC_GPIO_FUNC_ALT1, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 },
2021
// SPI1
2122
{ MXC_GPIO1, (MXC_GPIO_PIN_26 | MXC_GPIO_PIN_28 | MXC_GPIO_PIN_29),
2223
MXC_GPIO_FUNC_ALT1, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 },
@@ -26,9 +27,6 @@ const mxc_gpio_cfg_t spi_maps[NUM_SPI] = {
2627
// SPI3
2728
{ MXC_GPIO0, (MXC_GPIO_PIN_16 | MXC_GPIO_PIN_20 | MXC_GPIO_PIN_21),
2829
MXC_GPIO_FUNC_ALT1, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 },
29-
// SPI4
30-
{ MXC_GPIO1, (MXC_GPIO_PIN_1 | MXC_GPIO_PIN_2 | MXC_GPIO_PIN_3),
31-
MXC_GPIO_FUNC_ALT1, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 },
3230
};
3331

3432
int pinsToSpi(const mcu_pin_obj_t *mosi, const mcu_pin_obj_t *miso,

ports/analog/peripherals/max32665/max32_spi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
#include "py/runtime.h"
1414
#include "py/mperrno.h"
1515

16-
// Assuming the use of MAP_A in MSDK, since all documentation
16+
// Assuming the use of MAP_A in MSDK, since all documentation
1717
// states the GPIO maps are the same
1818

1919
const mxc_gpio_cfg_t spi_maps[NUM_SPI] = {
2020
// SPI0A
2121
{ MXC_GPIO1,
22-
(MXC_GPIO_PIN_9 | MXC_GPIO_PIN_10 | MXC_GPIO_PIN_11, MXC_GPIO_PIN_12, MXC_GPIO_PIN_13),
22+
(MXC_GPIO_PIN_9 | MXC_GPIO_PIN_10 | MXC_GPIO_PIN_11 | MXC_GPIO_PIN_12 | MXC_GPIO_PIN_13),
2323
MXC_GPIO_FUNC_ALT1, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 },
2424
// SPI1
2525
{ MXC_GPIO0,
26-
(MXC_GPIO_PIN_17 | MXC_GPIO_PIN_18 | MXC_GPIO_PIN_19, MXC_GPIO_PIN_20, MXC_GPIO_PIN_21),
26+
(MXC_GPIO_PIN_17 | MXC_GPIO_PIN_18 | MXC_GPIO_PIN_19 | MXC_GPIO_PIN_20 | MXC_GPIO_PIN_21),
2727
MXC_GPIO_FUNC_ALT2, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 },
2828
// SPI2
2929
{ MXC_GPIO0,

ports/analog/peripherals/pins.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ extern const mp_obj_type_t mcu_pin_type;
3131
// for non-connected pins
3232
#define NO_PIN 0xFF
3333

34-
#ifdef MAX32690
34+
#if defined(MAX32690)
3535
#include "max32690/pins.h"
36+
#elif defined(MAX32650)
37+
#include "max32650/pins.h"
38+
#elif defined(MAX32665)
39+
#include "max32665/pins.h"
3640
#endif

0 commit comments

Comments
 (0)