Skip to content

Commit

Permalink
Merge branch 'docs/spi_handshake_v2.4' into 'release/v2.4.0.0'
Browse files Browse the repository at this point in the history
docs: add spi AT handshake introduce

See merge request application/esp-at!1183
  • Loading branch information
xcguang committed Aug 26, 2022
2 parents f26b306 + 02e9fa0 commit 67966ba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion docs/en/Compile_and_Develop/How_to_implement_SPI_AT.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ You can change the default pin assignments by ``./build.py menuconfig`` > ``Comp
How to Use SPI AT?
-----------------------

When SPI AT is used, {IDF_TARGET_NAME} works in SPI half-duplex mode as a slave. Usually, when SPI protocol works in half-duplex mode, it is the SPI master that starts the read/write operation. However, when AT command is used for data interaction, {IDF_TARGET_NAME} (slave) is required to actively report some information. Therefore, we add a handshake line between SPI master and slave to realize the purpose. The specific methods of using handshake line are as follows:
When SPI AT is used, {IDF_TARGET_NAME} works in SPI half-duplex mode as a slave.

Handshake Pin
^^^^^^^^^^^^^^^^

Since SPI is a master-slave model, all transmission is initiated by the master, and the slave cannot actively transmit data. However, when AT command is used for data interaction, {IDF_TARGET_NAME} (slave) is required to actively report some information. Therefore, a handshake line is added between SPI master and slave to achieve the purpose.

When the slave needs to transfer data, it pulls up the handshake pin, generating a rising edge GPIO interrupt on the master side. Then, the master initiates communication with the slave. After the data is transferred, the slave pulls down the handshake pin to end this communication.

The specific methods of using the handshake line are as follows:

- When master sends AT commands to slave via SPI, the workflow with an extra handshake line is as follows:

Expand Down
11 changes: 10 additions & 1 deletion docs/zh_CN/Compile_and_Develop/How_to_implement_SPI_AT.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ SPI AT 默认管脚
使用 SPI AT
--------------

在使用 SPI AT 时,{IDF_TARGET_NAME} 设备上运行的 SPI slave 工作在半双工通信模式下。通常,在使用 SPI 协议进行半双工通信时,由 SPI master 启动对 SPI slave 的读/写操作,但是,使用 AT 命令进行数据交互时,需要 {IDF_TARGET_NAME} 设备主动能够主动上报一些信息。因此,我们在 SPI master 和 slave 之间添加了一个握手线,来实现 slave 主动向 master 上报信息的功能。使用握手线的具体方法为:
在使用 SPI AT 时,{IDF_TARGET_NAME} 设备上运行的 SPI slave 工作在半双工通信模式下。

握手线 (handshake line)
^^^^^^^^^^^^^^^^^^^^^^^^

SPI 是一种 master-slave 结构的外设,所有的传输均由 master 发起,slave 无法主动传输数据。但是,使用 AT 命令进行数据交互时,需要 {IDF_TARGET_NAME} 设备主动能够主动上报一些信息。因此,我们在 SPI master 和 slave 之间添加了一个握手线,来实现 slave 主动向 master 上报信息的功能。

当 slave 需要传输数据时,将会把握手管脚主动拉高,这会在 master 侧产生一个上升沿的 GPIO 中断,master 发起与 slave 的通信,传输完成后,slave 将握手管脚拉低,结束此次通信。

使用握手线的具体方法为:

- Master 向 slave 发送 AT 数据时,使用握手线的方法为:

Expand Down

0 comments on commit 67966ba

Please sign in to comment.