We use KW41's "SMAC connectivity test" as the base to develop the program.
Because the current self-written program crashes during execution.
I want to use HardFault to debug.
Just like the following URL that read Register.
Developing a Generic Hard Fault handler for ARM Cortex-M3/Cortex-M4 - Sticky Bits - Powered by Feabh...
How can I add programs to print out the CFSR and HFSR values?
Because HardFault_Handler () is an assembly code, I do n’t know where to start?
Follow the previous link:
Since Cortex-M0 will not have CFSR and HFSR registers, I will try Cortex-M33 instead.
I tried to use LPCX55S69-EVK, it is cortex-M33 with "divide by 0" detection.
I use "Led_blinky" example to implement "divide 0".
Set the breakpoint below, but never go in Hardfault_Handler(),always enter main's while (1) I would like to ask how to enter Hardfault
If M0+ cannot print CFSR and HFSR, what register can be checked for debugging in M0+ ?
Hi Daniel,
Fault handling in Cortex M0+ based MCUs is a bit different from Cortex M3/M4 cores. Most of the debug registers are not present on the KW41's core, as it is an ARM Cortex M0+.
The closest available registers could be the DFSR register, which contains some useful information about interrupts, debugging status and faults, but not as in-depth as the CFSR and HFSR registers on the other cores.
For more information about the bits available in the DFSR register, and to see if it would be useful for your purposes, could you please take a look at section C1.6.2 of the ARMv6 architecture Reference Manual, from ARM, here?
Please let me know if you need any further information.
Best regards,
Sebastian
Hi Daniel, I hope you're doing well!
Unfortunately, it is not possible to print the CFSR or HFSR registers on the KW41Z, as they are not present on this MCU.
The KW41Z is based around an ARM Cortex M0+ core, and the available SCB registers for this MCU can be found in Chapter 4, tables 4-1 and 7-6 of the following ARM Technical Reference Document:
Please let me know if you still need to print the value for a different register other than the CFSR or the HFSR, or if you need any more information.
Best regards,
Sebastian