2020-08-28 08:49 PM
STM32H750
STM32CubeMX 6.0.1
STM32H FW 1.8
use LL driver, but the EXIT is not working.
use HAL driver , works ok
test on PC8 as EXIT
modify nothing, the code is gen by CubeMX
2020-08-28 10:09 PM
You mean EXTI?
Read out and check/compare between working and non-working, content of relevant GPIO, SYSCFG and EXTI registers. Make sure you have enabled respective interrupt in NVIC and in disasm verify that respective ISR is properly inserted to the vector table.
JW
2020-08-28 11:01 PM
yes EXTI.
Thanks very much. I have find the problem.
I think it is a bug of cubemx 6.0.1.
when I compare the code gen by cubemx 5.6, I find the problem.
In cubemx 6.0.1. GPIO LL driver mode.
the exti gpio is not set to input mode
gpio.c:
GPIO_InitStruct.Pin = LL_GPIO_PIN_13|LL_GPIO_PIN_14|LL_GPIO_PIN_15|LL_GPIO_PIN_2
|LL_GPIO_PIN_3;
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
but, In gpio hal mode:
it will be set in input mode in gpio.c
2020-09-07 06:00 AM
2020-09-09 11:31 PM
2020-09-18 10:30 AM
Hi Davi,
Sorry for delay.
Actually, I can’t track the issue. Could you please precise more your problem? it will be more helpful.
In fact I have loaded your attached project (with STM32CubeMX v6.0.1) to check the generated code;
In STM32h7xx_ll_gpio.c file, the generated code looks like:
void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct)
{
/* Reset GPIO init structure parameters values */
GPIO_InitStruct->Pin = LL_GPIO_PIN_ALL;
GPIO_InitStruct->Mode = LL_GPIO_MODE_ANALOG;
GPIO_InitStruct->Speed = LL_GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct->OutputType = LL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStruct->Pull = LL_GPIO_PULL_NO;
GPIO_InitStruct->Alternate = LL_GPIO_AF_0;
}
And backing to main.c, the generated code is as follow :
static void MX_GPIO_Init(void)
{
LL_EXTI_InitTypeDef EXTI_InitStruct = {0};
/* GPIO Ports Clock Enable */
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOD);
/**/
LL_EXTI_InitTypeDef EXTI_InitStruct = {0};
/* GPIO Ports Clock Enable */
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOD);
/**/
LL_SYSCFG_SetEXTISource(LL_SYSCFG_EXTI_PORTD, LL_SYSCFG_EXTI_LINE12);
/**/
EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_12;
EXTI_InitStruct.Line_32_63 = LL_EXTI_LINE_NONE;
EXTI_InitStruct.Line_64_95 = LL_EXTI_LINE_NONE;
EXTI_InitStruct.LineCommand = ENABLE;
EXTI_InitStruct.Mode = LL_EXTI_MODE_IT;
EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_RISING;
LL_EXTI_Init(&EXTI_InitStruct);
/**/
LL_GPIO_SetPinPull(GPIOD, LL_GPIO_PIN_12, LL_GPIO_PULL_UP);
/* EXTI interrupt init*/
NVIC_SetPriority(EXTI15_10_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(EXTI15_10_IRQn);
}
When using HAL Drive, in the generated main.c file, the code is as follow:
static void MX_GPIO_Init(void)
{
LL_EXTI_InitTypeDef EXTI_InitStruct = {0};
/* GPIO Ports Clock Enable */
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOD);
/**/
LL_SYSCFG_SetEXTISource(LL_SYSCFG_EXTI_PORTD, LL_SYSCFG_EXTI_LINE12);
/**/
EXTI_InitStruct.Line_0_31 = LL_EXTI_LINE_12;
EXTI_InitStruct.Line_32_63 = LL_EXTI_LINE_NONE;
EXTI_InitStruct.Line_64_95 = LL_EXTI_LINE_NONE;
EXTI_InitStruct.LineCommand = ENABLE;
EXTI_InitStruct.Mode = LL_EXTI_MODE_IT;
EXTI_InitStruct.Trigger = LL_EXTI_TRIGGER_RISING;
LL_EXTI_Init(&EXTI_InitStruct);
/**/
LL_GPIO_SetPinPull(GPIOD, LL_GPIO_PIN_12, LL_GPIO_PULL_UP);
/* EXTI interrupt init*/
NVIC_SetPriority(EXTI15_10_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(EXTI15_10_IRQn);
}
Do you find a problem in one of the line I just mentioned above? And why do you think that EXTI gpio should be set to input mode using LL driver?
PS: I can’t notice any differences btw CubeMX v5.6 and the latest version generated code.
Waiting for your response.
Thanks in advance,
Regards,
Khouloud.