Debugging a unhandled_exception
Posted: Tue Dec 10, 2013 2:19 pm
Hi guys,
I'm getting stuck in an unhandled_exception and was hoping for some pointers.
I'm using a STM32L152RCT6 and am using the following:
SPI Driver: SPID2
Serial Driver: SD1
Interrupt Driver: EXTD1
So the trace itself is:
which isn't too useful. It tried enabling a good few debug options in the makefile, and I get the following:
So it would seem with debug I am getting caught out for attempting to use SPI in an interrupt callback. So I'm probably going to have to re-jig this up with a semaphore and move the code itself into a thread...
But would this be the cause of the unhandled exception? For my understanding it seems that chSysLock disables interrupts (obviously a problem if I'm then trying to use one for SPI) but I'm trying to understand how it could lead to an unhandled_exception. Anyone have any good links referring to unhandled_exceptions in this case / how to debug them?
Cheers
I'm getting stuck in an unhandled_exception and was hoping for some pointers.
I'm using a STM32L152RCT6 and am using the following:
SPI Driver: SPID2
Serial Driver: SD1
Interrupt Driver: EXTD1
So the trace itself is:
Code: Select all
#0 _unhandled_exception () at /home/fyp/fyp/ChibiOS-RT/os/ports/GCC/ARMCMx/STM32L1xx/vectors.c:172
#1 <signal handler called>
#2 0x00000000 in ?? ()
#3 0x080009b0 in chSchGoSleepS (newstate=0 '\000') at /home/fyp/fyp/ChibiOS-RT/os/kernel/src/chschd.c:128
#4 0x080009b0 in chSchGoSleepS (newstate=32 ' ') at /home/fyp/fyp/ChibiOS-RT/os/kernel/src/chschd.c:128
#5 0x080003cc in _port_thread_start () at /home/fyp/fyp/ChibiOS-RT/os/ports/GCC/ARMCMx/chcore_v7m.c:262
#6 0x080003cc in _port_thread_start () at /home/fyp/fyp/ChibiOS-RT/os/ports/GCC/ARMCMx/chcore_v7m.c:262which isn't too useful. It tried enabling a good few debug options in the makefile, and I get the following:
Code: Select all
#0 port_halt () at /home/fyp/fyp/ChibiOS-RT/os/ports/GCC/ARMCMx/chcore.c:50
#1 0x08000a66 in chDbgPanic (msg=0x80066a8 "SV#4") at /home/fyp/fyp/ChibiOS-RT/os/kernel/src/chdebug.c:274
#2 0x0800079a in dbg_check_lock () at /home/fyp/fyp/ChibiOS-RT/os/kernel/src/chdebug.c:117
#3 0x08002174 in spiSelect (spip=0x20000dc8) at /home/fyp/fyp/ChibiOS-RT/os/hal/src/spi.c:153
#4 0x0800479e in selectCC3000 () at ../CC3000_ChibiosRT/cc3000_spi.c:104
#5 0x08004a0a in cc3000ExtCb (extp=0x20000dc0, channel=11) at ../CC3000_ChibiosRT/cc3000_spi.c:243
#6 0x0800309c in VectorE0 () at /home/fyp/fyp/ChibiOS-RT/os/hal/platforms/STM32L1xx/ext_lld_isr.c:169
#7 <signal handler called>
#8 0x55555554 in ?? ()
#9 0x55555554 in ?? ()
So it would seem with debug I am getting caught out for attempting to use SPI in an interrupt callback. So I'm probably going to have to re-jig this up with a semaphore and move the code itself into a thread...
But would this be the cause of the unhandled exception? For my understanding it seems that chSysLock disables interrupts (obviously a problem if I'm then trying to use one for SPI) but I'm trying to understand how it could lead to an unhandled_exception. Anyone have any good links referring to unhandled_exceptions in this case / how to debug them?
Cheers