The idea is to send 2kiB of data through SPI in one transaction. I have a buffer prepared, data in it is valid (when send through FIFO the connected device works properly). During the process, I connect clock signal to the SPI and DMA peripherals, then connected SPI2 with DMA ch1. I set SPI CLOCK_REG, in USER_REG MOSI (27) bit and full duplex (1) bits. Connected the signal to the GPIO pin.
To send data I set SPI_DMA_OUT_LINK_REG to the descriptor address, and the START bit. Then, I set the SPI_MOSI_DLEN_REG for the amount of BITS transfered -1, and I enable SPI by setting bit 18 in SPI_CMD_REG.
My descriptor looks like this:
- typedef struct
- {
- uint32_t DW0_int;
- uint32_t bufAddrPtr;
- uint32_t nextDSCADDR;
- } DMADescriptor_s;
- DMADescriptor_s DMA_FIRST_AND_ONLY_DSC __attribute__ ((aligned (8)));
- DMA_FIRST_AND_ONLY_DSC.DW0_int = (1<<31) | (1<<30) | (60<<12) | (60<<0); //DMA is the master, //EOF //60 Bytes //60Bytes
- DMA_FIRST_AND_ONLY_DSC.bufAddrPtr = (uint32_t)data; //data is the buffer name
- DMA_FIRST_AND_ONLY_DSC.nextDSCADDR = (uint32_t)0;
The DMA always loads new descriptor after the transaction, EOF deesn't seem to be issued. I am checking the registers during tests, the next descriptor address is set (despite 0 in given descriptor in nextDSCADDR position) and oscilloscope shows that data is pretty random.
What is the proper way of initialising DMA and DMA single transaction in ESP32? When I tried resetting DMA by using lower bits of SPI_DMA_CONF_REG it didn't work at all.
Thank You for Your time and help!
Ps. is there something like CMSIS for ESP32?
Pss. I am using https://www.espressif.com/sites/default ... ual_en.pdf as the ref manual.