I'm running in to a halting error on my olimex STM32 dev board that I do
not understand and I'd like to solicit eyes and advice for debugging it.
I've migrated the bits of the old si project related to reading data
from the MPU9150 sensor over to my eventlogger project, in the
'eventlog-sensor' branch of psas/stm32 on github. I've rearranged things
by putting the MPU9150 functions in their own c file, rather than just
throwing everything in main, but I (as far as I can tell) have not
functionally changed anything.
It does all work... for a little while, at least, until the system just
halts. It usually halts after roughly 900 reads of the sensor data, but
sometimes it'll go for 1200 or 1800 interrupts before halting. I have
not been able to determine why the number changes; sometimes the number
will change between resets, without re-programming the device!
It seems that the problem lies in the Thread_mpu9150_int_dispatch, since
if I do not start that thread then the system does not halt. That thread
does very little: it loops forever waiting for the mpu9150_int_event to
be broadcast, and when it is it calls the mpu9150_int_event_handler
function to actually read the data. I am unsure what in either of these
two functions could be causing the halt, since they appear to be
functionally identical to the versions in the si project that do not halt.
At first I suspected stack space exhaustion, but increasing the amount
of stack space, even by eight times (up to 4KB) does not help (indeed,
it seems to _decrease_ the time that it runs before halting). Turning
off MPU9150_DEBUG so that nothing gets printed doesn't fix things, nor
even noticeably increase runtime before halt.
Is there any way to determine the cause of a halt? I've heard that it is
possible to wrangle gdb into stepping through the program on the STM32;
are there any writeups of how to do this? Can anyone else spot a
difference between the mpu9150-related portions of si and eventlogger
that would explain this halting?
psas-avionics mailing list