I am currently working on a project with a Fujitsu MB96348 MCU. I was successfully using FreeRTOS 6.1.1 until now, yesterday I upgraded to FreeRTOS 7.0.0 to use the new timer API. Unfortunately my test application hangs as soon as I start a timer, even the tick generator stops working (I have a tick hook function that toggles an output of the MCU). My main() function looks like this:
void main(void)
{
xTaskHandle xBlinkTaskSlowHandle = NULL;
xTaskHandle xBlinkTaskFastHandle = NULL;
xTaskHandle xCANopenTaskHandle = NULL;
xTimerHandle xTestTimer1 = NULL;
xTimerHandle xTestTimer2 = NULL;
InitIrqLevels();
__set_il(7);
IO_Init(); /* configure I/Os */
xTaskCreate(
vBlinkTaskSlow,
( signed char * ) "BlinkTaskSlow",
configMINIMAL_STACK_SIZE,
NULL,
tskIDLE_PRIORITY + 3,
&xBlinkTaskSlowHandle);
xTaskCreate(
vBlinkTaskFast,
( signed char * ) "BlinkTaskFast",
configMINIMAL_STACK_SIZE,
NULL,
tskIDLE_PRIORITY + 2,
&xBlinkTaskFastHandle);
xTimerCreate(
( signed char ) "TestTimer1",
( 1000 / portTICK_RATE_MS),
pdTRUE,
1,
vTestTimer1Callback);
xTimerCreate(
( signed char ) "TestTimer2",
( 3000 / portTICK_RATE_MS),
pdTRUE,
2,
vTestTimer2Callback);
xTimerStart(xTestTimer1, 0);
xTimerStart(xTestTimer2, 0);
vTaskStartScheduler();
for(;;) {
unsigned int uiCount = 0;
for (uiCount = 0; uiCount < 2000000; uiCount++) {
__wait_nop();
}
PDR03_P3 = ~PDR03_P3;
}
}
The callback functions for the timers both look like this:
tmrTIMER_CALLBACK vTestTimer1Callback( xTimerHandle *xTimer )
{
PDR06_P6 = ~PDR06_P6; /* this toggles a LED */
}
The content of my FreeRTOSConfig.h is:
#define configMEMMODEL portMEDIUM
/* Demo specific definition - set this to 1 if you want to include the task
that writes trace and debug information to the UART. If it is set to 0 then
the ComTest tasks will be included in place of the trace task. */
#define INCLUDE_TraceListTasks 0
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*----------------------------------------------------------*/
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0 /* 1 by default */
#define configUSE_TICK_HOOK 1
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 180 ) /* This can be greatly reduced when using the small or medium memory model. */
#define configCPU_CLOCK_HZ ( ( unsigned long ) 48000000 ) /* Clock setup from start.asm in the demo application. */
#define configCLKP1_CLOCK_HZ ( ( unsigned long ) 48000000 ) /* Clock setup from start.asm in the demo application. */
#define configTICK_RATE_HZ ( (portTickType) 10000 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 6 )
#define configTOTAL_HEAP_SIZE ( (size_t) (3000) ) /* was 20000 before */
#define configMAX_TASK_NAME_LEN ( 20 )
#define configUSE_16_BIT_TICKS 1
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configUSE_TRACE_FACILITY 0 /* 1 by default */
#define configCHECK_FOR_STACK_OVERFLOW 1 /* 0 by default */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 2)
#define configTIMER_QUEUE_LENGTH 5
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 1
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) /* 4 by default */
/* 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 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vResumeFromISR 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define configKERNEL_INTERRUPT_PRIORITY 6
[code]
I think there might be a problem with the message queue, but I am not sure.
Does anybody have any suggestions where to look at? Is my configuration OK, or do I overlook a failure?
Thanks in advance!