K70_Unhandled Exception : Hardfault

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

K70_Unhandled Exception : Hardfault

1,446 Views
chiranjeevn
Contributor III

Dear All,

             Please assist me to solve the issue K70_Unhandled Exception : Hardfault in K70 Module.Please find the attachment herewith .

Regards

Chiranjeev N

0 Kudos
6 Replies

1,218 Views
yasuhikokoumoto
Senior Contributor I

Hello,

do you develop a u-boot for K70?

What is the instruction at the erroneous PC 0x8b92?

Generally speaking, HardFault sometimes happens by accessing un-clocked peripherals.

Please check it.

Best regards,

Yasuhiko Koumoto.

0 Kudos

1,218 Views
chiranjeevn
Contributor III

Thanks Yasuhiko Koumoto

Generally speaking, HardFault sometimes happens by accessing un-clocked peripherals?

I am not aware on this ,please explain.

Please assist.

0 Kudos

1,218 Views
yasuhikokoumoto
Senior Contributor I

Hello Chiranjeev N,

this is additional information.

The dis-assemble of the code "S214008B9004B0BDE8F08E602934D07029F8D1019871" is as below.

00000000 <foo>:

  0:  b004            add    sp, #16

  2:  e8bd 8ef0      ldmia.w sp!, {r4, r5, r6, r7, r9, sl, fp, pc}

  6:  2960            cmp    r1, #96 ; 0x60

  8:  d034            beq.n  74 <foo+0x74>

  a:  2970            cmp    r1, #112        ; 0x70

  c:  d1f8            bne.n  0 <foo>

  e:  9801            ldr    r0, [sp, #4]

According to the code, I guess that the hard fault had happened by un-initialized stack pointer or stack overflow.

Best regards,

Yasuhiko Koumoto.

0 Kudos

1,218 Views
yasuhikokoumoto
Senior Contributor I

Hello Chiranjeev N,

did you follow the procedure of https://www.emcraft.com/docs/linux-TWR-K70F120M-bspg-1.12.0.pdf ?

If you did so, I would be helpless.

Best regards,

Yasuhiko Koumoto.

0 Kudos

1,218 Views
peterruesch
Contributor IV

this is a common behavior across multiple ARM devices.

You have to enable the gated clock to a peripheral before you access it's registers.

I'm very happy when my hardfaults get resolved this way :smileyhappy: it's a nice bug :smileywink:

0 Kudos

1,218 Views
chiranjeevn
Contributor III

Thanks Yasuhiko Koumoto,

Please find my answers below

do you develop a u-boot for K70?

i am not developing u-boot  (u-boot code which came with the BSP , which am using the same without any change)

What is the instruction at the erroneous PC 0x8b92?

S214008B9004B0BDE8F08E602934D07029F8D1019871

this is the line i  found from uboot.srec file, also attached the screen shot of uboot.srec.

HardFault sometimes happens by accessing un-clocked peripherals.

I am not controlling  any clock (system clock,bus clock,peripheral clock) up to booting process is over,This is controlled by the u-boot and  kernel .

Once the system is booted  I am trying to access  peripherals from user space .

Please correct me if my answers are not acceptable.

0 Kudos