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

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

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

Jump to solution
6,737 Views
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 Kudos
1 Solution
5,976 Views
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

View solution in original post

4 Replies
2,726 Views
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 Kudos
5,977 Views
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,746 Views
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 Kudos
5,976 Views
jinshuaixu
Contributor V

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

0 Kudos