EasyManua.ls Logo

Espressif ESP32-S2 - Page 670

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
Note The registers for Master/Slave synchronization are reserved. Do not use them. (see tx_sync_reg in
essl_spi_config_t)
Note Feature of checking the actual written value (out_value) is not supported.
Return
ESP_OK: success
ESP_ERR_INVALID_STATE: ESSL SPI has not been initialized.
ESP_ERR_INVALID_ARG: The address argument is not valid. See note 1.
ESP_ERR_NOT_SUPPORTED: Should set out_value to NULL. See note 2.
or other return value from :cpp:func:spi_device_transmit.
Parameters
arg: Context of the component. (Member arg from essl_handle_t)
addr: Address of the shared registers. (Valid: 0 ~ SOC_SPI_MAXIMUM_BUFFER_SIZE, reg-
isters for M/S sync are reserved, see note1)
value: Buffer for data to send, should be align to 4.
[out] out_value: Not supported, should be set to NULL.
wait_ms: Time to wait before timeout (reserved for future use, user should set this to 0).
esp_err_t essl_spi_send_packet(void *arg, const void *data, size_t size, uint32_t wait_ms)
Send a packet to Slave.
Return
ESP_OK: On success
ESP_ERR_INVALID_STATE: ESSL SPI has not been initialized.
ESP_ERR_INVALID_ARG: The data address is not DMA capable
ESP_ERR_INVALID_SIZE: Master will send size bytes of data but Slave did not load enough
RX buffer
Parameters
arg: Context of the component. (Member arg from essl_handle_t)
data: Address of the data to send
size: Size of the data to send.
wait_ms: Time to wait before timeout (reserved for future use, user should set this to 0).
void essl_spi_reset_cnt(void *arg)
Reset the counter in Master context.
Note Shall only be called if the slave has reset its counter. Else, Slave and Master would be desynchronized
Parameters
arg: Context of the component. (Member arg from essl_handle_t)
esp_err_t essl_spi_rdbuf(spi_device_handle_t spi, uint8_t *out_data, int addr, int len, uint32_t flags)
Read the shared buffer from the slave in ISR way.
Note The slaves HW doesnt guarantee the data in one SPI transaction is consistent. It sends data in unit of
byte. In other words, if the slave SW attempts to update the shared register when a rdbuf SPI transaction
is in-flight, the data got by the master will be the combination of bytes of different writes of slave SW.
Note out_data should be prepared in words and in the DRAM. The buffer may be written in words by the
DMA. When a byte is written, the remaining bytes in the same word will also be overwritten, even the
len is shorter than a word.
Return
ESP_OK: on success
or other return value from :cpp:func:spi_device_transmit.
Parameters
spi: SPI device handle representing the slave
[out] out_data: Buffer for read data, strongly suggested to be in the DRAM and aligned to 4
addr: Address of the slave shared buffer
len: Length to read
flags: SPI_TRANS_* flags to control the transaction mode of the transaction to send.
esp_err_t essl_spi_rdbuf_polling(spi_device_handle_t spi, uint8_t *out_data, int addr, int len,
uint32_t flags)
Read the shared buffer from the slave in polling way.
Espressif Systems 659
Submit Document Feedback
Release v4.4

Table of Contents