cancel
Showing results for 
Search instead for 
Did you mean: 

STM8A wakeup from HALT by CAN Rx interrupt not working

PPate.1
Associate II

I am using STM8AF5286 controller and CAN port for external communication. My application need to be in HALT mode to prevent battery consumption and wakeup only when any activity is detected on CAN port. The application works fine with wfi() function but it does not wakeup if I use halt().

I am using STM8 standard peripheral library.

CAN is configured as below:

/* CAN RX pin interface */

GPIO_DeInit(GPIOG);

GPIO_Init(GPIOG, GPIO_PIN_1, GPIO_MODE_IN_PU_IT);

/* CAN register init */

 CAN_DeInit();

 /* CAN init */

 CAN_MasterCtrl=CAN_MasterCtrl_AllDisabled;

 CAN_Mode = CAN_Mode_Normal;

 CAN_SynJumpWidth = CAN_SynJumpWidth_1TimeQuantum;

 CAN_BitSeg1 = CAN_BitSeg1_8TimeQuantum;

 CAN_BitSeg2 = CAN_BitSeg2_7TimeQuantum;

 CAN_Prescaler = 4; //set to 250Kbps, set to 2 for 500Kbps

 status = CAN_Init(CAN_MasterCtrl, CAN_Mode, CAN_SynJumpWidth, CAN_BitSeg1, \

          CAN_BitSeg2, CAN_Prescaler);

CAN_ITConfig(CAN_IT_WKU, ENABLE);

My application code :

while(1){

----

state machine

----

case wait_mode:

CAN_Sleep();

halt();

break;

}

In CAN Rx interrupt handler I toggled GPIO which is not responded even if receive message on CAN port after entering in halt().

0 REPLIES 0