Possible RtcCallback problem
Posted: Sun Mar 04, 2012 11:36 pm
Hi Giovanni,
We have implemented an LCD driver with Mutex, and also a RTC Callback (in main.c) at 1 second interval. The callback calculates the current H:M:S and displays it on the LCD. All draw functions are enclosed with
chMtxLock(&LCDD.mutex); <code> chMtxUnlock();
We have several other source.c that do graphic functions, and we found that it was necessary to
use
extern void realTimeClockCallback;
so we can call ...
rtcSetCallback(&RTCD1,NULL);
<lcd draw code>
rtcSetCallback(&RTCD1,&realTimeClockCallback);
otherwise there would be lock up issues.
So here's the problem. 2.40 runs for about 20 mins or so, all the graphics work (including multiple draw threads) just fine, and then it locks up. If I remove all rtcSetCallback(&RTCD1,&realTimeClockCallback); calls, then it all runs with no obvious problems (e.g. 3 hours cycling through the graphics tests).
My theory at present is that the rtcSetCallback is in some way chewing up memory, and once its all used, we get lock up. I've poked around in the code at length, and don't see anything obvious.
Can you suggest what might be happening? Is there a way to track the memory usage, say output to SD1? We build with
__main_stack_size__ = 0x4000;
__process_stack_size__ = 0x4000;
regards
SD
We have implemented an LCD driver with Mutex, and also a RTC Callback (in main.c) at 1 second interval. The callback calculates the current H:M:S and displays it on the LCD. All draw functions are enclosed with
chMtxLock(&LCDD.mutex); <code> chMtxUnlock();
We have several other source.c that do graphic functions, and we found that it was necessary to
use
extern void realTimeClockCallback;
so we can call ...
rtcSetCallback(&RTCD1,NULL);
<lcd draw code>
rtcSetCallback(&RTCD1,&realTimeClockCallback);
otherwise there would be lock up issues.
So here's the problem. 2.40 runs for about 20 mins or so, all the graphics work (including multiple draw threads) just fine, and then it locks up. If I remove all rtcSetCallback(&RTCD1,&realTimeClockCallback); calls, then it all runs with no obvious problems (e.g. 3 hours cycling through the graphics tests).
My theory at present is that the rtcSetCallback is in some way chewing up memory, and once its all used, we get lock up. I've poked around in the code at length, and don't see anything obvious.
Can you suggest what might be happening? Is there a way to track the memory usage, say output to SD1? We build with
__main_stack_size__ = 0x4000;
__process_stack_size__ = 0x4000;
regards
SD