The setup code was done using ProcessorExpert with the following configuration
Slave: SPI1, 2Mhz Clk, 8 bits per frame, Active Low Clk, MSB First
Master: SPI0, 2Mhz Clk, 8 bits per frame, Active Low Clk, MSB First
A simplified version of the code (taking out case statements and other logic) is the following
uint8_t * MasterRxBuf[2];
uint8_t * MasterTxBuf[2];
uint8_t * SlaveRxBuf[2];
uint8_t * SlaveTxBuf[2];
void fooTask( task_param_t param)
{
DSPI_DRV_SlaveTransferBlocking(dspiSlave_IDX, NULL, SlaveRxBuf, 2, 10);
memcpy(MasterTxBuff, SlaveRxBuf, 2);
DSPI_DRV_MasterTransferBlocking(dspiMaster_IDX, MasterTxBuff, NULL, 2, 10);
DSPI_DRV_MasterTransferBlocking(dspiMaster_IDX, NULL, MasterRxBuff, 2, 10);
memcpy(SlaveTxBuff, MasterRxBuf, 2);
DSPI_DRV_SlaveTransferBlocking(dspiSlave_IDX, SlaveRxBuf, SlaveTxBuf, 2 , 10);
}
All of this works fine up until that final Slave TX, where it puts a 0x00 and then the first byte of the real data.
See below a Saleae capture of this occurrence. 0x2C00 was received, 0x2C00 was sent out, and then 0x052C was received and only 0x0005 was sent out
