Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

Timer-API with Fujitsu FX - Application hangs

Posted by on April 15, 2011
Hi,
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_TraceListTasks0

/*-----------------------------------------------------------
* 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_PREEMPTION1
#define configUSE_IDLE_HOOK0/* 1 by default */
#define configUSE_TICK_HOOK1
#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_TICKS1
#define configIDLE_SHOULD_YIELD1
#define configUSE_MUTEXES1
#define configUSE_TRACE_FACILITY0/* 1 by default */
#define configCHECK_FOR_STACK_OVERFLOW1/* 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_ROUTINES1
#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_vTaskPrioritySet1
#define INCLUDE_uxTaskPriorityGet1
#define INCLUDE_vTaskDelete1
#define INCLUDE_vTaskCleanUpResources1
#define INCLUDE_vTaskSuspend1
#define INCLUDE_vResumeFromISR1
#define INCLUDE_vTaskDelayUntil1
#define INCLUDE_vTaskDelay1
#define INCLUDE_xTaskGetSchedulerState1
#define INCLUDE_xTaskGetCurrentTaskHandle1

#define configKERNEL_INTERRUPT_PRIORITY 6


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!

RE: Timer-API with Fujitsu FX - Application hangs

Posted by on April 15, 2011
The problem is solved. I didn't sore the return value of the xTimerCreate() -calls, so xTimerStart() always got a NULL handle as first parameter. My fault :)

I am used to get an initialized task handle if I call xTaskCreate(), that was the reason why I had to search for the mistake quite long. IMHO it is some kind of design inconsistency to hand over a task handly by parameter, but pass a timer handly by return value. Maybe the developers might think about that ;)

RE: Timer-API with Fujitsu FX - Application hangs

Posted by on April 15, 2011
The problem is solved. I didn't sore the return value of the xTimerCreate() -calls, so xTimerStart() always got a NULL handle as first parameter. My fault :)

I am used to get an initialized task handle if I call xTaskCreate(), that was the reason why I had to search for the mistake quite long. IMHO it is some kind of design inconsistency to hand over a task handly by parameter, but pass a timer handly by return value. Maybe the developers might think about that ;)


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS