Quality RTOS & Embedded Software

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


Loading

vTaskDelay and vTaskDelayUntil on pic18f452

Posted by GMcapivara Chess on March 7, 2010

Hi. First I apologise for my poor english. Now I'm having a feel problems with the functions vTaskDelay and vTaskDelayUntil on pic18f452. They simply doesn't work. I set
#define INCLUDE_vTaskDelayUntil1
#define INCLUDE_vTaskDelay1
and when I use the functions on the example on website:

void vTaskFunction( void * pvParameters )
{
portTickType xLastWakeTime;
const portTickType xFrequency = 10;

// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount();

for( ;; )
{
// Wait for the next cycle.
vTaskDelayUntil( &xLastWakeTime, xFrequency );

// Perform action here.
}
}
the process block indefinitely. When I comment the function delay and put a for to make a delay and toggle a led the function work's fine. It's analogue when I use the example with vTaskDelay.

suggestions?

RE: vTaskDelay and vTaskDelayUntil on pic18f452

Posted by MEdwards on March 7, 2010
Sounds like the tick interrupt is not executing as expected. Put a break point in the tick interrupt handler and see if it ever gets hit. Alternatively remove the call to vTaskDelay() and instead just loop round calling xTaskGetTickCount() to see if the value returned ever increases.

RE: vTaskDelay and vTaskDelayUntil on pic18f452

Posted by GMcapivara Chess on March 18, 2010
well...more news....
putting some break points I found this......the ticks are ok....but I think there is a problem with the memory allocation for the process....for example:

void toggleLed(int i)
{
int j;
TRISD = 0x00;
PORTD = 0x10;
for( j=0; jPORTD = 0x00;
for( j=0; j}

void vTaskCode( void * pvParameters )
{
int i;
for( ;; )
{
i = 10000;
toggleLed(i);
}
}

void main(void)
{
vPortInitialiseBlocks();
for(;;) { toggleLed(10000); }
//xTaskCreate( vTaskCode, ( const char * const ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
vTaskStartScheduler();
}

the code works fine....but when I comment the for in main and uncomment the xTaskCreate, putting a break point on the toggleLed(i) on the process, when I step into toggleLed the value of parameter "i" becomes 0.....

this is problem with memory allocation right?


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


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

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo, Nuvoton Cortex-M23 demo & STM32H745 dual core (AMP) demo.

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

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

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Mediatek

Renesas

RISC-V

SiFIve RISC-V

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