cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32L4xx]: Configuration of external interrupt (user B1)

Smart Solutions
Associate
Posted on November 11, 2017 at 20:28

Dear All,

[Micro controller Configuration]

- Nucleo L476RG

- x-Nucleo-IDW01M1

[Issue Description]

- I am using the wifi client_socket example project from STM and configuring button B1, line 13 (PC.13) to interrupt mode. Below are the configuration details and code snapshot,

i) To the existing code from the example project, 2 functions are added a) to configure the pin to interrupt mode [EXTI15_10_IRQHandler_Config()] ( b) call back function. [HAL_GPIO_EXTI_Callback()]

/*********************************Code Start*******************************************/

int main(void)

{

uint8_t socket_open = 0;

uint32_t portnumber = 32000;//23 for 4.ifcfg.me;//37 for nist.gov

uint16_t len; /*Take care to change the length of the text we are sending*/

char *protocol = 't';//t -> tcp , s-> secure tcp

char *data = 'Hello World!\r\n';

len = strlen(data);

WiFi_Status_t status = WiFi_MODULE_SUCCESS;

__GPIOA_CLK_ENABLE();

HAL_Init();

/* Configure the system clock to 64 MHz */

SystemClock_Config();

SystemCoreClockUpdate();

/* -2- Configure External line 13 (connected to PC.13 pin) in interrupt mode */

EXTI15_10_IRQHandler_Config();

/* configure the timers */

Timer_Config( );

&sharpifdef USART_PRINT_MSG

UART_Msg_Gpio_Init();

USART_PRINT_MSG_Configuration(&UART_MsgHandle,115200);

Set_UartMsgHandle(&UART_MsgHandle);

&sharpendif

.

.

.

}

/**

* @brief Configures EXTI lines 10 to 15 (connected to PC.13 pin) in interrupt mode

* @param None

* @retval None

*/

static void EXTI15_10_IRQHandler_Config(void)

{

GPIO_InitTypeDef GPIO_InitStructure;

/* Enable GPIOC clock */

__HAL_RCC_GPIOC_CLK_ENABLE();

/* Configure PC.13 pin as input floating */

GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;

GPIO_InitStructure.Pull = GPIO_NOPULL;

GPIO_InitStructure.Pin = GPIO_PIN_13;

HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);

/* Enable and set EXTI lines 10 to 15 Interrupt to the lowest priority */

HAL_NVIC_SetPriority(EXTI15_10_IRQn, 2, 0);

HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);

}

/**

* @brief EXTI line detection callbacks

* @param GPIO_Pin: Specifies the pins connected EXTI line

* @retval None

*/

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)

{

if (GPIO_Pin == GPIO_PIN_13)

{

counter++;

}

}

/*********************************Code End*******************************************/

[Outcome]

- Code complies successfully.

- The code hangs after trigger of button B1. On debug mode, code is seen to enter the below infinite loop.

File

startup_stm32l476xx

.s

/*********************************Code 

Start

*******************************************/

/**

* @brief This is the code that gets called when the processor receives an

* unexpected interrupt. This simply enters an infinite loop, preserving

* the system state for examination by a debugger.

*

* @param None

* @retval : None

*/

.section .text.Default_Handler,'ax',%progbits

Default_Handler:

Infinite_Loop:

b Infinite_Loop

.size Default_Handler, .-Default_Handler

/*********************************Code 

End

*******************************************/

Appreciate if some one could help me to debug the issue. 

Thanks 

#stm32l4 #wifi-expansion-board #wifi-spwf01sa #external-interrupt
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on November 12, 2017 at 02:01

You don't have an 

EXTI15_10_IRQHandler() ?

void EXTI15_10_IRQHandler(void)

{

HAL_GPIO_EXTI_IRQHandler(

GPIO_PIN_13

);

}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2
Posted on November 12, 2017 at 02:01

You don't have an 

EXTI15_10_IRQHandler() ?

void EXTI15_10_IRQHandler(void)

{

HAL_GPIO_EXTI_IRQHandler(

GPIO_PIN_13

);

}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Smart Solutions
Associate
Posted on November 12, 2017 at 14:38

Thank you Clive