SPI slave and DMA question | Cypress Semiconductor
SPI slave and DMA question
I am using PSoC3 at the SPI slave end and SPI master is a ARM9 processor. I need to consistantly exchange block of data to PSoC3 through the SPI, so I set up the DMA on PSoC3 side. In my test program, I find SPI slave return data is shifted by one byte. For example, in PSoC3, I initialize spitxdata[i] = i + 10; but on the SPI master side, at the very first time, it receive data SpiReturn = 0; SpiReturn = 10; SpiReturn = 11......and the next round, it will assign SpiReturn = 49, then SpiReturn = 10.... It seems Spi slave Tx does not put the tx data after receiving the first byte? Any suggestions?
Here is some more details about my program. SPIS Rx/Tx buffer size = 4, only selected Interrupt On Tx FIFO Not Full and Interrupt On Rx FIFO Not Empty, rx_interrupt output connects to DMA_RX_S drq and tx_interrupt connects to DMA_TX_S drq, both DMA has hardware request set to level
Attached is the related code.
Thanks in advance for any suggestion!