1

NRF52 SDK12 hardfault if secure bootloader present

mgscasso gravatar image

asked 2017-08-08 13:51:02 +0200

updated 2017-08-13 01:30:34 +0200

Hi! For a custom board, I have my app working ok. So I wanted to add the dfu secure bootloader to my project. I Had no problem to do that, both app and bootloader start ok and I could download the software package ok.

BUT: near to a minute after de app start, it crash. In debug I get: FPU_IRQHandler, inside of "Default Handler" at "arm_startup_nrf52" [UPDATED]: See the picture below.

If I erase the bootloader (no need of downdload the app again) all works fine [UPDATED]: I tried it again, and I was wrong.

I'm suspecting a memory issue, maybe in ram? But I had no succed in found a solution.

image description Help please!!!

edit retag flag offensive close delete report spam

Comments

Does your app use FPU ? Could you check in debug mode what exactly cause the problem? You may want to follow the debugging guide here.

This: "If I erase the bootloader (no need of downdload the app again) all works fine" is pretty strange. If you flashed the bootloader and erase it, the app shouldn't start. I'm not sure what's wrong here.

Can you reproduce the issue with our SDK's example as the application ?

I assume you download your app to the flash using OTA DFU , not using SWD interface to flash ?

Hung Bui ( 2017-08-09 13:54:17 +0200 )editconvert to answer

Hi, i'm running s132 softdevice + freertos. I'm using FDU (I'm setting Use Single Precision in keil). I got the hardfault when I'm debugging the app after download it through DFU. Also the system crash but not reboot.

I know how to debug with keil, but I can't find the cause.

["If I erase the bootloader (no need of downdload the app again) all works fine" is pretty strange. If you flashed the bootloader and erase it, the app shouldn't start. I'm not sure what's wrong here.] Me neither, I'will try with other app, but i'm follow the guides and examples to setup the secure bootloader and all seems to work fine.

Any other suggestion in the meantime?

Mariano ( 2017-08-09 14:28:38 +0200 )editconvert to answer

Hi Mariano,

From what you described, doesn't seems that it's a hardfault. For some reason the FPU interrupt was enabled and you don't have a FPU interrupt handler to handle it. Is it correct ? You can test by implementing the FPU_IRQHandler() in your main.c and clear the event.

If it's correct there must be something wrong with the bootloader that it enable the FPU interrupt.

Hung Bui ( 2017-08-10 14:12:41 +0200 )editconvert to answer

@Hung Bui, see my update please! Also, making a more detailed debugging I could saw the UART event handler still working, but the freertos's tasks are dead. Again, erasing the bootloader all works ok.

Mariano ( 2017-08-13 01:32:39 +0200 )editconvert to answer

Are you sure it is the FPU IRQ handler? All your handlers are at the same address, they are just aliases for each other, the FPU one just happens to be shown last in the disassembly. What are the actual registers at this point, that will tell you the actual exception/irq which has been taken.

RK ( 2017-08-13 02:14:38 +0200 )editconvert to answer

1 answer

Sort by ยป oldest newest most voted
0
hungbui gravatar image

answered 2017-08-14 13:50:56 +0200

mgscasso gravatar image

updated 2017-08-15 14:03:49 +0200

@Mariano: I agree with RK. If you don't implement the handler of the interrupt it will end up there. FPU_IRQHandler() happens to be the last in the list. The value of the register would help telling which IRQ was triggered. I suspect in a peripheral was used without proper configuration. And if the bootloader use the same peripheral (UART for example) you may run into trouble if it's not re-configured properly in the application.

edit flag offensive delete publish link more

Comments

1

Yes! I was using the rtc module to implement a timeout at the bootloader. I had to uninit it before start the app. Thanks so much guys, "Estaba orinando fuera del tarro"

Mariano ( 2017-08-15 14:07:16 +0200 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

Question Tools

1 follower

Stats

Asked: 2017-08-08 13:51:02 +0200

Seen: 53 times

Last updated: Aug 13