mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-02 16:11:41 +01:00
spi_master:support octal mode for esp32s2 and esp32s3
Add support for 8-line spi for lcd on esp32s2 and esp32s3 Closes https://github.com/espressif/esp-idf/issues/6371
This commit is contained in:
@@ -47,12 +47,16 @@ Term Definition
|
||||
**Host** The SPI controller peripheral inside {IDF_TARGET_NAME} that initiates SPI transmissions over the bus, and acts as an SPI Master.
|
||||
**Device** SPI slave device. An SPI bus may be connected to one or more Devices. Each Device shares the MOSI, MISO and SCLK signals but is only active on the bus when the Host asserts the Device's individual CS line.
|
||||
**Bus** A signal bus, common to all Devices connected to one Host. In general, a bus includes the following lines: MISO, MOSI, SCLK, one or more CS lines, and, optionally, QUADWP and QUADHD. So Devices are connected to the same lines, with the exception that each Device has its own CS line. Several Devices can also share one CS line if connected in the daisy-chain manner.
|
||||
**MISO** Master In, Slave Out, a.k.a. Q. Data transmission from a Device to Host.
|
||||
**MOSI** Master Out, Slave In, a.k.a. D. Data transmission from a Host to Device.
|
||||
**MISO** Master In, Slave Out, a.k.a. Q. Data transmission from a Device to Host. Also data1 signal in octal mode.
|
||||
**MOSI** Master Out, Slave In, a.k.a. D. Data transmission from a Host to Device. Also data0 signal in octal mode.
|
||||
**SCLK** Serial Clock. Oscillating signal generated by a Host that keeps the transmission of data bits in sync.
|
||||
**CS** Chip Select. Allows a Host to select individual Device(s) connected to the bus in order to send or receive data.
|
||||
**QUADWP** Write Protect signal. Only used for 4-bit (qio/qout) transactions.
|
||||
**QUADHD** Hold signal. Only used for 4-bit (qio/qout) transactions.
|
||||
**QUADWP** Write Protect signal. Used for 4-bit (qio/qout) transactions. Also for data2 signal in octal mode.
|
||||
**QUADHD** Hold signal. Used for 4-bit (qio/qout) transactions. Also for data3 signal in octal mode.
|
||||
**DATA4** Data4 signal in octal mode.
|
||||
**DATA5** Data5 signal in octal mode.
|
||||
**DATA6** Data6 signal in octal mode.
|
||||
**DATA7** Data7 signal in octal mode.
|
||||
**Assertion** The action of activating a line.
|
||||
**De-assertion** The action of returning the line back to inactive (back to idle) status.
|
||||
**Transaction** One instance of a Host asserting a CS line, transferring data to and from a Device, and de-asserting the CS line. Transactions are atomic, which means they can never be interrupted by another transaction.
|
||||
@@ -144,6 +148,41 @@ All the tasks that use interrupt transactions can be blocked by the queue. At th
|
||||
|
||||
The :cpp:func:`spi_device_polling_end` routine needs an overhead of at least 1 us to unblock other tasks when the transaction is finished. It is strongly recommended to wrap a series of polling transactions using the functions :cpp:func:`spi_device_acquire_bus` and :cpp:func:`spi_device_release_bus` to avoid the overhead. For more information, see :ref:`bus_acquiring`.
|
||||
|
||||
Transaction Line Mode
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Supported line modes are as follows:
|
||||
|
||||
====================== ====================== ====================== ==================
|
||||
Mode name Command Line Width Address Line Width Data Line Width
|
||||
====================== ====================== ====================== ==================
|
||||
**Dual Output** 1 1 2
|
||||
**Dual I/O** 1 2 2
|
||||
**Quad Output** 1 1 4
|
||||
**Quad I/O** 1 4 4
|
||||
**Octal Output** 1 1 8
|
||||
**OPI** 8 8 8
|
||||
====================== ====================== ====================== ==================
|
||||
|
||||
|
||||
To make use of these modes, `data0_io_num` to `data7_io_num` I/O pins in the struct :cpp:type:`spi_bus_config_t` and the member `flags` in the struct :cpp:type:`spi_bus_config_t` should be set as shown below:
|
||||
|
||||
+-------------------+--------------------------+
|
||||
| Mode name | Flags |
|
||||
+===================+==========================+
|
||||
| Dual Output | |
|
||||
+-------------------+ SPICOMMON_BUSFLAG_DUAL |
|
||||
| Dual I/O | |
|
||||
+-------------------+--------------------------+
|
||||
| Quad Output | |
|
||||
+-------------------+ SPICOMMON_BUSFLAG_QUAD |
|
||||
| Quad I/O | |
|
||||
+-------------------+--------------------------+
|
||||
| Octal Output | |
|
||||
+-------------------+ SPICOMMON_BUSFLAG_OCTAL |
|
||||
| OPI | |
|
||||
+-------------------+--------------------------+
|
||||
|
||||
|
||||
Command and Address Phases
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -152,6 +191,8 @@ During the command and address phases, the members :cpp:member:`cmd` and :cpp:me
|
||||
|
||||
If the lengths of the command and address phases need to be variable, declare the struct :cpp:type:`spi_transaction_ext_t`, set the flags :cpp:type:`SPI_TRANS_VARIABLE_CMD` and/or :cpp:type:`SPI_TRANS_VARIABLE_ADDR` in the member :cpp:member:`spi_transaction_ext_t::base` and configure the rest of base as usual. Then the length of each phase will be equal to :cpp:member:`command_bits` and :cpp:member:`address_bits` set in the struct :cpp:type:`spi_transaction_ext_t`.
|
||||
|
||||
If using more than one data lines to transmit, please set flags at the member `flags` in the struct :cpp:type:`spi_transaction_t`. If the number of lines transmitting command is the same as that transmitting data, please set `MULTILINE_CMD`. If the number of lines transmitting address is the same as that transmitting data, please set `MULTILINE_ADDR`.
|
||||
|
||||
|
||||
Write and Read Phases
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -163,6 +204,24 @@ Normally, the data that needs to be transferred to or from a Device will be read
|
||||
|
||||
If these requirements are not satisfied, the transaction efficiency will be affected due to the allocation and copying of temporary buffers.
|
||||
|
||||
If using more than one data lines to transmit, please set `SPI_DEVICE_HALFDUPLEX` flag at the member `flags` in the struct :cpp:type:`spi_device_interface_config_t`. And the member `flags` in the struct :cpp:type:`spi_transaction_t` should be set as below:
|
||||
|
||||
+-------------------+--------------------+
|
||||
| Mode name | Flags |
|
||||
+===================+====================+
|
||||
| Dual Output | |
|
||||
+-------------------+ SPI_TRANS_MODE_DIO |
|
||||
| Dual I/O | |
|
||||
+-------------------+--------------------+
|
||||
| Quad Output | |
|
||||
+-------------------+ SPI_TRANS_MODE_QIO |
|
||||
| Quad I/O | |
|
||||
+-------------------+--------------------+
|
||||
| Octal Output | |
|
||||
+-------------------+ SPI_TRANS_MODE_OCT |
|
||||
| OPI | |
|
||||
+-------------------+--------------------+
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -31,7 +31,7 @@ Introduction
|
||||
------------
|
||||
|
||||
In the half duplex mode, the master has to use the protocol defined by the slave to communicate
|
||||
with the slave. Each transaction may consists of the following phases (list by the order they
|
||||
with the slave. Each transaction may consist of the following phases (list by the order they
|
||||
should exist):
|
||||
|
||||
- Command: 8-bit, master to slave
|
||||
|
||||
Reference in New Issue
Block a user