FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [June 2012 Threads] P&E ICD Resetting for HCS12 BankedPosted by gisthandler on June 6, 2012 So I've been working on the HCS12 Banked coding and have gotten two of my testing tasks to compile. However, when I'm running it through the Multilink USB on the Codewarrior debugger, I have to keep pressing Start/Continue or the reset button on the microcontroller in order for the task to run. Any suggestions?
Thanks, Peter
RE: P&E ICD Resetting for HCS12 BankedPosted by Erich Styger on June 6, 2012 Hard to tell with the information given. But could it be that you have the watchdog enabled? Then you will get a watchdog reset and the debugger will show you the startup code (if you are not resetting the watchdog timer properly). Does it work for you in non-banked memory model? And do you say it works without the debugger? Without the debugger and if the watchdog triggers your board will simply reset so you might not notice what happend. I remember I have fixed several items for the banked memory model in the port on http://mcuoneclipse.wordpress.com/2012/02/11/back-to-classic-freertos-for-freescale-s12x/.
Erich
RE: P&E ICD Resetting for HCS12 BankedPosted by gisthandler on June 6, 2012 It turns out the tasks runs after I exit from the debugger and press reset. However, only one of my two tasks are working:
/*IR sensor for object detection*/ xTaskCreate( prvTestTask1, "A2D_INPUT", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 3, NULL ); /*Motor control*/ xTaskCreate( prvTestTask2, "MOTOR_INPUT", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 3, NULL );
When both of the task's priority's are the same only, "MOTOR_INPUT" will work. However, if I set the priority of "A2D_INPUT" higher, then the "A2D_TASK" will work, but the other one won't. Any suggestions?
Thanks, Peter
RE: P&E ICD Resetting for HCS12 BankedPosted by Dave on June 7, 2012 When both priorities are the same the scheduler will time slice both tasks (round robin with time slicing). When one task has a priority higher than the other then the scheduler will run the highest priority task whenever the high priority task can run. The high priority task can run if it is not blocked or suspended. I assume then that your A2D_INPUT task never blocks, but you have not posted its code, so I cannot be certain. Does it ever block on a queue or semaphore, or ever call vTaskDelay() or vTaskDelayUntil()?
RE: P&E ICD Resetting for HCS12 BankedPosted by gisthandler on June 7, 2012 I have added the vTaskDelay for the A2D_INPUT task, but haven't added it on the MOTOR_INPUT. Does vTaskDelay() and vTaskDelayUntil() help set and release the mutex locks?
Thanks, Peter
/*--------------------A2D_INPUT-------------------------------*/
static void prvTestTask1( void *pvParameters ) { for( ;; ) { while (!(ATD1STAT0)){} /*Waits for A2D to be ready*/ read_value = ATD1DR0; /*Reads voltage*/ display = read_value/200; /*Converts approximate digital reading*/ if(display < 4) { /*Vinput = 5 V*/ PORTA = 0x01; /*If less than 4 volts, light LED*/ } else{ PORTA = 0x00; } ATD1CTL5 = 0x80; /*Reset A2D*/ vTaskDelay( mediumDelay ); } } /*--------------------MOTOR_INPUT-----------------------------*/
static void prvTestTask2( void *pvParameters ) { for( ;; ) { pulse(); /*Sets high and low*/ delay(300); /*based on flag and delay using IOC0*/ } }
RE: P&E ICD Resetting for HCS12 BankedPosted by MEdwards on June 7, 2012 I can't see any mutexes in your code? Can you explain?
In the code you poste, if prvTestTask1 is the higher priority task then it should be ok. If prvTestTask2() is the higher priority task then prvTestTask1 will never execute because prvTestTask2 will run all the time.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|