8.2.1 “queue.c” vs ASF 3.21.0 “freertos_spi_master.c”

Hi tasker, as the change started in FREERTOS, I start here as well. Problem: In queue.c there is a new (compared to 8.2.0) assert in: BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue, BaseType_t * const pxHigherPriorityTaskWoken ) *… */ Normally a mutex would not be given from an interrupt, and doing so is * definitely wrong if there is a mutex holder as priority inheritance makes no * sense for an interrupts, only tasks. */ *configASSERT( !( ( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) && ( pxQueue->pxMutexHolder != NULL ) ) ); *… unfortunately, Atmels ASF “freertosspimaster.c” (3.21.0) uses this and the assertion fails: static void local_spi_handler(const portBASE_TYPE spi_index) *… */ If the driver is supporting multi-threading, then return the access mutex. */ * if (tx_dma_control[spi_index].peripheral_access_mutex != NULL) { * xSemaphoreGiveFromISR( * tx_dma_control[spi_index].peripheral_access_mutex, * &higher_priority_task_woken); * } *… I used “freertosspimaster.c” and FR 8.2.0 w/o any problems (having HIGH SPI volume) so: what is the danger here if I would deactivate the assertion (of course in a first step!); I will ask the Atmel team as well in parallel (or is s/o from Atmel listening here?) Best and thanks, Stephan

8.2.1 “queue.c” vs ASF 3.21.0 “freertos_spi_master.c”

Hmm. Are you using the version of FreeRTOS that came with the ASF? Some changes were made to the mutexes to allow the priority inheritance to work better when more than one mutex was held. Also a new function was introduced specifically for giving semaphores in interrupts (for better performance). Probably the ASF code needs to be updated. I can talk with Atmel about this. In the mean time I would suggest updating the driver to use a binary semaphore created with xSemaphoreCreateBinary() rather than a mutex created with xSemaphoreCreateMutex(). Regards.

8.2.1 “queue.c” vs ASF 3.21.0 “freertos_spi_master.c”

Are you using the version of FreeRTOS that came with the ASF? nope; the FreeRTOS Version that comes with ASF 3.21.0 is “8.0.1”… I can talk with Atmel about this. That would be really nice!
Thanks and good night, Stephan

8.2.1 “queue.c” vs ASF 3.21.0 “freertos_spi_master.c”

Richard, I appear to be having this issue as well with ASF 3.26.0 and FreeRTOS 8.2.2 except in the TWI service for FreeRTOS, I haven’t tried with the SPI version yet. Are you aware of any resolution regarding this? For the time being it appears the FreeRTOS services in ASFwill not work with any FreeRTOS version newer than 8.1.2.

8.2.1 “queue.c” vs ASF 3.21.0 “freertos_spi_master.c”

PS – also experiencing this with ASF 3.20.1

8.2.1 “queue.c” vs ASF 3.21.0 “freertos_spi_master.c”

Anybody?

8.2.1 “queue.c” vs ASF 3.21.0 “freertos_spi_master.c”

I think the only way around this is to update the code so it uses a binary semaphore instead of mutex.

8.2.1 “queue.c” vs ASF 3.21.0 “freertos_spi_master.c”

Do you have any specific recommendation on how to best accomplish this with the ASF examples?