I was trying to use RSL10 SPI CMSIS Driver with DMA, but after discovering some major flaws, I’d like to ask how the hell did that code passed the code review…
Okay back to my question,
First thing I noticed is the RSL10 sends out a random byte first before starting the transfer:
This is due to these lines (SPI_RSLxx.c 1544-47):
/* !!!WORKAROUND!!! set the RW transfer before setting the dma control to properly send first byte */
spi->reg->CTRL0 &= ~SPI0_CTRL0_SPI0_CONTROLLER_Pos;
spi->reg->CTRL1 |= (SPI0_START | transferType);
spi->reg->CTRL0 |= SPI0_CONTROLLER_DMA;
I noticed that setting SPI0_CONTROLLER_DMA starts the transfer immediately, and SPI0_START the transfer as well hence 2 transfers on the image above.
SPI ERROR interrupt is triggered 2 times as well, both having ARM_SPI_EVENT_MODE_FAULT, which is propagated to the SPI HAL but ends there - no action, CS stays low, busy flag stays set.
What is the point of publishing such code? Shame. Do we have any working SPI CMSIS Driver implementation available for use, DMA compatible?