RSL10 SPI CMSIS Driver implementation full of bugs for DMA Transfers

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?

@l.miklosko

Our engineer had tried to verify what you were seeing, but the SPI Driver in DMA mode seems to be working as expected.

I have attached an image of Logic Analyzer output below, along with the simple sample project that he developed to quickly test the SPI DMA driver. Can you compare your CMSIS setup with this one , and also to test the firmware to see if you still see the issue.

blinky_SPI.zip (56.9 KB)

Thank you for using our community forum!

@martin.bela
Does this attached program show how to use SPI using DMA? Where is the code for DMA configuration and for starting DMA?

Loading this project in my IDE gives me this error:

What does this mean? I believe my CMSIS is installed correctly, since if I try to include the SPI CMSIS driver in some other sample project, this is what I see:

How can I fix my error when loading your attached project?

ON Semiconductor IDE Version: 3.4.0.48
Eclipse Version: 2020-12
Build id: 20210226-1917

CMSIS version: 3.5.285

@mahaju

I confirm I could successfully compile the blinky_SPI project without any change (as provided by the archive of @martin.bela).
Maybe you should re-install SDK3.5 !?

Among the sample applications I tested, only secure_bootloader required the manual addition of the mbed TLS pack from ARM to compile… other samples compiled “as is”.

1 Like

Hi @mahaju

I can also confirm successful compilation of provided blinky_SPI project without any change

IDE Version: 3.2.2.13
CMSIS version: 3.5.285

It seems that you are missing ARM.CMSIS pack.

Without ARM.CMSIS pack I can see the same issue.

Thank you for using our Community Forum.

1 Like
  1. How do I get whatever is missing?

  2. Why was I able to include the SPI driver in the second picture I posted above, if I am missing a component?

  3. Does the attached blinky_SPI project show how to use SPI using DMA? Where is the code for DMA configuration and for starting DMA?

@mahaju

Similar issue with ARM.CMSIS was discussed in iBeacon receiver example?

You can also refer to Chapter 6 in RSL10_getting_started_guide available in RSL10 Documentation Package where is discussed Resolving External CMSIS-Pack Dependencies.

Alternatively, ARM.CMSIS pack can be also downloaded from Releases · ARM-software/CMSIS_5 · GitHub

Thank you for using our Community Forum.