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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
7,583件の閲覧回数
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,822件の閲覧回数
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 返答(返信)
3,572件の閲覧回数
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,823件の閲覧回数
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

3,592件の閲覧回数
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,822件の閲覧回数
jinshuaixu
Contributor V

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

0 件の賞賛
返信