how to do mdelay on M4

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

how to do mdelay on M4

484 次查看
run_zhao
Contributor I

Hi,NXP Expert,

    l can not find mdelay function In sample code for i.MX8M Mini 's M4, if we need delay 1ms ,how to implement it ?

as below

void mDelay(iTE_u16 Delay_Count)
{
   uint32_t i;
   while(Delay_Count--)
       {
              for (i = 0; i < 1000; i++) {
                __NOP();
              }
       }
}

but l am not sure how many __NOP() use ? how to compute it ?

thanks

标签 (1)
0 项奖励
回复
1 回复

432 次查看
b36401
NXP Employee
NXP Employee

Actually it depends on the compiler how it to realize this loop.
I can suggest to set some amount of NOPs measure the delay and then correct it.

0 项奖励
回复