Quality RTOS & Embedded Software

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


Loading

crosswork and sheduler

Posted by ing_fox on November 20, 2007
hello,

When I create a task, the programme bug in "portRESTORE_CONTEXT()" .
The stack is ok, but "portRESTORE_CONTEXT()" doesn't go to my fonction (adresse:0x37e) but at the adresse 0xa5a5a5.

With the debugger, no probleme until the macro "portRESTORE_CONTEXT()".


this is my source:

main()
{
//ini du port 2 pour les led
vParTestInitialise();

//creation de la tache
xTaskCreate( LED, "LED", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );

//lancement du scheduler
vTaskStartScheduler();


}

void vParTestInitialise( void )
{
PINSEL10 = 0;
FIO2DIR = 0x000000FF;
FIO2MASK = 0x00000000;
FIO2CLR = 0xFF;
SCS |= (1<<0); //fast mode for port 0 and 1
}

void LED(void *pvParameters )
{
FIO2CLR = 0xff;
vTaskDelay( 10 );
FIO2SET = 0xFF;
}

And this is my RTOSconfig:

#define configUSE_PREEMPTION1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 57600000 )/* =12Mhz xtal multiplied by 5 using the PLL. */
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES( ( unsigned portBASE_TYPE ) 4 )
#define configMINIMAL_STACK_SIZE( ( unsigned portSHORT ) 104 )
#define configTOTAL_HEAP_SIZE( ( size_t ) ( 18 * 1024 ) )
#define configMAX_TASK_NAME_LEN( 10 )
#define configUSE_TRACE_FACILITY1
#define configUSE_16_BIT_TICKS0
#define configIDLE_SHOULD_YIELD1
#define configUSE_MUTEXES1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

some idea?
Thank.

RE: crosswork and sheduler

Posted by Borut on November 20, 2007
Hello,

first idea is that you are missing a for(;;){} loop inside your LED task: try this

void LED(void *pvParameters )
{
for(;;) {
FIO2CLR = 0xff;
vTaskDelay( 900 );
FIO2SET = 0xFF;
vTaskDelay( 10 ); //this will give you a blinking led
}
}

RE: crosswork and sheduler

Posted by Dmitriy on November 20, 2007

The task that you create (function LDE) must to have no end. For example it must have

while (1==1)
{

do something
}

For testing value 0xa5a5a5 is puting in the stack. That is why your task is returned to this adress.

RE: crosswork and sheduler

Posted by ing_fox on November 20, 2007
thank

I have actually forget for(;;). (i have made many test a for the last i forget it)
I have add for(;;) but have the same error.....
i bug and go out....

//correction source
void LED(void *pvParameters )
{
for(;;)
{
FIO2CLR = 0xff;
vTaskDelay( 10 );
FIO2SET = 0xFF;
}
}

somme other idea? or somebody have an exemple with a single function (led toggle) that work in FreeRTOS (for start with this apply and after change it)?

PS : i work in MCB2300 with lpc2378

thank

RE: crosswork and sheduler

Posted by Borut on November 20, 2007
Hello,

i have a simple LED flash done which is done with Rowley (what IDE are you using?). Here is some of my code:

//this is in my FreeRTOSConfig

#define configUSE_PREEMPTION1
#define configUSE_IDLE_HOOK0
#define configUSE_TICK_HOOK0
#define configCPU_CLOCK_HZ( ( unsigned portLONG ) 60000000 )/* =12MHz * 5 with PLL. */
#define configTICK_RATE_HZ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES( ( unsigned portBASE_TYPE ) 6 )
#define configMINIMAL_STACK_SIZE( ( unsigned portSHORT ) 128 )
#define configTOTAL_HEAP_SIZE( ( size_t ) ( 5 * 1024 ) )
#define configMAX_TASK_NAME_LEN( 16 )
#define configUSE_TRACE_FACILITY0
#define configUSE_16_BIT_TICKS0
#define configIDLE_SHOULD_YIELD1

/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#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_vTaskPrioritySet1
#define INCLUDE_uxTaskPriorityGet1
#define INCLUDE_vTaskDelete1
#define INCLUDE_vTaskCleanUpResources0
#define INCLUDE_vTaskSuspend1
#define INCLUDE_vTaskDelayUntil1
#define INCLUDE_vTaskDelay1

next i manually set the PLL:

static void vClockInit( void )
{
// Fosc = 12MHz, CCLK = 60MHz
// M = Fosc/CCLK = 5 (M = 5 - 1)
// P = Fcco/(2*CCLK) = 2 (P = 2 - 1)
PLLCFG = 0x23;
//PLLCFG = 4 | (1 << 4);
PLLCON = 0x01; // PLL enable

PLLFEED_SEQUENCE;

// wait for PLL lock to requested frequency
while( (PLLSTAT & 0x400) == 0 );

PLLCON = 0x03; // connect PLL clock to processor clock
PLLFEED_SEQUENCE;

APBDIV = 0x01; // peripheral clock is processor clock

MAMCR = 0x00; // MAM disable
MAMTIM = 0x03; // MAM fetch cycles are 3 CCLKs in duration
MAMCR = 0x02; // MAM enable
}

also, my LED task has priority defined as:
#define LedTASK_PRIORITY ( tskIDLE_PRIORITY + 1 )


Maybe this will help.

RE: crosswork and sheduler

Posted by Dave on November 20, 2007
Are you starting the scheduler is Supervisor mode? Under CrossWorks you have to have SUPERVISOR_START defined. Use the demo app as a start so you get all the configuration required.

RE: crosswork and sheduler

Posted by sashiono on November 21, 2007
//correction source
void LED(void *pvParameters )
{
for(;;)
{
FIO2CLR = 0xff;
vTaskDelay( 10 );
FIO2SET = 0xFF;
}
}


you need to have another delay to see the blink

//corrected correction source
void LED(void *pvParameters )
{
for(;;)
{
FIO2CLR = 0xff;
vTaskDelay( 10 );
FIO2SET = 0xFF;
vTaskDelay( 10 );
}
}


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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner