SCI0SR2_AMAP =1;
LPCR_LPE =0; //shutdown mode
LPCR_LPPUE =0; //The pullup resistor is high ohmic (330).
LPCR_RXONLY =0; // The LIN Physical Layer is not in receive only mode
LPCR_LPWUE =1; // In standby mode the wake-up feature is enabled
LPSLRM_LPDTDIS =1; // TxD-dominant timeout feature is enabled.
LPSLRM_LPSLR =0; // Normal Slew Rate (optimized for 20 kbit/s).
LPCR_LPE =1;
SCI0ACR1_RXEDGIE =1;
SCI0ASR1_RXEDGIF =1;//when I add this ,the code is ok ,but I donot know why.
PPSL_PPSL2 = 1; //rising edge interrupt
PIEL_PIEL2 = 1; //enable interrupt
asm(CLI);
asm(andcc #0x7f);
asm(stop);
LPCR_LPE =1;
SCI0ACR1_RXEDGIE =0;
lin_timeout_4s =500;
PIEL_PIEL2 = 0; //close PL2 interrupt
Hi,
You need to set LPCR_LPWUE bit which will enable the receiver to pass wake-up events to the SCI.
If the LIN Physical Layer receives a dominant level longer than tWUFR followed by a rising edge, it sends a pulse to the SCI module which can generate a wake-up interrupt.
In the SCI module, set SCIACR1_RXEDGIE to enable interrupt generation on an active edge. And clear RXEDGIF flag in the SCI interrupt routine.
Regards,
Daniel
Hello Daniel,
My code is as follows:
LPSLRM_LPDTDIS =0; // TxD-dominant timeout feature is enabled
LPSLRM_LPSLR =0; // Normal Slew Rate (optimized for 20 kbit/s)
LPCR_LPPUE =0; // The pullup resistor is high ohmic (330kOhm)
LPCR_RXONLY =0;// The LIN Physical Layer is not in receive only mode
LPCR_LPWUE =1;// In standby mode the wake-up feature is enabled
LPCR_LPE =1;// The LIN Physical Layer is not in shutdown mode
SCI0ACR1_RXEDGIE =1;
//PPSL_PPSL2 = 0; //falling edge interrupt
PPSL_PPSL2 = 1; //rising edge interrupt
go_sleep_cnt = 0;
PIEL_PIEL2 = 1; //enable interrupt
_asm andcc #0x7f;
_asm stop;
SCI0ACR1_RXEDGIE =0;
PIEL_PIEL2 = 0; //close PL2 interrupt
I can awaken the mcu sometimes ,but it also will disable somtimes ,I donnot know why.
Hi,
The SCI0ACR1 register is an alternative register.
Do you set SCISR2_AMAP = 1 before
SCI0ACR1_RXEDGIE = 1
Do you monitor ECLK frequency?
Or how do you know in which mode the MCU is?
Regards,
Daniel