i want use a hardware delay instead of vtaskdelay()

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i want use a hardware delay instead of vtaskdelay()

767 Views
nsnmaniram
Contributor III

hi,

there is any way to implement a hardware delay on imxrt1050 instead of vtaskdelay().

Thanks,

Maniram

Labels (1)
0 Kudos
1 Reply

665 Views
davidrozenski
Contributor I

Somethings like that :

static void delay(uint32_t val)
{
uint32_t coreClock = SystemCoreClock; /* in Hz */
uint32_t ticksPerMicroSec = coreClock / 1000000; /* Target runs at 600 MHz => 600 */
volatile uint32_t ticksToWait = 1000 * val * ticksPerMicroSec / 8; /* Divide by 8 to get proper timing */

while(ticksToWait--)
{
__asm("NOP"); /* delay */
}
}

However I do not recommend since you will lock all tasks by doing this.

0 Kudos