Testing Aurix TC39 Class4 traps

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

cross mob
ashKail
Level 1
Level 1
10 sign-ins 5 questions asked 5 sign-ins

Hi, I am working on trying to test traps for TC39x processor by triggering them. Could you please help me on how trigger the following traps from software? 

-->Program Fetch Synchronous Error

--->Coprocessor Trap Asynchronous Error

----> Program Memory Integrity Error

----> Data Memory Integrity Error

0 Likes
1 Solution
Anupama_A
Moderator
Moderator
Moderator
50 solutions authored 10 likes received 250 sign-ins

Hi,

You can refer to these code snippets to trigger these traps using the software:

The PSE (Program Fetch Synchronous Error )trap is raised when:
• A bus error occurred because of an instruction fetch.
• An instruction fetch targets a segment that does not have the code fetch property.

//Here memory access is outside the range of actual scratchpad RAMs. So bus fetch error will be generated. 

typedef void (*func_t)(void);   
((func_t) 0x70040000)(); 

 

CAE - Coprocessor Trap Asynchronous Error (TIN 4) can be triggered by unimplemented coprocessor instructions and arithmetic errors. 

To trigger this trap, you can enable the FZE bit of the FPU_TRAP_CON register and then try to divide a non zero number with zero as denominator(Make sure that the code is not optimized while compiling). For further information about this, you can refer to section 9.5 of architecture manual 1. 

 

PIE - Program Memory Integrity Error (TIN 5)  is raised whenever an uncorrectable memory integrity error is detected in an instruction fetch. 

For this trap, you can refer to the following thread: -

https://community.infineon.com/t5/AURIX/How-to-trigger-a-PIE-Trap-via-Application-code/m-p/397406 

 

DIE - Data Memory Integrity Error (TIN 6) is raised whenever an uncorrectable memory integrity error is detected in a data access. 

//Here test variable will be stored in CPU0 DSPR.
//Hence we are using i=0 for register MTU_MCi

volatile uint32 test;
IfxScuWdt_clearSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
MTU_MC0_ALMSRCS.B.DBE = 1;
IfxScuWdt_setSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
test = 0x00000000;
IfxScuWdt_clearSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
MTU_MC0_ECCS.B.ECCMAP = 1;
IfxScuWdt_setSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
test = 0x00000003;
IfxScuWdt_clearSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
MTU_MC0_ECCS.B.ECCMAP = 0;
IfxScuWdt_setSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());

 

Kind regards

Anupama

View solution in original post

0 Likes
3 Replies
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

.

0 Likes
Anupama_A
Moderator
Moderator
Moderator
50 solutions authored 10 likes received 250 sign-ins

Hi,

You can refer to these code snippets to trigger these traps using the software:

The PSE (Program Fetch Synchronous Error )trap is raised when:
• A bus error occurred because of an instruction fetch.
• An instruction fetch targets a segment that does not have the code fetch property.

//Here memory access is outside the range of actual scratchpad RAMs. So bus fetch error will be generated. 

typedef void (*func_t)(void);   
((func_t) 0x70040000)(); 

 

CAE - Coprocessor Trap Asynchronous Error (TIN 4) can be triggered by unimplemented coprocessor instructions and arithmetic errors. 

To trigger this trap, you can enable the FZE bit of the FPU_TRAP_CON register and then try to divide a non zero number with zero as denominator(Make sure that the code is not optimized while compiling). For further information about this, you can refer to section 9.5 of architecture manual 1. 

 

PIE - Program Memory Integrity Error (TIN 5)  is raised whenever an uncorrectable memory integrity error is detected in an instruction fetch. 

For this trap, you can refer to the following thread: -

https://community.infineon.com/t5/AURIX/How-to-trigger-a-PIE-Trap-via-Application-code/m-p/397406 

 

DIE - Data Memory Integrity Error (TIN 6) is raised whenever an uncorrectable memory integrity error is detected in a data access. 

//Here test variable will be stored in CPU0 DSPR.
//Hence we are using i=0 for register MTU_MCi

volatile uint32 test;
IfxScuWdt_clearSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
MTU_MC0_ALMSRCS.B.DBE = 1;
IfxScuWdt_setSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
test = 0x00000000;
IfxScuWdt_clearSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
MTU_MC0_ECCS.B.ECCMAP = 1;
IfxScuWdt_setSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
test = 0x00000003;
IfxScuWdt_clearSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
MTU_MC0_ECCS.B.ECCMAP = 0;
IfxScuWdt_setSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());

 

Kind regards

Anupama

0 Likes

Thank you for the info.

0 Likes