2016-05-10 11:58 PM
Hello Erwan,
I have a problem with spcstudio compiler i guess. my project have 3 section : 1.initialize modules like CAN-LIN-Serial-ADC-PWM-Timer 2.Read From eeprom 3.Main Loop with 50 cases in while(1) in one switches when i check some data the MCU goes to sleep mode , some times the MCU go to sleep correctly but some times the MCU not go to sleep correctly i think the compiler have some problems with this issue because when i compile the code with some enters between lines or some condition happen in code the program work correctly all time but if i add new code or some changes happen in code the MCU not correctly go to sleep. I use this functions u send for me : __attribute__ ((section (''.codeinram''))) void gotoStandbyMode(void) { WKUP.WISR.R = 0x00040000; //Clear interrupt flag if ((ME.GS.B.S_CURRENTMODE < SPC5_RUNMODE_RUN3)|| (ME.GS.B.S_CURRENTMODE > SPC5_RUNMODE_RUN0)) { if (OSAL_FAILED == halSPCSetRunMode(SPC5_RUNMODE_STANDBY))// { SPC5_CLOCK_FAILURE_HOOK(); } } } __attribute__ ((section (''.codeinram''))) void gotoRunMode(void) { if (OSAL_FAILED == halSPCSetRunMode(SPC5_RUNMODE_DRUN)) { SPC5_CLOCK_FAILURE_HOOK(); } } i change the application.ld with the sample u send for me . Your earliest help in this regard will be highly appreciated. Thanks in advance. Best Regards, Nazerian Vanima2016-05-11 02:50 AM
Hello Vanima ,
Could you confirm your compiler used (hightec, freegcc or GHS)Are you on SPC5studio 4.1.0 ? Best regards Erwan2016-05-14 01:25 AM
Hi Erwan
Thanks for your fast response I found The problem it is not for compiler , the LINFLEX Driver cause the MCU not go to sleep mode . I solve this problem . Thanks so much . Best Regards Nazerian Vanima