This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion


Good morning 

I would use the SysTick to generate an interrupt every 1ms, to toggle a pin.

If I have understood well I could use the following line of code to configure the systick

 SysTick_Config(SystemCoreClock / 1000);

Is it correct?

Besides in a startup.c file ( under the ra folder) the SysTick_Handler() is week reference to the default handler :-

 #define WEAK_REF_ATTRIBUTE    __attribute__((weak, alias("Default_Handler")))

void SysTick_Handler(void) WEAK_REF_ATTRIBUTE;

How and where in my application can I redefine the SysTick_Handler function?

Thabnks in advance

[locked by: IK_Renesas at 16:35 (GMT 0) on 12 Feb 2024]
  • Hello,

    Thanks for reaching out Renesas Engineering Community!

    In order to use SysTick to toggle a pin every x ms for example you should, provide in your code your own version of the SysTick handler to override the default weakly referenced default version.

    You can use as mentioned the CMSIS SysTick_Config() API to set the SysTick timer period and enable the SysTick timer.

    The ARM CMSIS Core Software is documented here:

    By doing an FSP search for "SysTick_Config" gives:

    By using  #include "hal_data.h" will include the correct CMSIS core_XXX.h  header file for the device being used in the project.

    You would have to provide your own version of the SysTick interrupt handler.

    To override the default weakly referenced version in startup.c file.

    I will attach for you an example for RA4M2 which is  blinking a led on EK-RA4M2 every 500 ms by configuring SysTick. This example could be used as a reference for each RA MCU. the process is the same.

    As you can see here the output on the led is toggling every 500 ms.

    The example is ported in FSP version 5.0.0.

    Hope it helps.



  • Thank you. It was helpful

  • We  are glad that we helped you! We would appreciate it, if you could please verify the answer you received, since this will also help  in the search process and other people in the Forum  Community who face similar issues with you.

    Thank you!



  • I have just a doubt, If I redefine the SysTick Handler as you did , when I compile I have a warning, No previous declaration of SysTick Handler.

  • I think it should be (SystemCoreClock/1000)-1

    Or that’s what is says in NXP’s manuals.

    so, if you have a 16MHz clock and you want an interrupt every second, set it to 15999999.

    I would have expected an entry on the FSP CLOCKs page to set whether Systick is clocked from LOCO or ICLK, but it appears that has to be done manually by setting or clearing bit 2 of Systick CSR.

    Is it 1 for ICLK and 0 for the Systick clock?