Working libraries, libraries being ported and related hardware
Posts: 1652
Joined: Mon Apr 27, 2015 12:12 pm

Re: FreeRTOS

Post by victor_pv » Sat Dec 24, 2016 12:51 am

Just wanted to add some things to this thread.
I need to make sure I found the right version of the sketch and then will post it, but I had the following all working together under FreeRTOS 8.2.1 as included in the core:
ILI9163 display in SPI2
Sdcard in SPI1
Hardware timers, playing a wav file read from the sdcard.
DMA transfers for both SPI sdcard and display.

I did use Mutexes to make sure the SPI ports would not be used at the same time, because I was using the SPI.setmodule function. Since that functions selects one port OR the other to be used with SPI functions, I needed the mutex to make sure only one would be used at a time.

I did in the past test rewritting the ILI9163 library to use SPI2, coded in the library, not using SPI.setmodule, and that did work fine too, but I think I still used mutex to not have 2 functions use the SPI ports at the same time. May not have been needed.

What I can say is, at the point I pushed the SPI DMA routines to the repo, both SPI 1 & 2 ports could be used with DMA in the same sketch as long as mutex were used. I do not know all the changes that have been pushed to the repo since then though, something may have broken.
Also I do not remember if the SPI dma functions may share some variable between both ports, they may, in which case if you try to use one port while a previous transfer has not finished for the other port, it may corrupt some variable and cause issues.

P.S. correction, I had all the above working on CoOS. I do not remember if I tested the same in FreeRTOS, but have no reason to believe it would not have worked the same.

Post Reply