ChibiOS 3.0.0 clean shutdown?

Discussions and support about ChibiOS/RT, the free embedded RTOS.
Post Reply
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

ChibiOS 3.0.0 clean shutdown?

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS 3.0.0 clean shutdown?

Post by Giovanni »

Hi,

You can use stStopAlarm().

Giovanni
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: ChibiOS 3.0.0 clean shutdown?

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS 3.0.0 clean shutdown?

Post 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
User avatar
Korken
Posts: 270
Joined: Wed Apr 02, 2014 4:09 pm
Has thanked: 5 times
Been thanked: 6 times

Re: ChibiOS 3.0.0 clean shutdown?

Post by Korken »

Ah, okey. Then I know that the functionality does not exist yet.
I will then disable the SysTick manually for now!
Post Reply