System dies after several days - system tick problem?
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: System dies after several days - system tick problem?
I will look into instrumenting that code some more.
Giovanni
Giovanni
Re: System dies after several days - system tick problem?
Im also getting errors when working with Virtual Timers on a Stm32f4-discovery.
Im using the chibios 3.0 release inside the latest Chibistudio and compiling with -O2.
Setting timer Virtualtimer for the first time, inside a normal thread:
Callback:
Always when running the chVTSetI inside the callback, it hangs with reason: 0x8002760 "stStartAlarm".
BUT, its works flawlessly when compiling with -O0 instead of -O2.
Any thoughts?
Im using the chibios 3.0 release inside the latest Chibistudio and compiling with -O2.
Setting timer Virtualtimer for the first time, inside a normal thread:
Code: Select all
chSysLock();
chVTDoSetI(&vt_can_broadcast, MS2ST(2000), can_vt_cb, NULL);
chSysUnlock();Callback:
Code: Select all
void can_vt_cb(void* arg){
chSysLockFromISR();
chBSemSignalI(&SemCanVt);
chVTSetI(&vt_can_broadcast, MS2ST(2000), can_vt_cb, arg);
chSysUnlockFromISR();
};Always when running the chVTSetI inside the callback, it hangs with reason: 0x8002760 "stStartAlarm".
BUT, its works flawlessly when compiling with -O0 instead of -O2.
Any thoughts?
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: System dies after several days - system tick problem?
Interesting, I have to verify that scenario (setting a timer from a timer callback).
Giovanni
Giovanni
Re: System dies after several days - system tick problem?
After adding some more code to the program it hangs up even with -O0.
Only way to make it work is to make the thread sleep for a certain time instead of using a virtual timer to release a semaphore.
Only way to make it work is to make the thread sleep for a certain time instead of using a virtual timer to release a semaphore.
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: System dies after several days - system tick problem?
Don't worry, that error is a very specific error condition, should be easy to implement a fix.
Giovanni
Giovanni
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: System dies after several days - system tick problem?
Hi,
I committed a tentative fix for this issue, could you test it?
Giovanni
I committed a tentative fix for this issue, could you test it?
Giovanni
Re: System dies after several days - system tick problem?
Going backwards from my perspective, I'm afraid.
The code I started running on 14th March is still running - 10 days continuous operation (unless we had a power cut, which I would probably have noticed). This is using a delta of 2. It had some improvements over the code which originally triggered my post; these eliminated a couple of virtual timers (most of the time) and also increaased the minimum timeout to 2ms.
Since then I've made a small improvement in what I believe to be my longest ISR (character receive) although retriggering a virtual timer is probably the longest part of the execution time.
This evening I've run the latest Chibi repository contents and my latest code with deltas of 2, 3 and 4, and all fail. With delta=2 it took around an hour, while with larger deltas it was minutes or less.
I'll try and roll back my code to the version that's been running for a long time, in case I've unintentionally broken something. That'll be tomorrow evening.
The code I started running on 14th March is still running - 10 days continuous operation (unless we had a power cut, which I would probably have noticed). This is using a delta of 2. It had some improvements over the code which originally triggered my post; these eliminated a couple of virtual timers (most of the time) and also increaased the minimum timeout to 2ms.
Since then I've made a small improvement in what I believe to be my longest ISR (character receive) although retriggering a virtual timer is probably the longest part of the execution time.
This evening I've run the latest Chibi repository contents and my latest code with deltas of 2, 3 and 4, and all fail. With delta=2 it took around an hour, while with larger deltas it was minutes or less.
I'll try and roll back my code to the version that's been running for a long time, in case I've unintentionally broken something. That'll be tomorrow evening.
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: System dies after several days - system tick problem?
I think you should not seek solutions that minimize the problem, that would be hiding the real cause. If you could put together a small project that I could test it would be the best solution, try to maximize the effect instead.
Giovanni
Giovanni