cancel
Showing results for 
Search instead for 
Did you mean: 

STM32VL EXTI

xtian
Associate II
Posted on February 05, 2013 at 08:39

Hello Guys,

I am trying to play with EXTI of STM32VL but what seems to be the problem in this code why I can't make it work


int main(void)

{


GPIO_InitTypeDef GPIO_InitStructure;

EXTI_InitTypeDef EXTI_InitStructure;

NVIC_InitTypeDef NVIC_InitStructure;


GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; 

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; 

GPIO_Init(GPIOA, &GPIO_InitStructure);



RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);


EXTI_InitStructure.EXTI_Line = EXTI_Line1;

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 = EXTI1_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;


NVIC_Init(&NVIC_InitStructure); 


STM32vldiscovery_LEDInit(LED3);

//STM32vldiscovery_PBInit(BUTTON_USER, BUTTON_MODE_EXTI); 



while (1)

{

}

}

in the stm32f10x_it.c

void EXTI1_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line1) != RESET)
{
/* Toggle LED3 */
STM32vldiscovery_LEDToggle(LED3);
/* Clear the User Button EXTI line pending bit */
EXTI_ClearITPendingBit(EXTI_Line4);
}
}

2 REPLIES 2
xtian
Associate II
Posted on February 05, 2013 at 10:19

I found my mistake

EXTI_ClearITPendingBit(EXTI_Line4);

is should be line1
xtian
Associate II
Posted on February 05, 2013 at 10:21

I still accept comments and addons for this code... if you can add something helpfull about EXTI please add.. thank you!