acassis commented on code in PR #18467:
URL: https://github.com/apache/nuttx/pull/18467#discussion_r2869245226


##########
Documentation/platforms/xtensa/esp32s3/spi.rst:
##########
@@ -0,0 +1,151 @@
+.. _esp32s3_spi:
+
+SPI Configuration for ESP32-S3
+===============================
+
+This guide explains how to set up SPI on the ESP32-S3. I wrote this after 
figuring out the configuration myself - hopefully it helps others avoid the 
same confusion.
+
+Prerequisites
+-------------
+Before starting, make sure:
+- You can already build NuttX for ESP32-S3
+- You know how to use menuconfig (basic navigation is enough)
+
+Configuration Steps
+-------------------
+Here's what I did to get SPI working:
+
+1. **Enable SPI support**
+   
+   Run ``make menuconfig`` and go to:
+   
+    ```
+    Device Drivers -> SPI Driver Support
+    ```
+
+    Enable ``[*] SPI``
+
+2. **Select the SPI peripheral**
+
+    Go to:
+
+    ```
+    System Type -> ESP32-S3 Peripheral Selection
+    ```
+
+    Enable ``[*] SPI2``
+
+3. **Enable Chip Select (optional)**
+
+    In the System Type menu, go to SPI configuration and enable:
+    ```
+    [*] SPI Chip Select
+    ```
+
+    You can change the CS pin from GPIO10 if needed.
+
+Pin Mapping
+-----------
+Default pins for SPI2:
+
+- SCK (Clock) → GPIO12
+- MOSI → GPIO11
+- MISO → GPIO13
+- CS (Chip Select) → GPIO10
+
+If these pins conflict with your board, these pins can be configured at 
``System Type -> SPI configuration``.
+
+Chip Select Options
+-------------------
+ESP32-S3 offers three ways to handle Chip Select:
+
+**1. Hardware CS (default)**
+- Set ``(10) SPI2 CS Pin`` in ``System Type -> SPI configuration``
+- The SPI controller hardware automatically controls the CS pin
+- Best for most applications
+
+**2. Software CS with GPIO matrix**
+- Enable ``[*] SPI software CS`` but leave ``[ ] User defined CS`` disabled
+- The SPI driver controls the CS pin through the GPIO matrix

Review Comment:
   you forgot to say it will use the same pin defined at "SPIx CS Pin" in 
System Type -> SPI configuration



##########
Documentation/platforms/xtensa/esp32s3/spi.rst:
##########
@@ -0,0 +1,151 @@
+.. _esp32s3_spi:
+
+SPI Configuration for ESP32-S3
+===============================
+
+This guide explains how to set up SPI on the ESP32-S3. I wrote this after 
figuring out the configuration myself - hopefully it helps others avoid the 
same confusion.
+
+Prerequisites
+-------------
+Before starting, make sure:
+- You can already build NuttX for ESP32-S3
+- You know how to use menuconfig (basic navigation is enough)
+
+Configuration Steps
+-------------------
+Here's what I did to get SPI working:
+
+1. **Enable SPI support**
+   
+   Run ``make menuconfig`` and go to:
+   
+    ```
+    Device Drivers -> SPI Driver Support
+    ```
+
+    Enable ``[*] SPI``
+
+2. **Select the SPI peripheral**
+
+    Go to:
+
+    ```
+    System Type -> ESP32-S3 Peripheral Selection
+    ```
+
+    Enable ``[*] SPI2``
+
+3. **Enable Chip Select (optional)**
+
+    In the System Type menu, go to SPI configuration and enable:
+    ```
+    [*] SPI Chip Select
+    ```
+
+    You can change the CS pin from GPIO10 if needed.
+
+Pin Mapping
+-----------
+Default pins for SPI2:
+
+- SCK (Clock) → GPIO12
+- MOSI → GPIO11
+- MISO → GPIO13
+- CS (Chip Select) → GPIO10
+
+If these pins conflict with your board, these pins can be configured at 
``System Type -> SPI configuration``.
+
+Chip Select Options
+-------------------
+ESP32-S3 offers three ways to handle Chip Select:
+
+**1. Hardware CS (default)**
+- Set ``(10) SPI2 CS Pin`` in ``System Type -> SPI configuration``
+- The SPI controller hardware automatically controls the CS pin
+- Best for most applications
+
+**2. Software CS with GPIO matrix**
+- Enable ``[*] SPI software CS`` but leave ``[ ] User defined CS`` disabled
+- The SPI driver controls the CS pin through the GPIO matrix
+- Good for custom timing requirements
+
+**3. User-defined CS (most flexible)**
+- Enable both ``[*] SPI software CS`` and ``[*] User defined CS``
+- The ``esp32s3_spiX_select()`` function is called from board code
+- You control exactly which GPIO is used as CS

Review Comment:
   I think this mode is also necessary to use this mode when you need to 
control SPI CMD/DATA
   
   @tmedicci or @fdcavalcanti could you please confirm/deny my assumption?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to