Haberler:

Forum kuralları güncellendi LÜTFEN  okuyunuz:  https://bit.ly/2IjR3ME

Ana Menü

STM32F429 EXTI Problem

Başlatan Forever_Embedded, 01 Eylül 2015, 13:56:29

Forever_Embedded

Merhaba;

PG9 ve PA9 pinlerine birer buton bağladım. Bunların ikisinin de pin sourceları aynı olduğu için hangisini main dosyasının içinde sonradan yazsam sonradan yazdığım buton çalışıyor sadece. Bunu it.c dosyasındaki fonksiyona aşağıdaki kodu yazarak aşmaya çalıştım ama olmadı:
if(EXTI_GetITStatus(LCD_B1_PINLINE) == SET && GPIO_ReadInputDataBit(LCD_B1_PORT,LCD_B1_PIN)==1 )
{
...
}


Aşağıda Configurationn ayarlarını veriyorum:

/*LCD Button Pins*/
#define LCD_B1_PIN  GPIO_Pin_9
#define LCD_B5_PIN  GPIO_Pin_9

/*LCD Button Pin Sources,Lines, Port Sources for EXTI*/
#define LCD_B1_PINSOURCE  EXTI_PinSource9
#define LCD_B5_PINSOURCE  EXTI_PinSource9

#define LCD_B1_PINLINE  EXTI_Line9
#define LCD_B5_PINLINE  EXTI_Line9

#define LCD_B1_PORTSOURCE  EXTI_PortSourceGPIOA
#define LCD_B5_PORTSOURCE  EXTI_PortSourceGPIOG

/*LCD Button Ports*/
#define LCD_B1_PORT  GPIOA
#define LCD_B5_PORT  GPIOG

/*LCD Button Clocks Defines*/
#define LCD_B1_CLOCKS  RCC_AHB1Periph_GPIOA
#define LCD_B5_CLOCKS  RCC_AHB1Periph_GPIOG
/*******************************************************************************************************/
void B1_Config(void)
{	
  EXTI_InitTypeDef   EXTI_InitStructure_B1;
  GPIO_InitTypeDef   GPIO_InitStructure_B1;
  NVIC_InitTypeDef   NVIC_InitStructure_B1;
	
	/* LCD BUTTON1 EXTI CONF0GURATION*/	
  /* Enable clocks */
  RCC_AHB1PeriphClockCmd(LCD_B1_CLOCKS, ENABLE);
  /* Enable SYSCFG clock */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
  
  /* Configure PC pin as input floating */
  GPIO_InitStructure_B1.GPIO_Mode = GPIO_Mode_IN;
  GPIO_InitStructure_B1.GPIO_PuPd = GPIO_PuPd_DOWN;
  GPIO_InitStructure_B1.GPIO_Pin = LCD_B1_PIN;
  GPIO_Init(LCD_B1_PORT, &GPIO_InitStructure_B1);

  /* Connect EXTI Line to pin */
  SYSCFG_EXTILineConfig(LCD_B1_PORTSOURCE, LCD_B1_PINSOURCE);
  
  /* Configure EXTI Line */
  EXTI_InitStructure_B1.EXTI_Line = LCD_B1_PINLINE;
  EXTI_InitStructure_B1.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure_B1.EXTI_Trigger = EXTI_Trigger_Rising;  
  EXTI_InitStructure_B1.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure_B1);

  /* Enable and set EXTI Line Interrupt to the lowest priority */
  NVIC_InitStructure_B1.NVIC_IRQChannel = EXTI9_5_IRQn;
  NVIC_InitStructure_B1.NVIC_IRQChannelPreemptionPriority = 0x00;
  NVIC_InitStructure_B1.NVIC_IRQChannelSubPriority = 0x00;
  NVIC_InitStructure_B1.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure_B1);
}
/*********************************************************************************************/
void B5_Config(void)
{
	EXTI_InitTypeDef   EXTI_InitStructure_B5;
  GPIO_InitTypeDef   GPIO_InitStructure_B5;
  NVIC_InitTypeDef   NVIC_InitStructure_B5;
	
	/* LCD BUTTON5 EXTI CONF0GURATION*/	
  /* Enable clocks */
  RCC_AHB1PeriphClockCmd(LCD_B5_CLOCKS, ENABLE);
  /* Enable SYSCFG clock */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
  
  /* Configure pin as input floating */
  GPIO_InitStructure_B5.GPIO_Mode = GPIO_Mode_IN;
  GPIO_InitStructure_B5.GPIO_PuPd = GPIO_PuPd_DOWN;
  GPIO_InitStructure_B5.GPIO_Pin = LCD_B5_PIN;
  GPIO_Init(LCD_B5_PORT, &GPIO_InitStructure_B5);

  /* Connect EXTI Line to pin */
  SYSCFG_EXTILineConfig(LCD_B5_PORTSOURCE, LCD_B5_PINSOURCE);
  
  /* Configure EXTI Line */
  EXTI_InitStructure_B5.EXTI_Line = LCD_B5_PINLINE;
  EXTI_InitStructure_B5.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure_B5.EXTI_Trigger = EXTI_Trigger_Rising;  
  EXTI_InitStructure_B5.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure_B5);

  /* Enable and set EXTI Line Interrupt to the lowest priority */
  NVIC_InitStructure_B5.NVIC_IRQChannel = EXTI9_5_IRQn;
  NVIC_InitStructure_B5.NVIC_IRQChannelPreemptionPriority = 0x0F;
  NVIC_InitStructure_B5.NVIC_IRQChannelSubPriority = 0x0F;
  NVIC_InitStructure_B5.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure_B5);
}

Forever_Embedded

Gerçekten zor bir soru sormuşum :D kimseden cevap gelmedi :D

magnetron

exti9-5 interrupt bütün portlar için sadece 1 tane var

aşağıdaki resim ( reference manual'den )

http://postimg.cc/image/ngyvifey1/

yani 2 değişik porta ayrı ayrı exti9_5 tanımlayamazsınız