How to use GPIO external interrupt

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MaCa_2922036
Level 3
Level 3
10 replies posted 10 sign-ins 5 replies posted

Hello,

I have an SPI communication between my 1LD Wifi/BT module and another MCU.

This SPI use SPI5 hardware and works with DMA for Tx and Rx.

I want to use the chip select (pin 57, PB1, with external PullUp) configured as input pin with external interrupt.

I tried the follow configuration, but it never enter in the interrupt handler

Is the right use for configuration of external interrupt ?

Option 1

void init_NssPin (void)

{

      NssGpio.pin_number = 1;

      NssGpio.port = GPIOB;

       platform_gpio_init( &NssGpio, INPUT_HIGH_IMPEDANCE );

       platform_result_t res;

       res = platform_gpio_irq_enable (&NssGpio, IRQ_TRIGGER_RISING_EDGE, ISR_SpiNss_handler, 0 );

       WPRINT_APP_INFO( ( "result of NSS IRQ init = %d\n",res ) ); // note: result code give me 6010 which mean NO_EFFECT ...

}

void ISR_SpiNss_handler( void* arg )

{

     v_SetLedState(0,1); // debug:  LED_INDEX_1 set to high

}

I aslo tried a second option with ExtInt functions and force the mapping of ISR function:

Option 2

SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB, EXTI_PinSource1);   

ExtIntSpiNss.EXTI_Line = EXTI_Line1;    

ExtIntSpiNss.EXTI_LineCmd = ENABLE;   

ExtIntSpiNss.EXTI_Mode = EXTI_Mode_Interrupt;   

ExtIntSpiNss.EXTI_Trigger = EXTI_Trigger_Rising;    

EXTI_Init(&ExtIntSpiNss);    

/* Add IRQ vector to NVIC */    

NVIC_InitTypeDef NVIC_InitStruct;   

NVIC_InitStruct.NVIC_IRQChannel = EXTI1_IRQn;    

NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 0x01;   

NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0x00;   

NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;    

NVIC_Init(&NVIC_InitStruct);

WWD_RTOS_DEFINE_ISR ( ISR_SpiNss_handler )

{

     v_SetLedState(0,1); // debug:  LED_INDEX_1 set to high

}

WWD_RTOS_MAP_ISR(ISR_SpiNss_handler, EXTI1_irq)

But it also don't work.

Could you help me ?

Note: I use WICED v.6.2

0 Likes
8 Replies