MM9Z1-638 LIN Sleep->Wake up Problem (Analog Die is not working)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MM9Z1-638 LIN Sleep->Wake up Problem (Analog Die is not working)

696 Views
julliard
Contributor I

Hello.

I'm developing small BMS with MM9Z1-638 processor.

I implemented low power state by using 'STOP' mode (wakes up by LIN only) and it has no problem so far.

However, there need to be dropping down sleep current lower than 100uA, I'm considering about 'SLEEP' mode.

Transition from standby state to sleep state has no problem. 

But when I'm trying to wake up the 638ic by triggering with LIN, analog die sends reset signal repeatedly.

hjd1.jpg

Our reference says "The microcontroller has to acknowledge the Normal mode, by writing the OPM=00, to allow a controlled transition into the D2D Clock domain. If the clock domain transition is not required, the microcontroller may issue a Sleep / Stop mode entry instead"

Here is my code.

/*----------------------------------------------------------------------------------------------------------------------------------------------------*/

void Go_to_Sleep(void)
{
uint8_t u8Ret;
// disable interrupts (SCI and TIM are read only in Intermediate mode!!!! So any pending IRQ might trigger multiple D2Dinterrupts)
//! \todo how to disable with lin driver and SCI!!! Stop Timer or disable just ch3


write_eep_total_aging(NEEP_ALL);
ADCDisable();
//TsenseDisable();
B_ACQ_CTL = 0; //TsenseDisable
B_GPIO_VSENSE = 0;

// LIN Timer Disable
B_TSCR1_TEN = 0;
B_TIE_C3I = 0;
lin_timeout_counter=0;

// Enable LIN wakeup source(works independent of LIN PHY enable)
B_PCR_WUE_WULIN=1;

PCREnterSleepMode(); // 65uA reset analog die ?????.

// .....zzzzzzzzzzz (stop mode)
// after wakeup the code continues to run here....
// but first the D2D Interrupt service routine will be run

////////////////////// ???? Wake up ???? //////////////////////
B_WD_CTL = 0x0700; //watch dog off
B_PCR_CTL = OPM_SET_NORMAL; /* set normal mode*/

// Re-enable
B_TSCR1_TEN = 1;
B_TIE_C3I = 1;
u8Ret = l_ifc_init(LI0); // is this how it should be?

D2DInit(1); // 25 MHz MCU freq, 25 MHz D2D freq. (no divider)
SYS_Analog_Init();
ADC_Init();
VsenseInit();
CsenseInit();
TsenseInit();

}

void PCREnterSleepMode(void) {

//! \todo check what potions should be inside or outside this routine, e.g. IrQDisable()?
IrqDisable();

//! \todo check if this makes sense like this?
B_INT_MSK = 0xFF3F; // Mask Analog Interrupts
B_ACQ_SRH = 0xFF; // Clear pending Flags
B_INT_MSK = 0xFF00; // Enable Analog Int
IrqEnable();

B_PCR_SR = 0xFFFF; // Clear Flags
B_PCR_CTL = OPM_SET_SLEEP; // Goto Sleep Mode
StopEnable();
StopEnter();
}

Thank you for considering my problem.

Best regards,

Lim

0 Kudos
1 Reply

582 Views
Q_man
NXP Employee
NXP Employee

Hi Lim,

I do not fully understand your issue, but there is a fundamental difference between wakeup from STOP and wakeup from SLEEP mode:.

- wakeup from STOP mode (uC is still supplied with 5V) behaves like an Interrupt => software will continue executing after the "StopEnter()"

- wakeup from SLEEP mode (uC is powered down 0V) behaves like a Reset => software will start again

The scope plot above shows the analog watchdog triggering resets, so there seems to be an issue with your starting up code!

Here some code extract from the KT9Z1_638_LIN_demo code (please see the bold items in particular):

void main(void) {
   ...
   SYS_Init();
    CPMUInit(&ClockConf);
    D2DInit((TYPE_D2DCLKDIV) ClockConf.D2dDiv); 
    XirqEnable(); // enable XIRQ -> isrD2DErr() "write-once" 

    if (B_PCR_CTL_OPM & 2) {       // Check if Wake Up from Sleep mode (see page RM3.0 110 Intermediate Mode)
       B_PCR_CTL = OPM_SET_NORMAL; // set normal mode
       while (!(B_PCR_SRH_WLPMF )) DO_NOTHING; // Wait for Clock Domain Change 
    }else{
       if(!B_PCR_SR_HWRF) {
          PCRReset(); // generate a HWR reset to ensure analog die is in defined state! E.g. debugging might cause strange effects in case bits are set from before // 
    }
 
    B_WD_CTL = WD_OFF; 
0 Kudos