You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/10/07 14:52:15 UTC

[incubator-nuttx] branch master updated (caa945c -> d1225f3)

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from caa945c  arch/xtensa/src/esp32: Add a way to retrieve reset cause.
     new efb2fd5  arch/xtensa/src/esp32/esp32_gpio.c: GPIO20 is not available.
     new 564237a  arch/xtensa/src/esp32/esp32_gpio: Function "SPECIAL" doesn't exist.  All pads go through the same GPIO matrix to select one of the 6 possible functions.
     new 5593683  arch/xtensa/src/esp32/esp32_gpio.c: When configuring a pin pad, set the function first, if no function was assigned, fall back to the GPIO function.
     new d1225f3  arch/xtensa/src/esp32: Use the same function numbering as the TRM.

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/xtensa/src/esp32/esp32_emac.c      | 18 +++++++++---------
 arch/xtensa/src/esp32/esp32_gpio.c      | 20 +++++++++-----------
 arch/xtensa/src/esp32/esp32_gpio.h      | 17 ++++++++---------
 arch/xtensa/src/esp32/esp32_i2c.c       |  4 ++--
 arch/xtensa/src/esp32/esp32_serial.c    |  8 ++++----
 arch/xtensa/src/esp32/esp32_spi.c       | 16 ++++++++--------
 arch/xtensa/src/esp32/esp32_spi_slave.c | 16 ++++++++--------
 7 files changed, 48 insertions(+), 51 deletions(-)


[incubator-nuttx] 03/04: arch/xtensa/src/esp32/esp32_gpio.c: When configuring a pin pad, set the function first, if no function was assigned, fall back to the GPIO function.

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 5593683552720bbeec0c6f04830da6295cae6520
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Mon Oct 5 11:31:41 2020 +0100

    arch/xtensa/src/esp32/esp32_gpio.c: When configuring a pin pad, set the
    function first, if no function was assigned, fall back to the GPIO
    function.
    
    Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
 arch/xtensa/src/esp32/esp32_gpio.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/xtensa/src/esp32/esp32_gpio.c b/arch/xtensa/src/esp32/esp32_gpio.c
index c881737..af15119 100644
--- a/arch/xtensa/src/esp32/esp32_gpio.c
+++ b/arch/xtensa/src/esp32/esp32_gpio.c
@@ -161,7 +161,6 @@ int esp32_configgpio(int pin, gpio_pinattr_t attr)
   uintptr_t regaddr;
   uint32_t func;
   uint32_t cntrl;
-  unsigned int pinmode;
 
   DEBUGASSERT(pin >= 0 && pin <= ESP32_NGPIOS);
 
@@ -213,14 +212,17 @@ int esp32_configgpio(int pin, gpio_pinattr_t attr)
 
   func |= FUN_IE;
 
-  pinmode = (attr & PINMODE_MASK);
-  if (pinmode == INPUT || pinmode == OUTPUT)
+  /* Select the pad's function.  If no function was given, consider it a normal
+   * input or output (i.e. function2).
+   */
+
+  if ((attr & FUNCTION) != 0)
     {
-      func |= (uint32_t)(2 << MCU_SEL_S);
+      func |= (uint32_t)((attr >> FUNCTION_SHIFT) << MCU_SEL_S);
     }
-  else /* if ((attr & FUNCTION) != 0) */
+  else
     {
-      func |= (uint32_t)((attr >> FUNCTION_SHIFT) << MCU_SEL_S);
+      func |= (uint32_t)((2 >> FUNCTION_SHIFT) << MCU_SEL_S);
     }
 
   if ((attr & OPEN_DRAIN) != 0)


[incubator-nuttx] 01/04: arch/xtensa/src/esp32/esp32_gpio.c: GPIO20 is not available.

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit efb2fd5e4b63964cd74f6869061bfe285ec1b281
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Sun Oct 4 00:12:17 2020 +0100

    arch/xtensa/src/esp32/esp32_gpio.c: GPIO20 is not available.
    
    Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
 arch/xtensa/src/esp32/esp32_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/xtensa/src/esp32/esp32_gpio.c b/arch/xtensa/src/esp32/esp32_gpio.c
index 802059e..cfb04cd 100644
--- a/arch/xtensa/src/esp32/esp32_gpio.c
+++ b/arch/xtensa/src/esp32/esp32_gpio.c
@@ -64,7 +64,7 @@ static const uint8_t g_pin2func[40] =
 {
   0x44, 0x88, 0x40, 0x84, 0x48, 0x6c, 0x60, 0x64,  /* 0-7 */
   0x68, 0x54, 0x58, 0x5c, 0x34, 0x38, 0x30, 0x3c,  /* 8-15 */
-  0x4c, 0x50, 0x70, 0x74, 0x78, 0x7c, 0x80, 0x8c,  /* 16-23 */
+  0x4c, 0x50, 0x70, 0x74, _NA_, 0x7c, 0x80, 0x8c,  /* 16-19, N/A, 21-23 */
   _NA_, 0x24, 0x28, 0x2c, _NA_, _NA_, _NA_, _NA_,  /* N/A, 25-27, N/A, N/A, N/A, N/A */
   0x1c, 0x20, 0x14, 0x18, 0x04, 0x08, 0x0c, 0x10   /* 32-39 */
 };


[incubator-nuttx] 02/04: arch/xtensa/src/esp32/esp32_gpio: Function "SPECIAL" doesn't exist. All pads go through the same GPIO matrix to select one of the 6 possible functions.

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 564237a602e1c8cf60bea58c34dcb7a0a15466c8
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Mon Oct 5 10:54:48 2020 +0100

    arch/xtensa/src/esp32/esp32_gpio: Function "SPECIAL" doesn't exist.  All
    pads go through the same GPIO matrix to select one of the 6 possible functions.
    
    Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
 arch/xtensa/src/esp32/esp32_gpio.c | 4 ----
 arch/xtensa/src/esp32/esp32_gpio.h | 1 -
 2 files changed, 5 deletions(-)

diff --git a/arch/xtensa/src/esp32/esp32_gpio.c b/arch/xtensa/src/esp32/esp32_gpio.c
index cfb04cd..c881737 100644
--- a/arch/xtensa/src/esp32/esp32_gpio.c
+++ b/arch/xtensa/src/esp32/esp32_gpio.c
@@ -218,10 +218,6 @@ int esp32_configgpio(int pin, gpio_pinattr_t attr)
     {
       func |= (uint32_t)(2 << MCU_SEL_S);
     }
-  else if ((attr & FUNCTION_MASK) == SPECIAL)
-    {
-      func |= (uint32_t)((((pin) == 1 || (pin) == 3) ? 0 : 1) << MCU_SEL_S);
-    }
   else /* if ((attr & FUNCTION) != 0) */
     {
       func |= (uint32_t)((attr >> FUNCTION_SHIFT) << MCU_SEL_S);
diff --git a/arch/xtensa/src/esp32/esp32_gpio.h b/arch/xtensa/src/esp32/esp32_gpio.h
index fa37949..17c8efb 100644
--- a/arch/xtensa/src/esp32/esp32_gpio.h
+++ b/arch/xtensa/src/esp32/esp32_gpio.h
@@ -66,7 +66,6 @@
 #  define FUNCTION_3        (3 << FUNCTION_SHIFT)
 #  define FUNCTION_4        (4 << FUNCTION_SHIFT)
 #  define FUNCTION_5        (5 << FUNCTION_SHIFT)
-#  define SPECIAL           (7 << FUNCTION_SHIFT)
 
 #define INPUT_PULLUP        (INPUT | PULLUP)
 #define INPUT_PULLDOWN      (INPUT | PULLDOWN)


[incubator-nuttx] 04/04: arch/xtensa/src/esp32: Use the same function numbering as the TRM.

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit d1225f3110b06c2c740357f4f00d8f9a92ef1825
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Mon Oct 5 11:38:06 2020 +0100

    arch/xtensa/src/esp32: Use the same function numbering as the TRM.
    
    Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
 arch/xtensa/src/esp32/esp32_emac.c      | 18 +++++++++---------
 arch/xtensa/src/esp32/esp32_gpio.c      |  4 ++--
 arch/xtensa/src/esp32/esp32_gpio.h      | 16 ++++++++--------
 arch/xtensa/src/esp32/esp32_i2c.c       |  4 ++--
 arch/xtensa/src/esp32/esp32_serial.c    |  8 ++++----
 arch/xtensa/src/esp32/esp32_spi.c       | 16 ++++++++--------
 arch/xtensa/src/esp32/esp32_spi_slave.c | 16 ++++++++--------
 7 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/arch/xtensa/src/esp32/esp32_emac.c b/arch/xtensa/src/esp32/esp32_emac.c
index 11e7bf2..940b940 100644
--- a/arch/xtensa/src/esp32/esp32_emac.c
+++ b/arch/xtensa/src/esp32/esp32_emac.c
@@ -496,20 +496,20 @@ static int emac_read_mac(uint8_t *mac)
 
 static void emac_init_gpio(void)
 {
-  esp32_configgpio(EMAC_TXEN_PIN, OUTPUT_FUNCTION_5);
-  esp32_configgpio(EMAC_TXDO_PIN, OUTPUT_FUNCTION_5);
-  esp32_configgpio(EMAC_TXD1_PIN, OUTPUT_FUNCTION_5);
+  esp32_configgpio(EMAC_TXEN_PIN, OUTPUT_FUNCTION_6);
+  esp32_configgpio(EMAC_TXDO_PIN, OUTPUT_FUNCTION_6);
+  esp32_configgpio(EMAC_TXD1_PIN, OUTPUT_FUNCTION_6);
 
-  esp32_configgpio(EMAC_RXDO_PIN, INPUT_FUNCTION_5);
-  esp32_configgpio(EMAC_RXD1_PIN, INPUT_FUNCTION_5);
-  esp32_configgpio(EMAC_RXDV_PIN, INPUT_FUNCTION_5);
+  esp32_configgpio(EMAC_RXDO_PIN, INPUT_FUNCTION_6);
+  esp32_configgpio(EMAC_RXD1_PIN, INPUT_FUNCTION_6);
+  esp32_configgpio(EMAC_RXDV_PIN, INPUT_FUNCTION_6);
 
-  esp32_configgpio(EMAC_ICLK_PIN, INPUT_FUNCTION_5);
+  esp32_configgpio(EMAC_ICLK_PIN, INPUT_FUNCTION_6);
 
-  esp32_configgpio(EMAC_MDC_PIN, OUTPUT | FUNCTION_2);
+  esp32_configgpio(EMAC_MDC_PIN, OUTPUT | FUNCTION_3);
   gpio_matrix_out(EMAC_MDC_PIN, EMAC_MDC_O_IDX, 0, 0);
 
-  esp32_configgpio(EMAC_MDIO_PIN, OUTPUT | INPUT | FUNCTION_2);
+  esp32_configgpio(EMAC_MDIO_PIN, OUTPUT | INPUT | FUNCTION_3);
   gpio_matrix_out(EMAC_MDIO_PIN, EMAC_MDO_O_IDX, 0, 0);
   gpio_matrix_in(EMAC_MDIO_PIN, EMAC_MDI_I_IDX, 0);
 
diff --git a/arch/xtensa/src/esp32/esp32_gpio.c b/arch/xtensa/src/esp32/esp32_gpio.c
index af15119..7bee9ef 100644
--- a/arch/xtensa/src/esp32/esp32_gpio.c
+++ b/arch/xtensa/src/esp32/esp32_gpio.c
@@ -212,8 +212,8 @@ int esp32_configgpio(int pin, gpio_pinattr_t attr)
 
   func |= FUN_IE;
 
-  /* Select the pad's function.  If no function was given, consider it a normal
-   * input or output (i.e. function2).
+  /* Select the pad's function.  If no function was given, consider it a
+   * normal input or output (i.e. function2).
    */
 
   if ((attr & FUNCTION) != 0)
diff --git a/arch/xtensa/src/esp32/esp32_gpio.h b/arch/xtensa/src/esp32/esp32_gpio.h
index 17c8efb..5a2440d 100644
--- a/arch/xtensa/src/esp32/esp32_gpio.h
+++ b/arch/xtensa/src/esp32/esp32_gpio.h
@@ -60,30 +60,30 @@
 #define OPEN_DRAIN          (1 << 5)
 #define FUNCTION_SHIFT      6
 #define FUNCTION_MASK       (7 << FUNCTION_SHIFT)
-#  define FUNCTION_0        (0 << FUNCTION_SHIFT)
-#  define FUNCTION_1        (1 << FUNCTION_SHIFT)
-#  define FUNCTION_2        (2 << FUNCTION_SHIFT)
-#  define FUNCTION_3        (3 << FUNCTION_SHIFT)
-#  define FUNCTION_4        (4 << FUNCTION_SHIFT)
-#  define FUNCTION_5        (5 << FUNCTION_SHIFT)
+#  define FUNCTION_1        (0 << FUNCTION_SHIFT)
+#  define FUNCTION_2        (1 << FUNCTION_SHIFT)
+#  define FUNCTION_3        (2 << FUNCTION_SHIFT)
+#  define FUNCTION_4        (3 << FUNCTION_SHIFT)
+#  define FUNCTION_5        (4 << FUNCTION_SHIFT)
+#  define FUNCTION_6        (5 << FUNCTION_SHIFT)
 
 #define INPUT_PULLUP        (INPUT | PULLUP)
 #define INPUT_PULLDOWN      (INPUT | PULLDOWN)
 #define OUTPUT_OPEN_DRAIN   (OUTPUT | OPEN_DRAIN)
 #define INPUT_FUNCTION      (INPUT | FUNCTION)
-#  define INPUT_FUNCTION_0  (INPUT_FUNCTION | FUNCTION_0)
 #  define INPUT_FUNCTION_1  (INPUT_FUNCTION | FUNCTION_1)
 #  define INPUT_FUNCTION_2  (INPUT_FUNCTION | FUNCTION_2)
 #  define INPUT_FUNCTION_3  (INPUT_FUNCTION | FUNCTION_3)
 #  define INPUT_FUNCTION_4  (INPUT_FUNCTION | FUNCTION_4)
 #  define INPUT_FUNCTION_5  (INPUT_FUNCTION | FUNCTION_5)
+#  define INPUT_FUNCTION_6  (INPUT_FUNCTION | FUNCTION_6)
 #define OUTPUT_FUNCTION     (OUTPUT | FUNCTION)
-#  define OUTPUT_FUNCTION_0 (OUTPUT_FUNCTION | FUNCTION_0)
 #  define OUTPUT_FUNCTION_1 (OUTPUT_FUNCTION | FUNCTION_1)
 #  define OUTPUT_FUNCTION_2 (OUTPUT_FUNCTION | FUNCTION_2)
 #  define OUTPUT_FUNCTION_3 (OUTPUT_FUNCTION | FUNCTION_3)
 #  define OUTPUT_FUNCTION_4 (OUTPUT_FUNCTION | FUNCTION_4)
 #  define OUTPUT_FUNCTION_5 (OUTPUT_FUNCTION | FUNCTION_5)
+#  define OUTPUT_FUNCTION_6 (OUTPUT_FUNCTION | FUNCTION_6)
 
 /* Interrupt type used with esp32_gpioirqenable() */
 
diff --git a/arch/xtensa/src/esp32/esp32_i2c.c b/arch/xtensa/src/esp32/esp32_i2c.c
index 0ea8e61..0298dff 100644
--- a/arch/xtensa/src/esp32/esp32_i2c.c
+++ b/arch/xtensa/src/esp32/esp32_i2c.c
@@ -504,14 +504,14 @@ static void esp32_i2c_init(FAR struct esp32_i2c_priv_s *priv)
   esp32_gpiowrite(config->scl_pin, 1);
   esp32_gpiowrite(config->sda_pin, 1);
 
-  esp32_configgpio(config->scl_pin, OUTPUT | OPEN_DRAIN | FUNCTION_2);
+  esp32_configgpio(config->scl_pin, OUTPUT | OPEN_DRAIN | FUNCTION_3);
   gpio_matrix_out(config->scl_pin, config->scl_outsig, 0, 0);
   gpio_matrix_in(config->scl_pin, config->scl_insig, 0);
 
   esp32_configgpio(config->sda_pin, INPUT |
                                     OUTPUT |
                                     OPEN_DRAIN |
-                                    FUNCTION_2);
+                                    FUNCTION_3);
   gpio_matrix_out(config->sda_pin, config->sda_outsig, 0, 0);
   gpio_matrix_in(config->sda_pin, config->sda_insig, 0);
 
diff --git a/arch/xtensa/src/esp32/esp32_serial.c b/arch/xtensa/src/esp32/esp32_serial.c
index 30918e9..c53f516 100644
--- a/arch/xtensa/src/esp32/esp32_serial.c
+++ b/arch/xtensa/src/esp32/esp32_serial.c
@@ -528,17 +528,17 @@ static int esp32_setup(struct uart_dev_s *dev)
    * But only one GPIO pad can connect with input signal
    */
 
-  esp32_configgpio(priv->config->txpin, OUTPUT_FUNCTION_2);
+  esp32_configgpio(priv->config->txpin, OUTPUT_FUNCTION_3);
   gpio_matrix_out(priv->config->txpin, priv->config->txsig, 0, 0);
 
-  esp32_configgpio(priv->config->rxpin, INPUT_FUNCTION_2);
+  esp32_configgpio(priv->config->rxpin, INPUT_FUNCTION_3);
   gpio_matrix_in(priv->config->rxpin, priv->config->rxsig, 0);
 
 #if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL)
-  esp32_configgpio(priv->config->rtspin, OUTPUT_FUNCTION_2);
+  esp32_configgpio(priv->config->rtspin, OUTPUT_FUNCTION_3);
   gpio_matrix_out(priv->config->rtspin, priv->config->rtssig, 0, 0);
 
-  esp32_configgpio(priv->config->ctspin, INPUT_FUNCTION_2);
+  esp32_configgpio(priv->config->ctspin, INPUT_FUNCTION_3);
   gpio_matrix_in(priv->config->ctspin, priv->config->ctssig, 0);
 #endif
 
diff --git a/arch/xtensa/src/esp32/esp32_spi.c b/arch/xtensa/src/esp32/esp32_spi.c
index 9704f67..9deb50f 100644
--- a/arch/xtensa/src/esp32/esp32_spi.c
+++ b/arch/xtensa/src/esp32/esp32_spi.c
@@ -1241,32 +1241,32 @@ static void esp32_spi_init(FAR struct spi_dev_s *dev)
   if (esp32_spi_iomux(priv))
     {
 #ifndef CONFIG_ESP32_SPI_SWCS
-      esp32_configgpio(config->cs_pin, OUTPUT_FUNCTION_1);
+      esp32_configgpio(config->cs_pin, OUTPUT_FUNCTION_2);
       gpio_matrix_out(config->cs_pin, SIG_GPIO_OUT_IDX, 0, 0);
 #endif
-      esp32_configgpio(config->mosi_pin, OUTPUT_FUNCTION_1);
+      esp32_configgpio(config->mosi_pin, OUTPUT_FUNCTION_2);
       gpio_matrix_out(config->mosi_pin, SIG_GPIO_OUT_IDX, 0, 0);
 
-      esp32_configgpio(config->miso_pin, INPUT_FUNCTION_1 | PULLUP);
+      esp32_configgpio(config->miso_pin, INPUT_FUNCTION_2 | PULLUP);
       gpio_matrix_out(config->miso_pin, SIG_GPIO_OUT_IDX, 0, 0);
 
-      esp32_configgpio(config->clk_pin, OUTPUT_FUNCTION_1);
+      esp32_configgpio(config->clk_pin, OUTPUT_FUNCTION_2);
       gpio_matrix_out(config->clk_pin, SIG_GPIO_OUT_IDX, 0, 0);
     }
   else
     {
 #ifndef CONFIG_ESP32_SPI_SWCS
-      esp32_configgpio(config->cs_pin, OUTPUT_FUNCTION_2);
+      esp32_configgpio(config->cs_pin, OUTPUT_FUNCTION_3);
       gpio_matrix_out(config->cs_pin, config->cs_outsig, 0, 0);
 #endif
 
-      esp32_configgpio(config->mosi_pin, OUTPUT_FUNCTION_2);
+      esp32_configgpio(config->mosi_pin, OUTPUT_FUNCTION_3);
       gpio_matrix_out(config->mosi_pin, config->mosi_outsig, 0, 0);
 
-      esp32_configgpio(config->miso_pin, INPUT_FUNCTION_2 | PULLUP);
+      esp32_configgpio(config->miso_pin, INPUT_FUNCTION_3 | PULLUP);
       gpio_matrix_in(config->miso_pin, config->miso_insig, 0);
 
-      esp32_configgpio(config->clk_pin, OUTPUT_FUNCTION_2);
+      esp32_configgpio(config->clk_pin, OUTPUT_FUNCTION_3);
       gpio_matrix_out(config->clk_pin, config->clk_outsig, 0, 0);
     }
 
diff --git a/arch/xtensa/src/esp32/esp32_spi_slave.c b/arch/xtensa/src/esp32/esp32_spi_slave.c
index 505aa96..9989aad 100644
--- a/arch/xtensa/src/esp32/esp32_spi_slave.c
+++ b/arch/xtensa/src/esp32/esp32_spi_slave.c
@@ -857,26 +857,26 @@ static void esp32_spislv_initialize(FAR struct spi_sctrlr_s *dev)
 
   if (esp32_spi_iomux(priv))
     {
-      esp32_configgpio(config->cs_pin, INPUT_FUNCTION_1 | PULLUP);
-      esp32_configgpio(config->mosi_pin, INPUT_FUNCTION_1 | PULLUP);
-      esp32_configgpio(config->miso_pin, OUTPUT_FUNCTION_1);
-      esp32_configgpio(config->clk_pin, INPUT_FUNCTION_1 | PULLUP);
+      esp32_configgpio(config->cs_pin, INPUT_FUNCTION_2 | PULLUP);
+      esp32_configgpio(config->mosi_pin, INPUT_FUNCTION_2 | PULLUP);
+      esp32_configgpio(config->miso_pin, OUTPUT_FUNCTION_2);
+      esp32_configgpio(config->clk_pin, INPUT_FUNCTION_2 | PULLUP);
     }
   else
     {
-      esp32_configgpio(config->cs_pin, INPUT_FUNCTION_2 | PULLUP);
+      esp32_configgpio(config->cs_pin, INPUT_FUNCTION_3 | PULLUP);
       gpio_matrix_out(config->cs_pin, config->cs_outsig, 0, 0);
       gpio_matrix_in(config->cs_pin, config->cs_insig, 0);
 
-      esp32_configgpio(config->mosi_pin, INPUT_FUNCTION_2 | PULLUP);
+      esp32_configgpio(config->mosi_pin, INPUT_FUNCTION_3 | PULLUP);
       gpio_matrix_out(config->mosi_pin, config->mosi_outsig, 0, 0);
       gpio_matrix_in(config->mosi_pin, config->mosi_insig, 0);
 
-      esp32_configgpio(config->miso_pin, OUTPUT_FUNCTION_2);
+      esp32_configgpio(config->miso_pin, OUTPUT_FUNCTION_3);
       gpio_matrix_out(config->miso_pin, config->miso_outsig, 0, 0);
       gpio_matrix_in(config->miso_pin, config->miso_insig, 0);
 
-      esp32_configgpio(config->clk_pin, INPUT_FUNCTION_2 | PULLUP);
+      esp32_configgpio(config->clk_pin, INPUT_FUNCTION_3 | PULLUP);
       gpio_matrix_out(config->clk_pin, config->clk_outsig, 0, 0);
       gpio_matrix_in(config->clk_pin, config->clk_insig, 0);
     }