From 9e48d9f2388a82d0b198f31c214b8becd0ecb204 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Thu, 17 Oct 2024 16:13:59 +0300 Subject: [PATCH] fix(spi): Fix P4 SPI Pin definitions Use GPIOs 36 or lower to avoid LDO power issues --- cores/esp32/esp32-hal-spi.c | 2 +- variants/esp32p4/pins_arduino.h | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cores/esp32/esp32-hal-spi.c b/cores/esp32/esp32-hal-spi.c index af3fd7b5f..809283096 100644 --- a/cores/esp32/esp32-hal-spi.c +++ b/cores/esp32/esp32-hal-spi.c @@ -65,7 +65,7 @@ #endif struct spi_struct_t { - spi_dev_t *dev; + volatile spi_dev_t *dev; #if !CONFIG_DISABLE_HAL_LOCKS SemaphoreHandle_t lock; #endif diff --git a/variants/esp32p4/pins_arduino.h b/variants/esp32p4/pins_arduino.h index 980e7bdb5..792146f5c 100644 --- a/variants/esp32p4/pins_arduino.h +++ b/variants/esp32p4/pins_arduino.h @@ -22,10 +22,11 @@ static const uint8_t RX = 38; static const uint8_t SDA = 7; static const uint8_t SCL = 8; -static const uint8_t SS = 27; -static const uint8_t MOSI = 46; -static const uint8_t MISO = 47; -static const uint8_t SCK = 48; +// Use GPIOs 36 or lower on the P4 DevKit to avoid LDO power issues with high numbered GPIOs. +static const uint8_t SS = 26; +static const uint8_t MOSI = 32; +static const uint8_t MISO = 33; +static const uint8_t SCK = 36; static const uint8_t A0 = 16; static const uint8_t A1 = 17;