2025-08-09 7:26 AM
I have generated the code generated from MCSDK 6.4.0 for the micro STM32G431CB to STM32G431RBT6 micro.
My understanding is all the Hall drivers remain the same, the startup file and the .ld file will vary based on the micro controller. But i am running into the issue where ADC2 handler is getting called which it shall not as long as the PWM is OFF.
There is one signal handler called as shown above i am not sure what it is? I have been struggling to understand, please help.
2025-08-09 7:40 AM
Yes HAL is same , but no only ld require change. If you use Cube IDE check and change build defines etc.
2025-08-09 7:53 AM
Can you please tell me where the build defines will be in which files. I have generated the code using MCSDK 6.4.0 and then manually edited the files
For pin mapping i have changed in main.h
stm32g4xx_hal_msp.c i have changed,
Application files i have changed.
2025-08-09 7:59 AM
Set a breakpoint at ADC1_2_IRQHandler and check the flags of ADC1, ADC2 to see why it's being called.
2025-08-09 8:34 AM
I found this issue yesterday and identified that there was an upgrade in msp.c / hal driver file as below
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* htim_pwm)
{
if(htim_pwm->Instance==TIM1)
{
/* USER CODE BEGIN TIM1_MspInit 0 */
/* USER CODE END TIM1_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_TIM1_CLK_ENABLE();
/* USER CODE BEGIN TIM1_MspInit 1 */
/* USER CODE END TIM1_MspInit 1 */
}
}
compared to previous version of
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
i have verified that the problem was not occuring and was confident that was the root cause, but now again it is getting triggered not sure why. I will start checking the ADC1, ADC2 flags as you suggested.