cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F105RC PB6 always stay 0, EXTI never trigg

BSANT.17
Associate II

	// 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.

10 REPLIES 10

> PB IDR bit 6 always stay to 0 but I'm sure it's not true.

How do you know that?

JW

Chris1
Senior III

Have you enabled clocks for GPIOB and AFIO?

+1 AFIO required for EXTI config on F1

Is a pull-up required? How are you driving the pin?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
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.

Oscilloscope.

No Pull-up required.

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

BSANT.17
Associate II
  /*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.

... not moving when my program running. Maybe the PB6 pull to 0V.