Quality RTOS & Embedded Software

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


Loading

coretex-m4(STM32F407VG discovery) Questions about implementing vTaskDelay and Delay

Posted by jonginkk on January 12, 2018

Hello. I am new to FreeRTOS. I have analyzed and understood the Scheduling method using Task. I want to run the PID control source through FreeRTOS scheduling.

I included several functions in the FreeRTOS, such as the libraries tmstm32f4delay.h and tmstm32f4delay.c, which were imported from outside, and found that SysTickHandler duplicated. tmstm32f4_delay.c defines the millis and delay functions we need to do the PID.

To solve this problem, I commented out the SysTickHandler in the section of tmstm32f4delay.c and solved the compilation problem. I understood that [[#define xPortSysTickHandler SysTickHandler]], which is embedded in FreeRTOS, is used for interrupts and is absolutely necessary.

After all, we need to implement the Delay function needed for the PID. The tool I am using is IAR.

The above is a description of the situation I experienced, and the questions are as follows.

  1. I want to use the function defined in the header file included in TaskFunction via vTaskDelay. Can this header file serve as a delay through a function called vTaskDelay?

  2. I read the contents of https://www.freertos.org/FreeRTOSSupportForumArchive/November2013/freertosconfigTICKRATEHZ8fc54ac4j.html, but I do not understand. We implemented a delay using the vTaskDelay function, but this did not allow accurate ms Delay. I set it to #define configTICKRATEHZ ((TickTypet) 1000) and I wanted a delay of 500ms, but when I measured it with an oscilloscope, it took about 2 seconds of delay. There is only one externalLED_TASK task to operate.

//delay.h function void externaldelaytest (void) { // const TickTypet xDelay = 500 / portTICKPERIODMS;        unsigned int niCnt = 0;     for (;;)     { // vTaskList (ptrTaskList); // printf ("ptrTaskList n");         if ((niCnt% 2) == 0)         {             GPIOSetBits (GPIOD, GPIOPin4);         }         else if ((niCnt% 2) == 1)         {             GPIOResetBits (GPIOD, GPIOPin4);         }         // puts ("LED2");         printf ("PD4 ::::% d n", n_iCnt);

        vTaskDelay (500);         n_iCnt ++;     } }

//main.c Taskfunction void externalLEDTASK (void * pvParameter) {   externaldelaytest ();   / *   for (;;)   {     externaldelaytest ();   }   * / }

  1. Is the structure I think is wrong? If so, can you use vTaskDelay to delay for exactly one second? Or can I re-implement Delay?

I need help.


coretex-m4(STM32F407VG discovery) Questions about implementing vTaskDelay and Delay

Posted by rtel on January 15, 2018

Think this is a duplicate of https://sourceforge.net/p/freertos/discussion/382005/thread/6ee2acb9/ that for some reason got stuck in the moderation queue that is not supposed to exist.


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


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

Latest News

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