ATSAM3S4A FRTScore 8.2.3 + freertos-spi interface layer(service) (AtmelStudio 6.2)

andreyserg3 wrote on Sunday, December 06, 2015:

Hello, i’m newbie in FreeRTOS. There are ATMEL Studio 6.2 , core FRTOS 8.2.3, board based on ATSAM3S4A (not dev board) . I create new project , then added frm ASF Wizard freertos-spi(UART,TWI) interface layer(service) , replace a core 7.3.0 (wich added automatically ) with FRTOS 8.2.3, and for the first i make up only 1 task wich using uxTaskGetNumberOfTasks, vTaskList and output info to UART0, it’s work fine, then i add SPI func. - freertos_spi_write_packet ,it became crashing in xQueueGiveFromISR func. configASSERT( !( ( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) && ( pxQueue->pxMutexHolder != NULL ) ) );
FreeRTOSconfig: http://textuploader.com/5u50n
simpl. CODE : http://textuploader.com/5u5r6
STACK: http://postimg.org/image/o0znwes4v/

rtel wrote on Sunday, December 06, 2015:

This is due to a change in the way mutexes can be used. Try updating the ASF code so it creates a binary semaphore (xSemaphoreCreateBinary()) instead of a mutex (xSemaphoreCreateMutex()).

http://www.freertos.org/FreeRTOS_Support_Forum_Archive/April_2015/freertos_8.2.1_queue.c_vs_ASF_3.21.0_freertos_spi_master.c_788182fdj.html

andreyserg3 wrote on Monday, December 07, 2015:

Ok , i change in 2 places to xSemaphoreCreateBinary(), but now func freertos_spi_write_packet return ERR_TIMEOUT(-3) in

freertos_peripheral_control.c 
freertos_obtain_peripheral_access_mutex(freertos_dma_event_control_t *dma_event_control,portTickType *max_block_time_ticks)
{status_code_t return_value = STATUS_OK;
	xTimeOutType time_out_definition;
if (dma_event_control->peripheral_access_mutex != NULL) {
		/* Remember the time on entry. */
		vTaskSetTimeOutState(&time_out_definition);
 /* Wait to get exclusive access to the peripheral. */
if(xSemaphoreTake(dma_event_control->peripheral_access_mutex,*max_block_time_ticks) == pdFAIL) {
			return_value = ERR_TIMEOUT;  <-- COMING HERE
		} else {/* Adjust the time out value in case the task had to block to wait for the semaphore. */
			if (xTaskCheckForTimeOut(&time_out_definition,max_block_time_ticks) == pdTRUE) {*max_block_time_ticks = 0;}
		}
	}return return_value;}

The same project with FREERTOS 7.3.0 Library Work fine - return Status_OK(0)

rtel wrote on Monday, December 07, 2015:

If the 7.3.0 code works with the binary semaphore, but the 8.2.3 doesn’t
then I will need to dig a little deeper…

andreyserg3 wrote on Monday, December 07, 2015:

Tryed to use version 8.1.2 with default ASF -ALL OK , So I will use it, thanks for fast support!