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

cross mob
DanielPinho
Level 1
Level 1
First reply posted First like given First question asked

Hello,

I'm working with XMC4500 and trying to understand why randomly the system gets to a state where it's lockup and only works again after a power reset.

I have a couple of questions:

1 - When a non-configurable fault is active, will the watchdog still work and reset the XMC?

2 - Is it possible to force a hard fault, mem fault, or bus fault to test the system's behavior when they occur? How can I do it?

3 - What is the good way to treat such faults? It is safe to ignore the faults with just a return; or keep it there with a while(1) in the fault's handler?

3.1 - In this case the watchdog will reset the XMC?

The system can work for days before it gets irresponsive which does not help to find the cause of the lockup.

4 - If there is a fail while loading the apps with the DAVE_Init(), it is safe to keep executing the code and start the watchdog?

 

Thank you for your help!

Daniel

0 Likes
1 Solution
sujatapatil
Moderator
Moderator
Moderator
250 replies posted 50 solutions authored 10 likes received
Hi Daniel,
 
1 - When a non-configurable fault is active, will the watchdog still work and reset the XMC?
>>>> If you hit hardFault, CPU will be locked up as default behavior. You can change this by redefining fault handler .
void HardFault_Handler( void )
{
/* save stack*/
/*or any useful code here*/
}
 
CPU will get reset automatically irrespective of watchdog configuration if you are overwritting default behavior as stated above.
 
 
2 - Is it possible to force a hard fault, mem fault, or bus fault to test the system's behavior when they occur? How can I do it?
  >>>> Below are some scenario ,
a>execution of an SVC instruction at a priority equal or higher than SVCall
  comment- is you application with RTOS ? If not then this case is irrelevant.
        b>execution of a BKPT instruction without a debugger attached.
         comment - this can only happen intentinally.
       
       c>a system-generated bus error on a load or store
        Could our Software make this happen, can we intentionally create this
        Comment-  while accessing external memory device
 
       d>execution of an instruction from an XN memory address
         
 -    e>execution of an instruction from a location for which the system generates a bus fault a system-generated bus error on a vector fetch
  
   Could our Software make this happen, can we intentionally create this
   >>>> Yes , while accessing external peripherial memory address . you can remove power of external device once it is initialized and that time mcu trying to access external peripherial memory.
 
     f>execution of an Undefined instruction
     How can this happen
     comment -  stack corruption 
 
  
3 - What is the good way to treat such faults? It is safe to ignore the faults with just a return; or keep it there with a while(1) in the fault's handler?
>>>>The good practice is configure watchdog and refresh it , so system will come out of bad state and restart.
 
3.1 - In this case the watchdog will reset the XMC?
>>>> Until you enable and configure watchdog will not reset XMC.
 
The system can work for days before it gets irresponsive which does not help to find the cause of the lockup.
>>>> You can save stack to find out reason for this .
 
4 - If there is a fail while loading the apps with the DAVE_Init(), it is safe to keep executing the code and start the watchdog?
 >>>> No , Dave_Init success is manadatory as internally it calls all functionality enabled using Apps.
 
Thanks
Sujata

View solution in original post

4 Replies
sujatapatil
Moderator
Moderator
Moderator
250 replies posted 50 solutions authored 10 likes received
Hi Daniel,
 
1 - When a non-configurable fault is active, will the watchdog still work and reset the XMC?
>>>> If you hit hardFault, CPU will be locked up as default behavior. You can change this by redefining fault handler .
void HardFault_Handler( void )
{
/* save stack*/
/*or any useful code here*/
}
 
CPU will get reset automatically irrespective of watchdog configuration if you are overwritting default behavior as stated above.
 
 
2 - Is it possible to force a hard fault, mem fault, or bus fault to test the system's behavior when they occur? How can I do it?
  >>>> Below are some scenario ,
a>execution of an SVC instruction at a priority equal or higher than SVCall
  comment- is you application with RTOS ? If not then this case is irrelevant.
        b>execution of a BKPT instruction without a debugger attached.
         comment - this can only happen intentinally.
       
       c>a system-generated bus error on a load or store
        Could our Software make this happen, can we intentionally create this
        Comment-  while accessing external memory device
 
       d>execution of an instruction from an XN memory address
         
 -    e>execution of an instruction from a location for which the system generates a bus fault a system-generated bus error on a vector fetch
  
   Could our Software make this happen, can we intentionally create this
   >>>> Yes , while accessing external peripherial memory address . you can remove power of external device once it is initialized and that time mcu trying to access external peripherial memory.
 
     f>execution of an Undefined instruction
     How can this happen
     comment -  stack corruption 
 
  
3 - What is the good way to treat such faults? It is safe to ignore the faults with just a return; or keep it there with a while(1) in the fault's handler?
>>>>The good practice is configure watchdog and refresh it , so system will come out of bad state and restart.
 
3.1 - In this case the watchdog will reset the XMC?
>>>> Until you enable and configure watchdog will not reset XMC.
 
The system can work for days before it gets irresponsive which does not help to find the cause of the lockup.
>>>> You can save stack to find out reason for this .
 
4 - If there is a fail while loading the apps with the DAVE_Init(), it is safe to keep executing the code and start the watchdog?
 >>>> No , Dave_Init success is manadatory as internally it calls all functionality enabled using Apps.
 
Thanks
Sujata
DanielPinho
Level 1
Level 1
First reply posted First like given First question asked

Thanks a lot for your answer it helped me to better understand how XMC works.

We are not using RTOS.

With your help, I could force a hardfault and see it go into the handler with the debugger and restart the XMC. In normal operation I'm forcing the hardfault with this:
        uint8_t* BytePtr = (uint8_t)0x20002000;
        *BytePtr = 0x5a;

Also, I have the Watchdog active and working fine.

I'm forcing the restart of the XMC in every handler with this:
       SCU_RESET->RSTCLR |= 0x1;
       NVIC_SystemReset();

 

With all of this, fault handlers, and watchdog that look like they are configured correctly, we still have the XMC in a lockup state that it can only leave with a power cycle.

Do you have any idea of what could be causing the XMC to enter this state?

Edit: Also would like to add that when the Reset button is pressed nothing happens, XMC stays in the same state.

 

Thank you,

Daniel

0 Likes
sujatapatil
Moderator
Moderator
Moderator
250 replies posted 50 solutions authored 10 likes received

Hi Daniel , 

I believe you are using debug configuration . Can you share screenshot after pausing debugger , need to check which handler it is invoked now . 

Thanks

Sujata 

0 Likes
sujatapatil
Moderator
Moderator
Moderator
250 replies posted 50 solutions authored 10 likes received

Hi Daniel,

Any update on this.

Thanks

Sujata

0 Likes