cancel
Showing results for 
Search instead for 
Did you mean: 

About FOC generated code with MCSDK

LLion.1
Associate

I am a newer leraning motor FOC control. I study the generated code by MCSDK tool with hall (120 degree). Below is some question:

  1. In file mc_config.c, about hall configuration ".hMaxReliableMecSpeedUnit     = (uint16_t)(1.15*MAX_APPLICATION_SPEED_UNIT),". Here why need to times 1.15?
  2. In file mc_parameters.c, about ADC configuration, as below

.ADCConfig1 = {  MC_ADC_CHANNEL_11<<ADC_JSQR_JSQ4_Pos

          ,MC_ADC_CHANNEL_10<<ADC_JSQR_JSQ4_Pos

          ,MC_ADC_CHANNEL_10<<ADC_JSQR_JSQ4_Pos

          ,MC_ADC_CHANNEL_10<<ADC_JSQR_JSQ4_Pos

          ,MC_ADC_CHANNEL_10<<ADC_JSQR_JSQ4_Pos

          ,MC_ADC_CHANNEL_11<<ADC_JSQR_JSQ4_Pos

         },

 .ADCConfig2 = {  MC_ADC_CHANNEL_12<<ADC_JSQR_JSQ4_Pos

          ,MC_ADC_CHANNEL_12<<ADC_JSQR_JSQ4_Pos

          ,MC_ADC_CHANNEL_12<<ADC_JSQR_JSQ4_Pos

          ,MC_ADC_CHANNEL_11<<ADC_JSQR_JSQ4_Pos

          ,MC_ADC_CHANNEL_11<<ADC_JSQR_JSQ4_Pos

          ,MC_ADC_CHANNEL_12<<ADC_JSQR_JSQ4_Pos

         },

 .ADCDataReg1 = { &ADC1->JDR1 /* Phase B, Phase C */

          ,&ADC1->JDR1 /* Phase A, Phase C */

          ,&ADC1->JDR1 /* Phase A, Phase C */

          ,&ADC1->JDR1 /* Phase A, Phase B */

          ,&ADC1->JDR1 /* Phase A, Phase B */

          ,&ADC1->JDR1 /* Phase B, Phase C */

         },

 .ADCDataReg2 = { &ADC2->JDR1 /* Phase B, Phase C */

          ,&ADC2->JDR1 /* Phase A, Phase C */

          ,&ADC2->JDR1 /* Phase A, Phase C */

          ,&ADC2->JDR1 /* Phase A, Phase B */

          ,&ADC2->JDR1 /* Phase A, Phase B */

          ,&ADC2->JDR1 /* Phase B, Phase C */

        },

why each channel is set in JSQ4? But in ADCx_Init(), the channels for phaseABC are set in JSQ234.

When read each phase ADC conversion result, why read JDR1? According to ADC init, should be JDR234.

0 REPLIES 0