flashyarm wrote on Sunday, April 24, 2011:
Hello richardbarry,
I will try once again, i was a but frustrated after spending alot of hours yesterday, so i should have waited with posting here until i had rested my mind a little.
Development board: Luminary Micro LM3S6965 Ethernet Eval Board
Software: CrossStudio for ARM 2.0
Compiler: GCC
FreeRTOS version: V6.1.1
This morning i attended to make a fresh install of FreeRTOS, as the install before was a import from Red Suite and sadly the problem is still the same.
Anyhow as mentioned i have made a fresh install, and implemented only the code which has been causing the “damage”.
main.c:
int main(void) {
portBASE_TYPE create_check = pdTRUE;
setupHardware();
// ---------- Create semaphores/mutex ----------
lcd_keypad_shared_pins_mutex = xSemaphoreCreateMutex();
if (lcd_keypad_shared_pins_mutex == NULL)
{
SET_BIT_LOW(PORTD_DATA, PD6);
while(1); // could not create queue
}
// ---------- Create queues ----------
// ---------- Create tasks ----------
create_check = xTaskCreate( lcd_task, ( signed portCHAR * ) "LCDTASK", USERTASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL);
if (create_check != pdTRUE)
{
SET_BIT_LOW(PORTD_DATA, PD6);
while(1); // could not create task.
}
create_check = xTaskCreate( ui_task, ( signed portCHAR * ) "UITASK", USERTASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL);
if (create_check != pdTRUE)
{
SET_BIT_LOW(PORTD_DATA, PD6);
while(1); // could not create task.
}
/*
* Start the scheduler.
*/
vTaskStartScheduler();
/*
* Will only get here if there was insufficient memory to create the idle task.
*/
return 1;
}
lcd.c (useage of mutex):
xSemaphoreTake(lcd_keypad_shared_pins_mutex, portMAX_DELAY );
// Uninteresting code to drive a LCD
xSemaphoreGive(lcd_keypad_shared_pins_mutex);
FreeRTOSConfig.h
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 50000000 )
#define configTICK_RATE_HZ ( ( portTickType ) 200 )
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 60 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2800 ) )
#define configMAX_TASK_NAME_LEN ( 12 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
#define configUSE_CO_ROUTINES 0
#define configUSE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 0
#define configUSE_ALTERNATIVE_API 0
#define configCHECK_FOR_STACK_OVERFLOW 0
#define configUSE_RECURSIVE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 10
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define configKERNEL_INTERRUPT_PRIORITY 255
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xa0, or priority 5. */
When i debug the piece of code where i take the Mutex in use and “watch” the Take and Give of the Mutex, straigh after the Take has been executed it goes into FaultISR and basically never reaches the Give.
--- LM3S_Startup_Custom.s -- 138 ---------------------------
DEFAULT_ISR_HANDLER Fault_ISR
E7FE b 0x00000204 <Fault_ISR>
I hope my information is a bit more sufficient now, else please let me know i will try to provide as much as possible!