STM32F4Discovery external interrupt problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2013-05-13 06:46 AM
Hello, I have a problem with external interrupts on STM32F4Discovery triggered via push-button. The button is connected to pin PA4 using the same technique used for USER button (the picture is from the user manual): http://imgimageshack.us/img248/8849/stm32f4discoveryuserbut.png The external interrupt is generated and the switch button performs its function, but the problem is that the interrupt is generated not only via pushing the button, but for example by touching only one of the legs of the push-button with a multimeter probe or by touching certain individual pins (not short circuiting several pins with a probe, but touching only one) on the board (e.g. PORTA pins, which are left unconfigured in the code). I am posting the relevant code portion: void
EXTI4_IRQHandler( void ){if
(EXTI_GetITStatus(EXTI_Line4) != RESET) { GPIO_ToggleBits(GPIOD, GPIO_Pin_14);EXTI_ClearITPendingBit(EXTI_Line4);
} } void init_func( void ){ //output omitted RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); //pin init GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; GPIO_Init(GPIOA, &GPIO_InitStructure);SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource4);
//exti4 init
EXTI_InitStructure.EXTI_Line = EXTI_Line4; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure);//nvic exti4 init
NVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); //output omitted } Perhaps you can help? #stm32f4discovery- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2013-05-13 07:04 AM
Perhaps you can help?
Sounds more of an issue with your hardware, than the software. Chances are you have a grounding issue, or one with the meter changing the potential on the pins (other pins impacted via the IO ring supply). Consider wiring the switch the other way, ie normally pulled high, button closed to ground, and reverse the logic on the EXTI (falling)Up vote any posts that you find helpful, it shows what's working..