opcode trap

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

cross mob
User16898
Level 4
Level 4
Hi,
I've got following function:
#pragma section code_init
void init_ifx_standby_state(void){
//run from flash
switch_off_peripherals();
disable_scu_endinit_protection();
reduce_pll_clocks();
store_ram_redundancy_data()
idle_request_ack_sequence_disable();
switch_internal_back_up_clock();

//run from pspr
FLASH0_FCON.B.SLEEP = 1;
while(FLASH0_FSR.B.SLM ==1);

scu->PMSWCR0.B.STBYRAMSEL = 1;


scu->PMSWCR0.B.ESR1WKEN = 1;
scu->PMSWCR0.B.ESR1DFEN = 1;
scu->PMSWCR0.B.ESR1EDCON = falling_edge;

scu->PMSWCR0.B.PINAWKEN = 1;
scu->PMSWCR0.B.PINADFEN = 1;
scu->PMSWCR0.B.PINAEDCON = falling_edge;

scu->PMSWCR0.B.PINBWKEN = 1;
scu->PMSWCR0.B.PINBDFEN = 1;
scu->PMSWCR0.B.PINBEDCON = falling_edge;

scu->PMSWCR3.B.WUTEN = 1;
scu->PMSWCR3.B.WUTREL = 500;
scu->PMSWCR3.B.WUTDIV = 1;
scu->PMSWCR3.B.WUTMODE = 1;

scu->PMSWCR1.B.STBYEV = 0;
scu->PMSWCR1.B.STBYEVEN = 1;
scu->PMCSR[0].B.REQSLP = 3;
}
}



And I'm constantly getting trap class 2 tin 1( illegal opcode) after i unpower flash( while(FLASH0_FSR.B.SLM ==1));
I'm not familiar with opcodes, what does this problem means and what could cause the problem ?
I work on tc222L
0 Likes
1 Reply
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored
Make sure that the function runs from pspr, check your map file where the function is located. I expect it is located in the flash and therefore you get a trap after the flash going to sleep. You wrote in the comments // run from flash and // run from pspr. 1 function can be located only on the flash or the pspr.
0 Likes