SysTick, core_cm3_psoc5.h SysTick_IRQn definition and Cylib

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
JeMe_288686
Level 1
Level 1

Pointing Cortex M3 Systick timer to your fonction using Cylib will not work if you use SysTick_IRQn definition from core_cm3_psoc5.h

   

CyIntSetSysVector(SysTick_IRQn,YourFonction)   this do not work.

   

Because SysTick_IRQn is define as -1 in core_cm3_psoc5.h

   

Systick vector number is 15.

   

So this works:  CyIntSetSysVector(15,YourFonction);

   

One more thing, SysTick_Config()  do not specify which clock is used.

   

In my case because I used USB, I deducted that the clock used was 48MHz.

   

So to get 1ms ticks I used :

   

if(SysTick_Config(48000)){while (1);}

   

I guess default clock is one of the clock at 48Mhz, but when I consulted the documentation, I was told that the clock for systick would be ILO.

   

Maybe I did not use the proper definition, but it is at least confusing.

   

It should be clear which clock is used and what definition we should used.

   

I proposed that CyLib should be modified so that CyIntSetSysVector works with SysTick_IRQn definition from core_cm3_psoc5.h

   

I also proposed that SysTick_Config should be modified to include clock selection if it is possible or to specify which clock is used.

   

jmer

0 Likes
0 Replies