PSoC4 hardfault handler location?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
bugkiller
Level 2
Level 2
10 replies posted 50 sign-ins First like received

Currently I'm using PSoC4.4 software.

Here is my problem : system goes hardfault situation due to the unknown reason.

After some research I just found there is hardfault handler in PSoC 4.4, but I'm having trouble to find that. 

Anyone know what is the name of hardfault handler function and where is?

Thanks! 

0 Likes
1 Solution
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @bugkiller ,

1. Hard Fault exception is a catch-all exception for different types of fault conditions, which include executing an undefined instruction and accessing an invalid memory addresses. You can read about it under the section "Hard Fault Exception" in the device architecture TRM. For reference, I have taken the Architecture TRM of PSoC 4100/4200 family.

Also, can you please let us know which PSoC 4 device are you using? 

2. Please refer the API  CyIntSetSysVector() in CyLib.c file from the Generated source -> PSoC 4 -> cyboot folder of your application.  This API sets the interrupt vector of the specified system interrupt number. I have shared an image of the same below -

Aashita_Raj_0-1667980779770.png

Based on CY_INT_HARD_FAULT_IRQN value i.e. 3u, the number of exception is passed as a parameter to this API whenever any source of this exception occurs. Hence, hard fault exception is generated.

3. This KBA here might interest you as well - Hard Fault Interrupt Handler Function – KBA86934. It explains how an user can write a hard fault interrupt handler function using the default interrupt handler. 

Please go through the above mentioned points and let us know in case of any further queries. We would be happy to help.

Best Regards,

Aashita

 

 

 

View solution in original post

0 Likes
2 Replies
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @bugkiller ,

1. Hard Fault exception is a catch-all exception for different types of fault conditions, which include executing an undefined instruction and accessing an invalid memory addresses. You can read about it under the section "Hard Fault Exception" in the device architecture TRM. For reference, I have taken the Architecture TRM of PSoC 4100/4200 family.

Also, can you please let us know which PSoC 4 device are you using? 

2. Please refer the API  CyIntSetSysVector() in CyLib.c file from the Generated source -> PSoC 4 -> cyboot folder of your application.  This API sets the interrupt vector of the specified system interrupt number. I have shared an image of the same below -

Aashita_Raj_0-1667980779770.png

Based on CY_INT_HARD_FAULT_IRQN value i.e. 3u, the number of exception is passed as a parameter to this API whenever any source of this exception occurs. Hence, hard fault exception is generated.

3. This KBA here might interest you as well - Hard Fault Interrupt Handler Function – KBA86934. It explains how an user can write a hard fault interrupt handler function using the default interrupt handler. 

Please go through the above mentioned points and let us know in case of any further queries. We would be happy to help.

Best Regards,

Aashita

 

 

 

0 Likes
idream
Level 3
Level 3
50 sign-ins First comment on blog 10 replies posted

Hi,

you can use the CmBackTrace to trace the hardfault of CM0, it is usefull for PSoC4.

I write one note at https://xarm.gitee.io/2022/08/21/PSoC4/PSoC4SoftUart/  

hopt it can help you.

0 Likes