Skip to content

Commit

Permalink
Merge branch 'feat/esp32c6_spi_sdio' into 'master'
Browse files Browse the repository at this point in the history
feat: add SPI and sdio for esp32c6

See merge request application/esp-at!1456
  • Loading branch information
xcguang committed Nov 9, 2023
2 parents 9126d96 + 829cfba commit 45fa5d3
Show file tree
Hide file tree
Showing 20 changed files with 168 additions and 86 deletions.
5 changes: 3 additions & 2 deletions docs/conf_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'AT_Command_Examples/classic_bluetooth_at_examples.rst',
'AT_Command_Set/BT_AT_Commands.rst',
'AT_Command_Set/Ethernet_AT_Commands.rst',
'Compile_and_Develop/esp32-sdio-at-guide.rst',
'Compile_and_Develop/How_to_implement_SDIO_AT.rst',
'Compile_and_Develop/how_to_enable_at_classic_bluetooth.rst',
'Compile_and_Develop/How_to_enable_ESP_AT_Ethernet.rst',
'Customized_AT_Commands_and_Firmware/*'
Expand All @@ -45,7 +45,8 @@
]

ESP32C6_DOCS = ['AT_Binary_Lists/ESP32-C6_AT_binaries.rst',
'Compile_and_Develop/How_to_implement_SPI_AT.rst'
'Compile_and_Develop/How_to_implement_SPI_AT.rst',
'Compile_and_Develop/How_to_implement_SDIO_AT.rst'
]

# format: {tag needed to include: documents to included}, tags are parsed from sdkconfig and peripheral_caps.h headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,23 @@ SDIO can use either 1-bit or 4-bit data transfer mode.

The SDIO slave pins are as below:

- CLK is GPIO14
- CMD is GPIO15
- DAT0 is GPIO2
- DAT1 is GPIO4
- DAT2 is GPIO12 (for 4-bit mode only)
- DAT3 is GPIO13 (for 4-bit mode only)
.. only:: esp32

- CLK is GPIO14
- CMD is GPIO15
- DAT0 is GPIO2
- DAT1 is GPIO4
- DAT2 is GPIO12 (for 4-bit mode only)
- DAT3 is GPIO13 (for 4-bit mode only)

.. only:: esp32c6

- CLK is GPIO19
- CMD is GPIO18
- DAT0 is GPIO20
- DAT1 is GPIO21
- DAT2 is GPIO22 (for 4-bit mode only)
- DAT3 is GPIO23 (for 4-bit mode only)

Implement SDIO AT
-----------------
Expand Down
75 changes: 51 additions & 24 deletions docs/en/Compile_and_Develop/How_to_implement_SPI_AT.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ How to enable SPI AT?

You can configure and enable SPI AT through the following steps:

1. ``./build.py menuconfig`` -> ``Component config`` -> ``AT`` -> ``communicate method for AT command`` -> ``AT through HSPI`` to enable SPI AT.
1. ``./build.py menuconfig`` -> ``Component config`` -> ``AT`` -> ``communicate method for AT command`` -> ``AT through SPI`` to enable SPI AT.
2. ``./build.py menuconfig`` -> ``Component config`` -> ``AT`` -> ``communicate method for AT command`` -> ``AT SPI Data Transmission Mode`` to choose the SPI data transmission mode.
3. ``./build.py menuconfig`` -> ``Component config`` -> ``AT`` -> ``communicate method for AT command`` -> ``AT SPI GPIO settings`` to change the default pin assignments for SPI AT.
4. ``./build.py menuconfig`` -> ``Component config`` -> ``AT`` -> ``communicate method for AT command`` -> ``AT SPI driver settings`` to choose the SPI slave mode, and config the buffer size for data transmission.
Expand All @@ -33,32 +33,59 @@ The Default Pin Assignment

The following pin assignments are used by default:

.. list-table:: The Default Pins for SPI AT
:widths: 10 25
:header-rows: 1

* - Signal
- GPIO Number
* - SCLK
- 6
* - MISO
- 2
* - MOSI
- 7
* - CS
- 10
* - HANDSHAKE
- 3
* - GND
- GND
* - QUADWP (qio/qout) :sup:`1`
- 8
* - QUADHD (qio/qout) :sup:`1`
- 9
.. only:: esp32c2 or esp32c3

.. list-table:: The Default Pins for SPI AT
:widths: 10 25
:header-rows: 1

* - Signal
- GPIO Number
* - SCLK
- 6
* - MISO
- 2
* - MOSI
- 7
* - CS
- 10
* - HANDSHAKE
- 3
* - GND
- GND
* - QUADWP (qio/qout) :sup:`1`
- 8
* - QUADHD (qio/qout) :sup:`1`
- 9

.. only:: esp32c6

.. list-table:: The Default Pins for SPI AT
:widths: 10 25
:header-rows: 1

* - Signal
- GPIO Number
* - SCLK
- 19
* - MISO
- 20
* - MOSI
- 18
* - CS
- 23
* - HANDSHAKE
- 21
* - GND
- GND
* - QUADWP (qio/qout) :sup:`1`
- 22
* - QUADHD (qio/qout) :sup:`1`
- 2

**Note** 1: QUADWP and QUADHD signals are only used for 4-bit (qio/qout) transactions.

You can change the default pin assignments by ``./build.py menuconfig`` > ``Component config`` > ``AT`` > ``communicate method for AT command`` > ``AT through HSPI`` > ``AT SPI GPIO settings`` and compile the project (see :doc:`../Compile_and_Develop/How_to_clone_project_and_compile_it`).
You can change the default pin assignments by ``./build.py menuconfig`` > ``Component config`` > ``AT`` > ``communicate method for AT command`` > ``AT through SPI`` > ``AT SPI GPIO settings`` and compile the project (see :doc:`../Compile_and_Develop/How_to_clone_project_and_compile_it`).

How to Use SPI AT?
-----------------------
Expand Down
4 changes: 2 additions & 2 deletions docs/en/Compile_and_Develop/How_to_optimize_throughput.rst
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ The data stream of throughput is similar to water flow. In order to improve thro

If the user expects the throughput rate to be greater than or close to 5 Mbps, then SPI, SDIO, Socket or other methods can be considered. Please refer to:

.. only:: esp32
.. only:: esp32 or esp32c6

- SDIO: :doc:`SDIO AT Guide </Compile_and_Develop/esp32-sdio-at-guide>`
- SDIO: :doc:`SDIO AT Guide </Compile_and_Develop/How_to_implement_SDIO_AT>`
- Socket: :project_file:`Socket AT Guide <main/interface/socket/README.md>`

.. only:: esp32c2 or esp32c3 or esp32c6
Expand Down
2 changes: 1 addition & 1 deletion docs/en/Compile_and_Develop/How_to_set_AT_port_pin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To modify the AT port pins of your {IDF_TARGET_NAME}, you should:
This document focuses on modifying the pins. Click the links above for details of other steps.

.. note::
To use other interfaces as the AT command port, please refer to :project_file:`AT through SDIO <main/interface/sdio/README.md>`, :project_file:`AT through SPI <main/interface/hspi/README.md>`, or :project_file:`AT through socket <main/interface/socket/README.md>` for more details.
To use other interfaces as the AT command port, please refer to :project_file:`AT through SDIO <main/interface/sdio/README.md>`, :project_file:`AT through SPI <main/interface/spi/README.md>`, or :project_file:`AT through socket <main/interface/socket/README.md>` for more details.

{IDF_TARGET_NAME} Series
------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/en/Compile_and_Develop/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ How to Compile and Develop Your Own AT Project
How to Customize Partitions <How_to_customize_partitions>
:esp32: How to Enable {IDF_TARGET_NAME} AT Ethernet <How_to_enable_ESP_AT_Ethernet>
How to Add Support for a Module <How_to_add_support_for_a_module>
:esp32: {IDF_TARGET_NAME} SDIO AT Guide <{IDF_TARGET_PATH_NAME}-sdio-at-guide.rst>
:esp32 or esp32c6: How to Implement SDIO AT <How_to_implement_SDIO_AT>
:esp32c2 or esp32c3 or esp32c6: How to Implement SPI AT <How_to_implement_SPI_AT>
How to Implement OTA Update <How_to_implement_OTA_update>
How to Update IDF <How_to_update_IDF>
Expand Down
2 changes: 1 addition & 1 deletion docs/en/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ What interfaces of {IDF_TARGET_NAME} chips can be used to transmit AT commands?
:esp32: - {IDF_TARGET_NAME} can transmit AT commands through UART and SDIO.
:esp32c2 or esp32c3 or esp32c6: - {IDF_TARGET_NAME} can transmit AT commands through UART and SPI.
- The default firmware uses UART for transmission. If you need SDIO or SPI interface to transmit AT commands, you can configure it through ``./build.py menuconfig`` > ``Component config`` > ``AT`` when compiling the ESP-AT project by yourself.
- See :project_file:`AT through SDIO <main/interface/sdio/README.md>`, :project_file:`AT through SPI <main/interface/hspi/README.md>`, or :project_file:`AT through socket <main/interface/socket/README.md>` for more details.
- See :project_file:`AT through SDIO <main/interface/sdio/README.md>`, :project_file:`AT through SPI <main/interface/spi/README.md>`, or :project_file:`AT through socket <main/interface/socket/README.md>` for more details.

.. only:: esp32

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,23 @@ SDIO 可使用 一线或四线模式。至少需要 4 根线:CMD、CLK、DAT0

SDIO slave 管脚如下所示:

- CLK:GPIO14
- CMD:GPIO15
- DAT0:GPIO2
- DAT1:GPIO4
- DAT2:GPIO12(四线)
- DAT3:GPIO13(四线)
.. only:: esp32

- CLK is GPIO14
- CMD is GPIO15
- DAT0 is GPIO2
- DAT1 is GPIO4
- DAT2 is GPIO12(四线)
- DAT3 is GPIO13(四线)

.. only:: esp32c6

- CLK is GPIO19
- CMD is GPIO18
- DAT0 is GPIO20
- DAT1 is GPIO21
- DAT2 is GPIO22(四线)
- DAT3 is GPIO23(四线)

如何使用 SDIO AT
----------------
Expand Down
75 changes: 51 additions & 24 deletions docs/zh_CN/Compile_and_Develop/How_to_implement_SPI_AT.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ AT 工程默认使用 UART 协议进行数据通信,但是 UART 协议在一

您可以通过下述步骤配置并启用 SPI AT:

1. 通过 ``./build.py menuconfig`` -> ``Component config`` -> ``AT`` -> ``communicate method for AT command`` -> ``AT through HSPI`` 使能 SPI AT。
1. 通过 ``./build.py menuconfig`` -> ``Component config`` -> ``AT`` -> ``communicate method for AT command`` -> ``AT through SPI`` 使能 SPI AT。
2. 通过 ``./build.py menuconfig`` -> ``Component config`` -> ``AT`` -> ``communicate method for AT command`` -> ``AT SPI Data Transmission Mode`` 选择 SPI 数据传输模式。
3. 通过 ``./build.py menuconfig`` -> ``Component config`` -> ``AT`` -> ``communicate method for AT command`` -> ``AT SPI GPIO settings`` 配置 SPI 使用的 GPIO 管脚。
4. 通过 ``./build.py menuconfig`` -> ``Component config`` -> ``AT`` -> ``communicate method for AT command`` -> ``AT SPI driver settings`` 选择 SPI 从机的工作模式,并配置相关缓存区的大小。
Expand All @@ -33,32 +33,59 @@ SPI AT 默认管脚

下表给出了不同系列的 {IDF_TARGET_NAME} 设备使用 SPI AT 时默认的硬件管脚:

.. list-table:: SPI AT 默认管脚
:widths: 10 25
:header-rows: 1

* - 信号
- GPIO 编号
* - SCLK
- 6
* - MISO
- 2
* - MOSI
- 7
* - CS
- 10
* - HANDSHAKE
- 3
* - GND
- GND
* - QUADWP (qio/qout) :sup:`1`
- 8
* - QUADHD (qio/qout) :sup:`1`
- 9
.. only:: esp32c2 or esp32c3

.. list-table:: SPI AT 默认管脚
:widths: 10 25
:header-rows: 1

* - 信号
- GPIO 编号
* - SCLK
- 6
* - MISO
- 2
* - MOSI
- 7
* - CS
- 10
* - HANDSHAKE
- 3
* - GND
- GND
* - QUADWP (qio/qout) :sup:`1`
- 8
* - QUADHD (qio/qout) :sup:`1`
- 9

.. only:: esp32c6

.. list-table:: SPI AT 默认管脚
:widths: 10 25
:header-rows: 1

* - 信号
- GPIO 编号
* - SCLK
- 19
* - MISO
- 20
* - MOSI
- 18
* - CS
- 23
* - HANDSHAKE
- 21
* - GND
- GND
* - QUADWP (qio/qout) :sup:`1`
- 22
* - QUADHD (qio/qout) :sup:`1`
- 2

**说明** 1:QUADWP 引脚和 QUADHD 引脚仅在使用 4 线 SPI 工作时使用。

您可以通过 ``./build.py menuconfig`` > ``Component config`` > ``AT`` > ``communicate method for AT command`` > ``AT through HSPI`` > ``AT SPI GPIO settings``,然后编译工程来配置 SPI AT 对应的管脚(参考 :doc:`../Compile_and_Develop/How_to_clone_project_and_compile_it`)。
您可以通过 ``./build.py menuconfig`` > ``Component config`` > ``AT`` > ``communicate method for AT command`` > ``AT through SPI`` > ``AT SPI GPIO settings``,然后编译工程来配置 SPI AT 对应的管脚(参考 :doc:`../Compile_and_Develop/How_to_clone_project_and_compile_it`)。

使用 SPI AT
--------------
Expand Down
4 changes: 2 additions & 2 deletions docs/zh_CN/Compile_and_Develop/How_to_optimize_throughput.rst
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@

如果用户期望吞吐速率大于或接近于 5 Mbps,可以考虑使用 SPI、SDIO、Socket 等方式。具体请参考:

.. only:: esp32
.. only:: esp32 or esp32c6

- SDIO: :doc:`SDIO AT 指南 </Compile_and_Develop/esp32-sdio-at-guide>`
- SDIO: :doc:`SDIO AT 指南 </Compile_and_Develop/How_to_implement_SDIO_AT>`
- Socket: :project_file:`Socket AT 指南 <main/interface/socket/README.md>`

.. only:: esp32c2 or esp32c3 or esp32c6
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/Compile_and_Develop/How_to_set_AT_port_pin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
本文档重点介绍如何修改管脚,点击上面的链接了解其它步骤的详细信息。

.. note::
使用其它接口作为 AT 命令接口请参考 :project_file:`使用 AT SPI 接口 <main/interface/sdio/README.md>`, :project_file:`AT through SPI <main/interface/hspi/README.md>` 和 :project_file:`使用 AT 套接字接口 <main/interface/socket/README.md>`。
使用其它接口作为 AT 命令接口请参考 :project_file:`使用 AT SPI 接口 <main/interface/sdio/README.md>`, :project_file:`AT through SPI <main/interface/spi/README.md>` 和 :project_file:`使用 AT 套接字接口 <main/interface/socket/README.md>`。

{IDF_TARGET_NAME} 系列
------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/Compile_and_Develop/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
如何自定义分区 <How_to_customize_partitions>
:esp32: 如何使能 {IDF_TARGET_NAME}-AT 以太网 <How_to_enable_ESP_AT_Ethernet>
如何增加一个新的模组支持 <How_to_add_support_for_a_module>
:esp32: {IDF_TARGET_NAME} SDIO AT 指南 <{IDF_TARGET_PATH_NAME}-sdio-at-guide.rst>
:esp32 or esp32c6: 如何实现 SDIO AT <How_to_implement_SDIO_AT>
:esp32c2 or esp32c3 or esp32c6: 如何实现 SPI AT <How_to_implement_SPI_AT>
如何基于乐鑫服务器实现自己的 OTA 管理 <How_to_implement_OTA_update>
如何更新 ESP-IDF 版本 <How_to_update_IDF>
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ ESP-AT 固件中 TCP 发送窗口大小是否可以修改?
:esp32: - {IDF_TARGET_NAME} 支持 UART、SDIO 接口通信。
:esp32c2 or esp32c3 or esp32c6: - {IDF_TARGET_NAME} 支持 UART、SPI 接口通信。
- AT 默认固件是使用 UART 接口来传输。用户如果需要使用 SDIO 或者 SPI 接口进行通信,可以基于 ESP-AT 配置编译,详情请见 :doc:`编译和开发 <Compile_and_Develop/index>`。
- 更多资料请参考 :project_file:`使用 AT SDIO 接口 <main/interface/sdio/README.md>`,:project_file:`使用 AT SPI 接口 <main/interface/hspi/README.md>`,或 :project_file:`使用 AT 套接字接口 <main/interface/socket/README.md>`。
- 更多资料请参考 :project_file:`使用 AT SDIO 接口 <main/interface/sdio/README.md>`,:project_file:`使用 AT SPI 接口 <main/interface/spi/README.md>`,或 :project_file:`使用 AT 套接字接口 <main/interface/socket/README.md>`。

.. only:: esp32

Expand Down
2 changes: 1 addition & 1 deletion main/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ choice AT_COMMUNICATION_METHOD
depends on AT_ENABLE

rsource "interface/uart/Kconfig"
rsource "interface/hspi/Kconfig"
rsource "interface/spi/Kconfig"
rsource "interface/socket/Kconfig"
rsource "interface/sdio/Kconfig"

Expand Down
4 changes: 1 addition & 3 deletions main/interface/sdio/Kconfig
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

config AT_BASE_ON_SDIO
bool "AT through SDIO"
depends on IDF_TARGET_ESP32
depends on IDF_TARGET_ESP32 || IDF_TARGET_ESP32C6
help
This demo is AT through SDIO. The MCU can send AT command through SDIO bus.
Note: GPIO14 is SDIO CLK pin, GPIO15 is SDIO CMD pin, GPIO2 is SDIO DAT0 pin,
GPIO4 is SDIO DAT1 pin, GPIO12 is SDIO DAT2 pin, GPIO13 is SDIO DAT3 pin.

if AT_BASE_ON_SDIO
menu "AT SDIO settings"
Expand Down
Loading

0 comments on commit 45fa5d3

Please sign in to comment.