This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Timer2 HardFault

Hi, I'm developing an application for the nRF52832 using mbed and the S132 SoftDevice. Since it appears that the SoftDevice requires exclusive use of Timer0 and mbed uses Timer1 to run the RTOS, I am trying to use Timer2 to more precisely drive the sample task of the SAADC.

I am having an issue where whenever I initialize the Timer2 driver I will end up in a HardFault handler. I have set up PPI (using the SoftDevice API) in the following way:

Channel 0: Timer2 CompareEvent 0 -> SAADC Sample Task

Channel 1: SAADC Sample Event Done -> GPIOTE Pin Toggle Task

I can see the pin toggling but the CPU ends up in a HardFault handler.

When I use either Timer3 or Timer4 I don't get a HardFault but the CPU ends up in some locked up state with the magic word "0xCAFEBABE" loaded into register 3... I'm assuming the soft device is responsible for that. What does CAFEBABE mean?

Any idea of how I could begin debugging this?

EDIT:

I looked through my applications .map file and noticed a bunch of the IRQ handlers occupy the same address. So in my disassembler they all looked like a HardFault or a WDT_IRQ. I added implementations of TIMER1_IRQHandler_v and SAADC_IRQHandler_v and it stopped the app from just crashing... but for some reason the SAADC_IRQHandler defined in the Nordic SAADC driver was not being called. So I called it from my interrupt routine...

See the attached image for more explanation.

What is the purpose of the *_v IRQ Handlers? It looks like my code was branching to nonexistant interrupt handlers that were all infinite loops...

Application .map

Related