how to set systick to get microsecond(us) delay in use s32k144

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

how to set systick to get microsecond(us) delay in use s32k144

跳至解决方案
6,948 次查看
jinshuaixu
Contributor V

hello

        S32DS software has the  delay function.the example project that s32ds provide is millisecond(ms) delay "OSIF_TimeDelay(1)", now I want to use microsecond(us) delay ,how l acquire this function ,please help me if you know how to configuration register or give me example project. thank you.

0 项奖励
1 解答
6,187 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello,

The OSIF implementation can be found in the osif_baremetal.c file.

pastedImage_1.png

pastedImage_2.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

Regards,

Daniel

在原帖中查看解决方案

4 回复数
2,937 次查看
Eashwar
Contributor I

Hi Daniel,

I also have the same requirement to generate microsecond delay, but my Controllers is MPC5777C. OSIF is connected to PIT(default) and its frequency is 100MHz. I have also followed your instructions and updated divider value in "static inline void osif_UpdateTickConfig(void)" function, as shown in image below.

Eashwar_0-1676188907576.png

 

The problem is when I call "OSIF_TimeDelay(1)" program pointer is struck in  "osif_Tick()".

Kindly provide suitable solution.

Eashwar_1-1676188965230.png

Regards,

Eashwar

 

 

0 项奖励
6,188 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello,

The OSIF implementation can be found in the osif_baremetal.c file.

pastedImage_1.png

pastedImage_2.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

Regards,

Daniel

2,957 次查看
Eashwar
Contributor I

Hi Daniel,

I also have the same requirement to generate microsecond delay, but my Controllers is MPC5777C. OSIF is connected to PIT(default) and its frequency is 100MHz. I have also followed your instructions and updated divider value in "static inline void osif_UpdateTickConfig(void)" function, as shown in image below.

Eashwar_0-1676036429456.png

 

The problem is when I call "OSIF_TimeDelay(1)" program pointer is struck in  "osif_Tick()".

Kindly provide suitable solution.

Eashwar_1-1676036643526.png

Regards,

Eashwar

0 项奖励
6,187 次查看
jinshuaixu
Contributor V

thank you for you response, l have test the way you you offer,the result is correct.

0 项奖励