Page 1 of 1

Can't read pad from HardFault_Handler?

Posted: Fri May 12, 2017 6:12 pm
by robomancer
Hi all, I'm making an STM32F4 based board fault tolerant but I'm running into a weird behavior where palReadPad doesn't seem to work within the HardFault_Handler. My suspicion is that HardFault_Handler is so high priority that AHB1 stops ticking and thus new values aren't copied into the IDR. Is there any way to get around this and read a digital pin? Could I manually emit an AHB1 tick to refresh the register?

Edit: adding the following code to the hander did not help

Code: Select all

RCC->AHB1ENR |= 0x7f;
RCC->AHB1LPENR |= 0x7f;

Re: Can't read pad from HardFault_Handler?

Posted: Sat May 13, 2017 7:25 am
by Giovanni
Hi,

You should be able to use GPIO from hard faul handler without any special handling, assuming GPIO has been already initialized (after calling halInit()).

Giovanni

Re: Can't read pad from HardFault_Handler?

Posted: Mon May 15, 2017 5:15 pm
by robomancer
Thanks for letting me know I'm not crazy! It turns out to have been a hardware problem.