Hi everybody,
I made a board with an STM32G491KEU6, and I am facing a peculiar problem.
The external interrupt on Pin PA1 takes milliseconds (around 400k cycles @144MHz).
To test, I've made a completely empty project, and just configured two pins:
PA0 - EXTO GPIO with a PWM signal going in, rising and falling edge.
PB0 as an output, which also drives a LED.
Now, the
only code i have added to the code generated by STM32CubeIDE is the ISR callback for that interrupt. Even the while loop in main() is completely empty.
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if(HAL_GPIO_ReadPin(PWM1_IN_GPIO_Port,PWM1_IN_Pin))
HAL_GPIO_WritePin(LED_RUN_GPIO_Port,LED_RUN_Pin, 1);
else
HAL_GPIO_WritePin(LED_RUN_GPIO_Port,LED_RUN_Pin, 0);
}
So basically, all the callback function does, is copy the PWM signal from PA0 to PB0.
If i probe the input and output, i see a delay which is utterly insane. So somehow, the core must be doing something else, because it should be less than 100 cycles. Pushing all registers onto the stack and doing some housekeeping, then call the ISR - that's it.
I'm hoping someone has the experience to know what's going on. I've been pulling my hair out for the last two days.
Things I've tried:
- Changing the IRQ level. Makes no difference at all.
- Cleared all other code. As mentioned, this happens even in a completely empty project with just the ISR.
What's going on? Is HAL doing me dirty again?