2012-09-19 06:51 PM
I have EXTI example running on my stm32f4 board but I am having trouble changing the PIN which causes the interrupt.
Here is the initialization method:void EXTILine0_Config(void){
GPIO_InitTypeDef GPIO_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/* Enable GPIOA clock */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Configure PA0 pin as input floating */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Connect EXTI Line0 to PA0 pin */
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource0);
/* Configure EXTI Line0 */
EXTI_InitStructure.EXTI_Line = EXTI_Line0;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
/* Enable and set EXTI Line0 Interrupt to the lowest priority */
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x01;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x01;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
} I am trying to change the replace GPIO_Pin_0 in ''GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;'' but still - my led is controlled via the same user button, and via applying +3 to PA0, not any other PA pin. I have even tried changing EXTI_PinSource0 - same thing, only PA0 causes the interrupt. I have double checked that I am in fact rebuilding and reflashing a couple of times - I can easily change which LED I control with the EXTI, this confirm that I am in fact do execute the new binary. What am I missing here? #pa0 #falling-edge #interrupts
2015-03-10 08:18 AM
Thanks for your reply, it means i tested first time with PA0 OK, second time with PA1 OK, but the third time I only config PB1 as EXTI1 (not PA1 or both), but PB1 pin doesn't work, it works on PA1 pin instead.
Thanks you!2015-03-10 08:53 AM
I have no insight into your board design, or code. You have posted to a >2 year old thread about a different chip.
2015-03-10 11:22 AM
Hihi, thank Mr Clive1 so much, I will check my problem again!
Have fun!2015-03-10 09:52 PM
2015-03-26 03:29 AM
I'm currently also trying to setup a Interrupt by configuring the Registers of the cpu.
Inthe code above i see a function SYSCFG_EXTILineConfig. I just downloaded the latest board Support package (stm32cubef4 1.5.0.) and there is no such function. Where does this function come from? Also i'm missing theNVIC_Init
function. I only have HAL_GPIO_Init and a bunch of registers. ^^
2015-03-26 05:16 AM
This thread is about using the
http://www.st.com/web/en/catalog/tools/PF257901
, not the HAL/Cube implementation.2015-03-26 08:10 AM
Thanks for the help.