STM32F1x: SV#8 error in systick ISR Topic is solved

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
greb
Posts: 10
Joined: Tue Apr 05, 2016 12:50 pm
Has thanked: 2 times
Been thanked: 3 times

STM32F1x: SV#8 error in systick ISR

Post by greb »

Hi,

I'm in the process to port one of my projects from ChibiOS 16.x to 18.x. I've enabled the debugging runtime-checks to hunt down possible bugs in my code base. Unfortunatly, whenever a thread sleeps it triggers SV#8 in the systick timer ISR.

Changing the timer or its IRQ priority doesn't help. And neither does reducing the code to the bare minimum (no devices active except PAL, no compiler optimizations, only main thread running, etc..). The clock settings seem to be correct too (TIMCLK[1,2] = 24 Mhz, CH_CFG_ST_FREQUENCY=5000).

Has someone any idea what I'm missing?

best regards,
greb

*edit: I forgot to mention that I run ChibiOS in tickless mode
Last edited by greb on Thu May 10, 2018 2:40 pm, edited 1 time in total.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F1x: SV#8 error in systick ISR

Post by Giovanni »

Hi,

Make a check on IRQ priorities, priorities from 0 to 2 are reserved and cannot call kernel functions.

Giovanni
greb
Posts: 10
Joined: Tue Apr 05, 2016 12:50 pm
Has thanked: 2 times
Been thanked: 3 times

Re: STM32F1x: SV#8 error in systick ISR

Post by greb »

Hi,

Thanks for the reply. According to the mcuconfig.h the IRQ priorities seem to look fine (e.g. STM32_ST_IRQ_PRIORITY=8).

I looked into the HAL ST code of ChibiOS and I didn't find any major changes between 16.x and 18.x. I'm somewhat perplexed. The HW runs 16.x without a problem.

best regards,
greb
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F1x: SV#8 error in systick ISR

Post by Giovanni »

Hi,

Not enough info, verify that all configuration files and makefiles come from 18.2.x. You may also try to port your code (gradually) on a template application taken from 18.2.

Giovanni
greb
Posts: 10
Joined: Tue Apr 05, 2016 12:50 pm
Has thanked: 2 times
Been thanked: 3 times

Re: STM32F1x: SV#8 error in systick ISR

Post by greb »

Hi,

I found out where the problem was, but not exactly why. By reducing the CH_CFG_INTERVALS_SIZE from 32 to 16 bit the problem disappered. The reason why I did it was to circumvent a failing debug-assert in chTimeAddX when the interval was set to TIME_INFINITE. This solved not only my other problem, but also the SV#8 systick issue.

best regards,
greb
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F1x: SV#8 error in systick ISR

Post by Giovanni »

Hi,

Is you system time set to 16 or 32 bits? it does not explain the SV#8 anyway, strange.

Giovanni
greb
Posts: 10
Joined: Tue Apr 05, 2016 12:50 pm
Has thanked: 2 times
Been thanked: 3 times

Re: STM32F1x: SV#8 error in systick ISR

Post by greb »

Hi,

I'm using 16bit system time, because the chip only has 16bit timers.

It is my intuition that when the system time type and the interval type are different there are some strange corner cases which might fail (int overflow maybe?). But I have no hard evidence yet.

best regards,
greb
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F1x: SV#8 error in systick ISR

Post by Giovanni »

16 bits timers should work with 32 intervals, this is the whole point of the change. Let me know if you find something.

Giovanni
Post Reply