s32k144 时延函数

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

s32k144 时延函数

142 Views
fengba
Contributor I

I would like to implement a function that can generate a delay of 1 microsecond (1us) and 1 millisecond (1ms). Could you please tell me the methods or provide example code?

0 Kudos
Reply
1 Reply

125 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @fengba,

Please take a look into the OSIF module, function void OSIF_TimeDelay(const uint32_t delay).

Julin_AragnM_0-1718126761385.png

The reload value of the SysTick is the core frequency divided by 1000, that means that the Systick interrupt is called every 1ms and increment the s_osif_tick_cnt counter.

The counter is then read and compered by the OSIF_TimeDelay() function.

If the core frequency was divided by 10000, the counter would increment every 100us (OSIF_TimeDelay(1) = 100us).

The SysTick description can be found in ARM documentation: Cortex™-M4 Devices Generic User Guide, Section 4.4 System timer, SysTick.

Best regards,
Julián

0 Kudos
Reply