System hang with enabled debug

Discussions and support about ChibiOS/RT, the free embedded RTOS.
Post Reply
daemon
Posts: 35
Joined: Tue Oct 09, 2012 1:53 pm

System hang with enabled debug

Post by daemon »

Hi!
Problem was found in ChibiOS/RT 3 (rev.7788): with enabled debug in chconf.h

Code: Select all

#define CH_DBG_SYSTEM_STATE_CHECK           TRUE
#define CH_DBG_ENABLE_CHECKS                TRUE
#define CH_DBG_ENABLE_ASSERTS               TRUE


Interrupt from timer TIM2 (STM32F105) generated after chThdSleepS() calling and before chSysUnlock(), resulting in lock_cnt != 0
See pictures. 1.png, 2.png, 3.png
Please suggest what is the reason and how to fix that. Is this a some sort of bug related to IRQ disable/enable while context switching or something?

Simple code:

Code: Select all

int main(void) {

    halInit();
    chSysInit();
 
    while (1) chThdSleepMilliseconds(100);
}

Thanks.
Attachments
step 3
step 3
3.png (41.53 KiB) Viewed 4725 times
step 2
step 2
2.png (43.45 KiB) Viewed 4725 times
step 1
step 1
1.png (39.78 KiB) Viewed 4725 times
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: System hang with enabled debug

Post by Giovanni »

Do you use priorities IRQ at level 0 or 1?

Giovanni
daemon
Posts: 35
Joined: Tue Oct 09, 2012 1:53 pm

Re: System hang with enabled debug

Post by daemon »

No, IRQ priorities at level 0/1 are not used.
Without debug in chconf.h system works, but I encountered some sort of hangs due to stack overflow or something during USB transfers, so decided to enable debug in ChibiOS and right after that I have found this issue (even without my code).
config files attached.
Attachments
config.zip
(4.74 KiB) Downloaded 493 times
daemon
Posts: 35
Joined: Tue Oct 09, 2012 1:53 pm

Re: System hang with enabled debug

Post by daemon »

with classic periodic time

Code: Select all

#define CH_CFG_ST_TIMEDELTA                 0

system works, no hangs. So I assume this is somewhat related to freerunning timer on TIM2.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: System hang with enabled debug

Post by Giovanni »

I committed changes earlier today, you should try those.

Giovanni
Post Reply