cancel
Showing results for 
Search instead for 
Did you mean: 

Porting of code from STM32G431CB to STM32G431RBT6

STuser2
Associate III

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. 

STuser2_0-1754749495109.png

There is one signal handler called as shown above i am not sure what it is? I have been struggling to understand, please help.

4 REPLIES 4
MM..1
Chief III

Yes HAL is same , but no only ld require change. If you use Cube IDE check and change build defines etc.

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. 

 

 

TDK
Super User

Set a breakpoint at ADC1_2_IRQHandler and check the flags of ADC1, ADC2 to see why it's being called.

If you feel a post has answered your question, please click "Accept as Solution".
STuser2
Associate III

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.