cancel
Showing results for 
Search instead for 
Did you mean: 

STM32c0. Issue in push button on external interrupt example

STDoom
Associate II

Hi All

I'm new to STM32 and I'm exploring it a little bit. I think I've found an issue in the HAL 

 

in configuration Line is referred to the external interrupt line to be connected.

 

it is configured in the BSP with  (void)HAL_EXTI_GetHandle(&hpb_exti[Button], BUTTON_EXTI_LINE[Button]);

 

where static const uint32_t BUTTON_EXTI_LINE[BUTTONn] = {BUTTON_USER_EXTI_LINE}; and BUTTON_USER_EXTI_LINE is 0x2000;

 

the problem is in the usage of Line (in all the  stm32c0xx_hal_exti.c file!)

STDoom_0-1713646283415.png

linepos is almost always 0 since EXTI_PIN_MASK is 1 and this is wrong. Removing the & all seems to work properly.

Since it one of the first test that I'm doing with the ST IDE and HAL might be I'm doing something wrong :D  

 

 

 

6 REPLIES 6
Simon.T
ST Employee

Hello @STDoom , 

 

First of all, welcome in the ST community. 

Is it possible to send you code ? Because I tried to have an EXTI interrupt with the BUTTON_USER and I'm facing no issue and it is working fine. 

 

Best regards,

 

Simon

Hi

I've just created the example for the demoboard  NUCLEO- STM32C0.

If it might help later I'll copy here the project but I think was this one (https://wiki.st.com/stm32mcu/wiki/Getting_started_with_EXTI)

STDoom
Associate II

here the example. I've created a new empty project for the selected board Nucleo C031C6 adding the BSP selecting the led + the button (NO VCM) and generate the example code.

For some reason it doesn't run on my board as is so I've changed the clock set up (to use HSI not the HSE) 

Simon.T
ST Employee

Hello @STDoom ,

 

I confirmed your issue and I have submitted an internal ticket addressing your request to the dev team.

Internal ticket number: 179773 (This is an internal tracking number and is not accessible or usable by customers).

Your workaround is working. Thanks for your contribution.

 

Best regards,

 

Simon

Simon.T
ST Employee

Hello @STDoom ,

 

To fix the issue in the bsp header file "stm32c0xx_nucleo.h" line 191 you need to replace this code:

#define BUTTON_USER_EXTI_LINE GPIO_PIN_13

by this code:

#define BUTTON_USER_EXTI_LINE EXTI_LINE_13

 

This will be implemented for the Cube FW revision.

 

Best regards,

 

Simon

In this same example, now when code is generated for Nucleo board C031C06, STM32CubeIDE generates this code in the file stm32c0xx_it.c:

HAL_EXTI_IRQHandler(&H_EXTI_13);

but when try to compile, it says:

../Core/Src/stm32c0xx_it.c:151:24: error: 'H_EXTI_13' undeclared (first use in this function)   151 |   HAL_EXTI_IRQHandler(&H_EXTI_13);

Making it unusable. Is there a way to solve it?