Problems with STM32G431K8Tx
Good day, I'm developing a remote control using a STM32G and I encounter some problems.
For my code i need two timers:
Timer1: it has a 1us overflow time and is not handled by any interruption, I just use it to count micro seconds for my delay_us function.
Timer3: its configured with a interruption frequency of about 76.2kHz and it is handled by an interruption. This timer is used to modulate an output so it should only negate a variable and make an and operation between that variable and the output.
For now I'm just testing whether the controller runs, and I'm just making a led blink:
void setLED(uint8_t val)
{
HAL_GPIO_WritePin(OUT_LED_GPIO_Port, OUT_LED_Pin, !val);
}
while (1)
{
setLED(1);
HAL_Delay(500);
setLED(0);
HAL_Delay(500);
}I'm seeing some erratic behavior, with timer's 3 interruption on if I leave the interruption handler empty it works and the led blinks, but if I even make a variable assignment inside the interruption handler it stops working.
The debugger hangs just before entering HAL_Delay().
It also works in debug mode but not in release.
Led blink:
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if (htim == &htim3)
{
}
}Led doesn't blink:
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if (htim == &htim3)
{
uint8_t var = 0;
}
}Here I leave the code and configuration:
Timer3:
Timer1
NVIC:
GPIO:
Thank you for your help!
