2014-07-01 12:01 AM
Hi,
I'm developing with STM32F0 and I have a problem with interrupt. this is my code:void batchStandByConf(void){
EXTI_InitTypeDef EXTI_InitStructure;
//PC10 input
GPIOC->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR10;
GPIOC->PUPDR &= ~(GPIO_PUPDR_PUPDR10); //NO PULL
/* clock SYSCFG */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Interrupt PC10 pin */
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOC, EXTI_PinSource10);
/* Interrupt EXTI10 */
EXTI_Init(&EXTI_InitStructure);
EXTI_InitStructure.EXTI_Line = EXTI_Line10;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
}
void impulsiConf(void){
EXTI_InitTypeDef EXTI_InitStructure;
//PB15 input
GPIOB->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR15;
GPIOB->PUPDR &= ~(GPIO_PUPDR_PUPDR15); //NO PULL
/* clock SYSCFG */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Interrupt PB15 pin */
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB, EXTI_PinSource15);
EXTI_ClearITPendingBit(EXTI_Line15);
EXTI_InitStructure.EXTI_Line = EXTI_Line15;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
}
void iniezioneConf(void){
EXTI_InitTypeDef EXTI_InitStructure;
//PA11 input
GPIOA->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR11;
GPIOA->PUPDR &= ~(GPIO_PUPDR_PUPDR11); //NO PULL
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Interrupt PA11 pin */
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource11);
EXTI_ClearITPendingBit(EXTI_Line11);
EXTI_InitStructure.EXTI_Line = EXTI_Line11;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
}
void syncConfig(void)
{
/* PF7 input */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOF, &GPIO_InitStructure);
/* Abilitazione clock SYSCFG */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOF, EXTI_PinSource7);
EXTI_InitStructure.EXTI_Line = EXTI_Line7;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = EXTI4_15_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPriority = 0x00;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void EXTI4_15_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line7) != RESET)
{
....
/* Clear the EXTI line 7 pending bit */
EXTI_ClearITPendingBit(EXTI_Line7);
}
//Batch-StandBy
if(EXTI_GetITStatus(EXTI_Line10) != RESET){
EXTI_ClearITPendingBit(EXTI_Line10);
}else if(EXTI_GetITStatus(EXTI_Line10) != SET){
EXTI_ClearITPendingBit(EXTI_Line10);
}
//Iniezione
if(EXTI_GetITStatus(EXTI_Line11) != RESET){
....
EXTI_ClearITPendingBit(EXTI_Line11);
}
//Impulso
if(EXTI_GetITStatus(EXTI_Line15) != RESET)
{
....
EXTI_ClearITPendingBit(EXTI_Line15);
}
}
In order, I call:batchStandByConf,impulsiConf, iniezioneConf and for lastsyncConfig.
the interrupt on PF7 and PB15 is ok, instead interrupt on PC10 and PA11 is not ok.
The interrupt on PC10 and interrupt on PA11 always begin. is there a reason?
Thanks.