AnsweredAssumed Answered

DSPI DMA slave on K64

Question asked by Alex Feinman on Nov 20, 2015
Latest reply on Jan 7, 2016 by Earl Orlando Ramirez Sanchez

This is on FRDM-K64 board.

I needed to implement sort of SPI passthrough, so I've used SPI0 for master reads from a peripheral and SPI1 in slave mode to provide data to the external host. For performance reasons I need DMA on both SPI0 and SPI1. However what I found out is that when I call DSPI_DRV_EdmaSlaveTransfer (blocking or non-blocking) and provide say 160 bytes to be transferred, what comes over the wire is 1st byte, followed by the 2nd byte repeated through the rest of the packet. E.g.

0, 1, 2, 3, 4....

will come across as

0, 1, 1, 1, 1, 1...

 

During the same transfer the data comes across just fine in the other direction. So to summarize - on SPI1/2 in DMA slave mode MISO fails but MOSI works.

 

This happens only in DMA mode and only on SPI1 and SPI2. Of course SPI1 and 2 are special on K64 in the sense that they use shared DMA channel for tx/rx. Is there any fix or workaround for this? The issue can be easily replicated by taking DSPI DMA slave sample from the SDK and modifying it to use SPI1 instead of the SPI0

Outcomes