Page 1 of 1

ChibiOS 3.0.0 clean shutdown?

Posted: Mon Mar 23, 2015 12:02 am
by Korken
Hi all,

After trying to implement the clean shutdown of ChibiOS (before enabling a bootloader) I have run into a function I cannot find.
In the guide here (even though it is for an old version) http://chibios.org/dokuwiki/doku.php?id ... os:stop_os the function stop_system_timer(); seems to disable the systick, is this correct?
The thing is that I look a lot in the 3.0.0 code but I cannot find a function for this. Does it exist?
If not, can it be added? It seems very strange that the user should disable something manually that the OS started automatically.

Just a chSysDisableSystemTimerI or something like that.

Best Regards
Emil

Re: ChibiOS 3.0.0 clean shutdown?

Posted: Mon Mar 23, 2015 9:12 am
by Giovanni
Hi,

You can use stStopAlarm().

Giovanni

Re: ChibiOS 3.0.0 clean shutdown?

Posted: Mon Mar 23, 2015 2:49 pm
by Korken
Hi Giovanni, thanks for the reply!

Could you please elaborate?
Because when I look at the function there are two warning signs:

1. I am using systick, so this warning seems to apply to me.

Code: Select all

 * @note    This functionality is only available in free running mode, the
 *          behavior in periodic mode is undefined.


2. It does not seem to disable systick:

Code: Select all

static inline void st_lld_stop_alarm(void) {

  STM32_ST_TIM->DIER = 0;
}

Should this function not be something like this to differentiate ticked and tickless mode:

Code: Select all

static inline void st_lld_stop_alarm(void) {

#if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING
  /* Free running counter mode.*/

  STM32_ST_TIM->DIER = 0;

#endif /* OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING */

#if OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC
  /* Periodic systick mode, the Cortex-Mx internal systick timer is used
     in this mode.*/

  SysTick->CTRL = 0;

#endif /* OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC */

}
?


Best Regards
Emil

Re: ChibiOS 3.0.0 clean shutdown?

Posted: Mon Mar 23, 2015 2:56 pm
by Giovanni
It works in tickless mode only.

There is no way to stop the systick timer unless you stop it manually. I will look into this after 3.0 release.

Giovanni

Re: ChibiOS 3.0.0 clean shutdown?

Posted: Mon Mar 23, 2015 3:16 pm
by Korken
Ah, okey. Then I know that the functionality does not exist yet.
I will then disable the SysTick manually for now!