2022-11-16 05:25 PM
I am a newer leraning motor FOC control. I study the generated code by MCSDK tool with hall (120 degree). Below is some question:
.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.