cancel
Showing results for 
Search instead for 
Did you mean: 

STM32W108xx IRQC configuration

harinath
Associate III
Posted on August 06, 2013 at 19:20

Hello all,

I'm working on STM32W108xx & interfacing a sensor whose interrupt pin connected to the PB7, IRQC pin. How to configure this pin for the following handler ?

void
EXTIC_IRQHandler(
void
)
{
if
(EXTI_GetITStatus(EXTI_IRQC))
{
EXTI_ClearITPendingBit(EXTI_IRQC);
}
}

I tried to call simply the following function, but doesn't work.

NVIC_EnableIRQ(EXTIC_IRQn);

It looks that this Interrupt configuration is bit different from the STM32 based MCUs. Any code sample would be a great help. #stm32w108
3 REPLIES 3
Posted on August 06, 2013 at 19:51

void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode)
{
GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/* Configure Button pin as input */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_PUD;
GPIO_InitStructure.GPIO_Pin = BUTTON_PIN[Button];
GPIO_Init(BUTTON_PORT[Button], &GPIO_InitStructure);
/* Set pull-up on button I/O */
GPIO_SetBits(BUTTON_PORT[Button], BUTTON_PIN[Button]);
if (Button_Mode == BUTTON_MODE_EXTI)
{
/* Configure Button EXTI line */
EXTI_InitStructure.EXTI_Source = BUTTON_EXTI_SOURCE[Button];
EXTI_InitStructure.EXTI_IRQn = BUTTON_EXTI_IRQn[Button];
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling_Edge;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_InitStructure.EXTI_DigitalFilterCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
/* Enable and set Button EXTI Interrupt to the lowest priority */
NVIC_InitStructure.NVIC_IRQChannel = BUTTON_IRQn[Button];
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 06, 2013 at 19:57

{
GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
// PB7, check also other clocks, GPIO, SYSCLK or whatever
/* Configure Button pin as input */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_PUD;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Set pull-up on button I/O */
GPIO_SetBits(GPIOB, GPIO_Pin_7);
/* Configure Button EXTI line */
EXTI_InitStructure.EXTI_Source = EXTI_SourcePB7;
EXTI_InitStructure.EXTI_IRQn = EXTI_IRQC;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling_Edge;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_InitStructure.EXTI_DigitalFilterCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
/* Enable and set Button EXTI Interrupt to the lowest priority */
NVIC_InitStructure.NVIC_IRQChannel = EXTIC_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void EXTIC_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_IRQC) == SET)
{
EXTI_ClearITPendingBit(EXTI_IRQC);
// Do something
}
}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
harinath
Associate III
Posted on August 10, 2013 at 03:54

Works perfect. Thank you clive1.