2018-11-20 08:38 AM
// PB6 Main sync pin
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
// Connect EXTI6 Line to PB6 pin
GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource6);
//Configure EXTI 6
EXTI_InitTypeDef EXTI_InitStructure;
EXTI_InitStructure.EXTI_Line = EXTI_Line6;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
/* Enable the EXTI9_5 Interrupt */
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_EnableIRQ(EXTI9_5_IRQn);
/* Clear interrupt flag */
EXTI_ClearITPendingBit(EXTI_Line6);
Hi, I've got a problem with my EXTI6. I try to get interrupt on falling and rising edges.
I've watched SFR register but I don't understand why it doesn't work.
PB IDR bit 6 always stay to 0 but I'm sure it's not true.
IRQ are enabled, software interrupt trig works perfectly.
I use Eclipse with Std peripheral lib V3.5.0.
Is anyone think about something ?
EDIT : Signal NOT moving when my program running.
Thanks.
2018-11-20 09:07 AM
> PB IDR bit 6 always stay to 0 but I'm sure it's not true.
How do you know that?
JW
2018-11-20 09:26 AM
Have you enabled clocks for GPIOB and AFIO?
2018-11-20 01:29 PM
+1 AFIO required for EXTI config on F1
Is a pull-up required? How are you driving the pin?
2018-11-21 12:10 AM
RCC_APB2PeriphClockCmd(
RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC
| RCC_APB2Periph_GPIOD | RCC_APB2Periph_AFIO
| RCC_APB2Periph_SPI1 | RCC_APB2Periph_TIM1
| RCC_APB2Periph_ADC1, ENABLE);
Clock APB2 is set before.
2018-11-21 12:11 AM
Oscilloscope.
2018-11-21 12:12 AM
No Pull-up required.
2018-11-21 12:14 AM
And did the probe touch PB6 pin directly?
Until you see PB IDR bit 6 actually change in the debugger, or if examined in the program, it's not proven to change.
JW
2018-11-21 12:14 AM
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = Main_Sync_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(Main_Sync_GPIO_Port, &GPIO_InitStruct);
/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
This code works perfectly in atollic, need to works on eclipse.
2018-11-21 12:31 AM