Quality RTOS & Embedded Software

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




Loading

How to obtain delay in the order of 50us on TMDX570LC43HDK with FreeRtos

Posted by etantonio on November 21, 2017

Hy, I would like to obtain delay in the order of 50us on a FreeRTOS having a tick of 1ms (1000Hz) on TMDX570LC43HDK, I'm almost sure that this is a non sense, so the solution could be a tick for example of 10us, is it a realistic solution to this kind of problem? Thanks Antonio


How to obtain delay in the order of 50us on TMDX570LC43HDK with FreeRtos

Posted by tlafleur on November 21, 2017

No, leave tick at 1 to 100ms and use a timer on interrupts for your delay. If it happen infrequently, you might be able to use a delay loop. All depends on your system design.

Haveing a tick at 50 or 10us would use a lot of CPU resources in the FreeRTOS scheduler doing nothing very useful.

On Tue, Nov 21, 2017 at 9:39 AM Etantonio etantonio@users.sf.net wrote:

Hy, I would like to obtain delay in the order of 50us on a FreeRTOS having a tick of 1ms (1000Hz) on TMDX570LC43HDK, I'm almost sure that this is a non sense, so the solution could be a tick for example of 10us, is it a realistic solution to this kind of problem? Thanks

Antonio

How to obtain delay in the order of 50us on TMDX570LC43HDK with FreeRtos

https://sourceforge.net/p/freertos/discussion/382005/thread/056332df/?limit=25#cd8e

Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/freertos/discussion/382005/

To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

~~ _/) ~~~~ _/) ~~~~ _/) ~~~~ _/) ~~

Tom Lafleur

Attachments

alternate (1976 bytes)

How to obtain delay in the order of 50us on TMDX570LC43HDK with FreeRtos

Posted by heinbali01 on November 21, 2017

Antonio, in my opinion: when you need a delay of more that a ms, you could have the task sleep by calling e.g. vTaskDelay().

When you want to wait for 50 uS, you can go either of two ways:

  • Set-up a timer-counter that you can poll and wait 50 uS in a loop.
  • Write a loop that has a predictable speed of execution.

Take care with the latter, when you change the optimisation level of the compiler, a loop could be implemented differently, or even not be compiled at all. One solution to this is to write the loop as assembler code.

Here is an example from Atmel:

~~~ void portabledelaycycles(unsigned long n) { UNUSED(n); /* n is passed in the register r0 */ asm volatile ( "loop: DMB n" "SUBS R0, R0, #1 n" "BNE.N loop " ); } ~~~


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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