AnsweredAssumed Answered

STM8AF52AATCY CAN_Configuration in halt mode

Question asked by Bhavan Raibagi on May 23, 2017

Dear Sir/Madam,

 

Now I did controller into halt completely. But when it's in halt mode if any GPIO external interrupt is triggered means it wakes up, but when I will send the CAN Identifier then It's not waking up. As per data sheet in halt mode if CAN_RX interrupt comes it should wake up. So, can you please guide to me what initialization I need configure for CAN before entering into the halt mode. Here I added CAN_Config(); function.

 

void CAN_Config(void)
{
CAN_InitStatus_TypeDef status = CAN_InitStatus_Failed;

 

/* Filter Parameters */
CAN_FilterNumber_TypeDef CAN_FilterNumber;
FunctionalState CAN_FilterActivation;
CAN_FilterMode_TypeDef CAN_FilterMode;
CAN_FilterScale_TypeDef CAN_FilterScale;
uint8_t CAN_FilterID1;
uint8_t CAN_FilterID2;
uint8_t CAN_FilterID3;
uint8_t CAN_FilterID4;
uint8_t CAN_FilterIDMask1;
uint8_t CAN_FilterIDMask2;
uint8_t CAN_FilterIDMask3;
uint8_t CAN_FilterIDMask4;

 

/* Init Parameters*/
CAN_MasterCtrl_TypeDef CAN_MasterCtrl;
CAN_Mode_TypeDef CAN_Mode;
CAN_SynJumpWidth_TypeDef CAN_SynJumpWidth;
CAN_BitSeg1_TypeDef CAN_BitSeg1;
CAN_BitSeg2_TypeDef CAN_BitSeg2;
uint8_t CAN_Prescaler;

 

/* CAN register init */
CAN_DeInit();

 

/* CAN init */
CAN_MasterCtrl=CAN_MasterCtrl_AllEnabled;
//CAN Loop Back Mode JNa
//CAN_Mode = CAN_Mode_LoopBack;
CAN_Mode = CAN_Mode_Normal;

 

/*CAN_SynJumpWidth = CAN_SynJumpWidth_1TimeQuantum;
CAN_BitSeg1 = CAN_BitSeg1_5TimeQuantum;
CAN_BitSeg2 = CAN_BitSeg2_2TimeQuantum;
CAN_Prescaler = 4;*/

 

CAN_SynJumpWidth = CAN_SynJumpWidth_1TimeQuantum;
CAN_BitSeg1 = CAN_BitSeg1_8TimeQuantum;
CAN_BitSeg2 = CAN_BitSeg2_7TimeQuantum;
CAN_Prescaler = 8; /* 500kbit/s */

 

status = CAN_Init(CAN_MasterCtrl, CAN_Mode, CAN_SynJumpWidth, CAN_BitSeg1, \
CAN_BitSeg2, CAN_Prescaler);
/* CAN filter init */
CAN_FilterNumber = CAN_FilterNumber_0;
CAN_FilterActivation = ENABLE;
CAN_FilterMode = CAN_FilterMode_IdMask;
CAN_FilterScale = CAN_FilterScale_32Bit;
CAN_FilterID1=0;
CAN_FilterID2=0;
CAN_FilterID3=0;
CAN_FilterID4=0;
CAN_FilterIDMask1=0;
CAN_FilterIDMask2=0;
CAN_FilterIDMask3=0;
CAN_FilterIDMask4=0;
CAN_FilterInit(CAN_FilterNumber, CAN_FilterActivation, CAN_FilterMode,
CAN_FilterScale,CAN_FilterID1, CAN_FilterID2, CAN_FilterID3,
CAN_FilterID4,CAN_FilterIDMask1, CAN_FilterIDMask2,
CAN_FilterIDMask3, CAN_FilterIDMask4);

 

/* Enable Fifo message pending interrupt*/
/* Message reception is done by CAN_RX ISR*/
CAN_ITConfig(CAN_IT_FMP, ENABLE);
}

 

Here, I am suspecting about my configuration, what configuration need to be change.

Outcomes