crosswork and sheduler
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_PREEMPTION 1
#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_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
some idea?
Thank.
crosswork and sheduler
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
}
}
crosswork and sheduler
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.
crosswork and sheduler
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
crosswork and sheduler
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_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#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_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
/* 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_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
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.
crosswork and sheduler
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.
crosswork and sheduler
//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 );
}
}