STM32G431RB seems to crash when "HAL_TIM_Base_Start_IT" and "HAL_TIM_PWM_Start_IT" are called
Hello everybody,
I bought a STM32G431RB Nucleo. I created code for it with the STM32 CubeMX and modiefied the code in the STM32 CubeIDE. I want to access "HAL_TIM_PeriodElapsedCallback" and "HAL_TIM_PWM_PulseFinishedCallback", I read that this is possible by calling "HAL_TIM_Base_Start_IT" for "HAL_TIM_PeriodElapsedCallback" and "HAL_TIM_PWM_Start_IT" for "HAL_TIM_PWM_PulseFinishedCallback". But when I do that, the STM32 seems to crash.
Am I doing something wrong, or is this simply not possible?
Thank you in advance!
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_LPUART1_UART_Init();
MX_TIM4_Init();
/* USER CODE BEGIN 2 */
// For some reason I can't have both Base_Start_IT and PWM_Start_IT
HAL_TIM_Base_Start_IT(&htim4); // Calls HAL_TIM_PeriodElapsedCallback
HAL_TIM_PWM_Start_IT(&htim4, TIM_CHANNEL_1); // Calls HAL_TIM_PWM_PulseFinishedCallback
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, 1); // Never gets reached
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
