TI中文支持网
TI专业的中文技术问题搜集分享网站

请教TI工程师28069F芯片AD的问题

我使用的28068FFPT芯片,自己做的硬件,运行SPIN_FOC例程lab10c的程序,发现AD运行一次三相电流电压就不更新了,dcBus的值时有时无(如下图),中断运行都正常,请问这是什么原因。

Eason Wang:

Move to C2000 forum

我使用的28068FFPT芯片,自己做的硬件,运行SPIN_FOC例程lab10c的程序,发现AD运行一次三相电流电压就不更新了,dcBus的值时有时无(如下图),中断运行都正常,请问这是什么原因。

Martin Yu:

Jianwei,

你自己做的板子,AD通道是否改了?需要在AD初始化中相应更改通道。

我使用的28068FFPT芯片,自己做的硬件,运行SPIN_FOC例程lab10c的程序,发现AD运行一次三相电流电压就不更新了,dcBus的值时有时无(如下图),中断运行都正常,请问这是什么原因。

Xiong JIANWEI:

回复 Martin Yu:

AD通道都改过了,显示好像第一次转换了,然后就不再转换更新

我使用的28068FFPT芯片,自己做的硬件,运行SPIN_FOC例程lab10c的程序,发现AD运行一次三相电流电压就不更新了,dcBus的值时有时无(如下图),中断运行都正常,请问这是什么原因。

Xiong JIANWEI:

回复 Xiong JIANWEI:

跟编译器的版本有关系吗,编译时有个警示需要6.2.3的版本,我用的CCS5.5,编译器是6.2.0的

还有就是gMotorVars.Flag_enableSys标志不使能的情况下,AD是否持续转换?

我使用的28068FFPT芯片,自己做的硬件,运行SPIN_FOC例程lab10c的程序,发现AD运行一次三相电流电压就不更新了,dcBus的值时有时无(如下图),中断运行都正常,请问这是什么原因。

Xiong JIANWEI:

回复 Martin Yu:

你好Martin Yu

今天又调试了一下,上面显示的AD值不是实际转换的值,是I_bias校正偏移的值(附图),这就是说程序里AD转换并没有启动,请问应该是哪儿的问题

而且用示波器看到有PWM输出,但也是个固定值,没有持续更新。

我使用的28068FFPT芯片,自己做的硬件,运行SPIN_FOC例程lab10c的程序,发现AD运行一次三相电流电压就不更新了,dcBus的值时有时无(如下图),中断运行都正常,请问这是什么原因。

Martin Yu:

回复 Xiong JIANWEI:

建议检查下你的ADC中断的触发源是否有相应改变:

 // configure the interrupt sources  ADC_disableInt(obj->adcHandle,ADC_IntNumber_1);  ADC_setIntMode(obj->adcHandle,ADC_IntNumber_1,ADC_IntMode_ClearFlag);  ADC_setIntSrc(obj->adcHandle,ADC_IntNumber_1,ADC_IntSrc_EOC7);

我使用的28068FFPT芯片,自己做的硬件,运行SPIN_FOC例程lab10c的程序,发现AD运行一次三相电流电压就不更新了,dcBus的值时有时无(如下图),中断运行都正常,请问这是什么原因。

Martin Yu:

回复 Xiong JIANWEI:

Jianwei,

你用哪个lab程序试的?建议用lab3a不带电机,先试下offset计算,一般电流的三个值一样,在0.9~1.05左右,电压三个值一样,220V输入则为0.38左右,则证明是正常的;按照你的截图,说明ADC采样不对,具体是软件还是硬件,需要排查,先检查ADC和PWM的初始化程序和user.h的设置。

你是哪的客户?可以联系当地的代理商或TI的FAE帮忙。

 

我使用的28068FFPT芯片,自己做的硬件,运行SPIN_FOC例程lab10c的程序,发现AD运行一次三相电流电压就不更新了,dcBus的值时有时无(如下图),中断运行都正常,请问这是什么原因。

Xiong JIANWEI:

回复 Martin Yu:

Martin Yu ,非常感谢你的解答

我用的是lab10C程序,硬件是按照TI文档介绍的,进AD的信号都对,软件里面AD和PWM初始化都没有动,只改了相应的IO口和AD通道,

按你说的我用lab3a调试了一下,电流电压AD转换还是没有值,只显示减去偏移后的值,但和用运行的值不一样,电流和电压的偏移都一至。

只有dcBus的值在变,从寄存器中也只看到通道7的值在变,但和实际值相差很远,应该也不是真实值。见下图

我使用的28068FFPT芯片,自己做的硬件,运行SPIN_FOC例程lab10c的程序,发现AD运行一次三相电流电压就不更新了,dcBus的值时有时无(如下图),中断运行都正常,请问这是什么原因。

Martin Yu:

回复 Xiong JIANWEI:

Jianwei,

lab3a跑出来的值不对的,应该还是ADC和PWM的配置方面。你把这部分的原理图截图和配置代码发上来看看。你是哪里的,最好联系支持贵司的代理商的FAE现场帮你看看,这样效率高些。

我使用的28068FFPT芯片,自己做的硬件,运行SPIN_FOC例程lab10c的程序,发现AD运行一次三相电流电压就不更新了,dcBus的值时有时无(如下图),中断运行都正常,请问这是什么原因。

Xiong JIANWEI:

回复 Martin Yu:

Martin Yu 你好,

我的电压采样对技术文档差不多,电阻降压后经过运放,850V输出3.3V,正常输入是380V。母线就是540V。测量板子上母线电压输入到芯片引脚是1.805V

三相输出电压到芯片引脚是0V,电流采样用的霍尔传感器正负4V出0-3.3V。现在无电流时进芯片是1.65V。ADC和PWM改动较少,主要是通道,寄存器配置没怎么动。修改了几个地方做有注示,用lab03试验时PWM波形很正常,会连续变动,主要还是看不到AD转的值。

void HAL_setupAdcs(HAL_Handle handle){  HAL_Obj *obj = (HAL_Obj *)handle;

  // disable the ADCs  ADC_disable(obj->adcHandle);

  // power up the bandgap circuit  ADC_enableBandGap(obj->adcHandle);

  // set the ADC voltage reference source to internal   ADC_setVoltRefSrc(obj->adcHandle,ADC_VoltageRefSrc_Int);

  // enable the ADC reference buffers  ADC_enableRefBuffers(obj->adcHandle);

  // Set main clock scaling factor (max45MHz clock for the ADC module)  ADC_setDivideSelect(obj->adcHandle,ADC_DivideSelect_ClkIn_by_2);

  // power up the ADCs  ADC_powerUp(obj->adcHandle);

  // enable the ADCs  ADC_enable(obj->adcHandle);

  // set the ADC interrupt pulse generation to prior  ADC_setIntPulseGenMode(obj->adcHandle,ADC_IntPulseGenMode_Prior);

  // set the temperature sensor source to external  ADC_setTempSensorSrc(obj->adcHandle,ADC_TempSensorSrc_Ext);

  // configure the interrupt sources  ADC_disableInt(obj->adcHandle,ADC_IntNumber_1);  ADC_setIntMode(obj->adcHandle,ADC_IntNumber_1,ADC_IntMode_ClearFlag);  ADC_setIntSrc(obj->adcHandle,ADC_IntNumber_1,ADC_IntSrc_EOC7);

  //configure the SOCs for hvkit_rev1p1  // EXT IA-FB  //ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_0,ADC_SocChanNumber_A1);  ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_0,ADC_SocChanNumber_A0);  //changed by xjw  ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_0,ADC_SocTrigSrc_EPWM1_ADCSOCA);  ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_0,ADC_SocSampleDelay_9_cycles);

  // EXT IA-FB  // Duplicate conversion due to ADC Initial Conversion bug (SPRZ342)  //ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_1,ADC_SocChanNumber_A1);  ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_1,ADC_SocChanNumber_A0);  //changed by xjw IA=ADCA0  ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_1,ADC_SocTrigSrc_EPWM1_ADCSOCA);  ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_1,ADC_SocSampleDelay_9_cycles);

  // EXT IB-FB  //ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_2,ADC_SocChanNumber_B1);  ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_2,ADC_SocChanNumber_A1);  //changed by xjw IB=ADCA1  ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_2,ADC_SocTrigSrc_EPWM1_ADCSOCA);  ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_2,ADC_SocSampleDelay_9_cycles);

  // EXT IC-FB  //ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_3,ADC_SocChanNumber_A3);  ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_3,ADC_SocChanNumber_A2);  //changed by xjw IC=ADCA2  ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_3,ADC_SocTrigSrc_EPWM1_ADCSOCA);  ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_3,ADC_SocSampleDelay_9_cycles);

  // ADC-Vhb1  //ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_4,ADC_SocChanNumber_B7);  ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_4,ADC_SocChanNumber_A4);  //changed by xjw UA=ADCA4  ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_4,ADC_SocTrigSrc_EPWM1_ADCSOCA);  ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_4,ADC_SocSampleDelay_9_cycles);

  // ADC-Vhb2  //ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_5,ADC_SocChanNumber_B6);  ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_5,ADC_SocChanNumber_A5);  //changed by xjw UB=ADCA5  ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_5,ADC_SocTrigSrc_EPWM1_ADCSOCA);  ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_5,ADC_SocSampleDelay_9_cycles);

  // ADC-Vhb3  //ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_6,ADC_SocChanNumber_B4);  ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_6,ADC_SocChanNumber_A6);  //changed by xjw UC=ADCA6  ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_6,ADC_SocTrigSrc_EPWM1_ADCSOCA);  ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_6,ADC_SocSampleDelay_9_cycles);

  // VDCBUS  //ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_7,ADC_SocChanNumber_A7);  ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_7,ADC_SocChanNumber_A3);  //changed by xjw UDCBUS=ADCA3  ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_7,ADC_SocTrigSrc_EPWM1_ADCSOCA);  ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_7,ADC_SocSampleDelay_9_cycles);

  return;} // end of HAL_setupAdcs() function

 

void HAL_setupPwms(HAL_Handle handle,                   const uint_least16_t systemFreq_MHz,                   const float_t pwmPeriod_usec,                   const uint_least16_t numPwmTicksPerIsrTick){  HAL_Obj   *obj = (HAL_Obj *)handle;  uint16_t   halfPeriod_cycles = (uint16_t)((float_t)systemFreq_MHz*pwmPeriod_usec) >> 1;  uint_least8_t    cnt;

  // turns off the outputs of the EPWM peripherals which will put the power switches  // into a high impedance state.  PWM_setOneShotTrip(obj->pwmHandle[PWM_Number_1]);  PWM_setOneShotTrip(obj->pwmHandle[PWM_Number_2]);  PWM_setOneShotTrip(obj->pwmHandle[PWM_Number_3]);

  for(cnt=0;cnt<3;cnt++)    {      // setup the Time-Base Control Register (TBCTL)      PWM_setCounterMode(obj->pwmHandle[cnt],PWM_CounterMode_UpDown);      PWM_disableCounterLoad(obj->pwmHandle[cnt]);      PWM_setPeriodLoad(obj->pwmHandle[cnt],PWM_PeriodLoad_Immediate);      PWM_setSyncMode(obj->pwmHandle[cnt],PWM_SyncMode_EPWMxSYNC);      PWM_setHighSpeedClkDiv(obj->pwmHandle[cnt],PWM_HspClkDiv_by_1);      PWM_setClkDiv(obj->pwmHandle[cnt],PWM_ClkDiv_by_1);      PWM_setPhaseDir(obj->pwmHandle[cnt],PWM_PhaseDir_CountUp);      PWM_setRunMode(obj->pwmHandle[cnt],PWM_RunMode_FreeRun);

      // setup the Timer-Based Phase Register (TBPHS)      PWM_setPhase(obj->pwmHandle[cnt],0);

      // setup the Time-Base Counter Register (TBCTR)      PWM_setCount(obj->pwmHandle[cnt],0);

      // setup the Time-Base Period Register (TBPRD)      // set to zero initially      PWM_setPeriod(obj->pwmHandle[cnt],0);

      // setup the Counter-Compare Control Register (CMPCTL)      PWM_setLoadMode_CmpA(obj->pwmHandle[cnt],PWM_LoadMode_Zero);      PWM_setLoadMode_CmpB(obj->pwmHandle[cnt],PWM_LoadMode_Zero);      PWM_setShadowMode_CmpA(obj->pwmHandle[cnt],PWM_ShadowMode_Shadow);      PWM_setShadowMode_CmpB(obj->pwmHandle[cnt],PWM_ShadowMode_Immediate);

      // setup the Action-Qualifier Output A Register (AQCTLA)       PWM_setActionQual_CntUp_CmpA_PwmA(obj->pwmHandle[cnt],PWM_ActionQual_Set);      PWM_setActionQual_CntDown_CmpA_PwmA(obj->pwmHandle[cnt],PWM_ActionQual_Clear);

      // setup the Dead-Band Generator Control Register (DBCTL)      PWM_setDeadBandOutputMode(obj->pwmHandle[cnt],PWM_DeadBandOutputMode_EPWMxA_Rising_EPWMxB_Falling);//      PWM_setDeadBandPolarity(obj->pwmHandle[cnt],PWM_DeadBandPolarity_EPWMxB_Inverted);      PWM_setDeadBandPolarity(obj->pwmHandle[cnt],PWM_DeadBandPolarity_EPWMxA_Inverted); //changed by xjw

      // setup the Dead-Band Rising Edge Delay Register (DBRED)      PWM_setDeadBandRisingEdgeDelay(obj->pwmHandle[cnt],HAL_PWM_DBRED_CNT);

      // setup the Dead-Band Falling Edge Delay Register (DBFED)      PWM_setDeadBandFallingEdgeDelay(obj->pwmHandle[cnt],HAL_PWM_DBFED_CNT);      // setup the PWM-Chopper Control Register (PCCTL)      PWM_disableChopping(obj->pwmHandle[cnt]);

      // setup the Trip Zone Select Register (TZSEL)      PWM_disableTripZones(obj->pwmHandle[cnt]);    }

  // setup the Event Trigger Selection Register (ETSEL)  PWM_disableInt(obj->pwmHandle[PWM_Number_1]);  PWM_setSocAPulseSrc(obj->pwmHandle[PWM_Number_1],PWM_SocPulseSrc_CounterEqualZero);  PWM_enableSocAPulse(obj->pwmHandle[PWM_Number_1]); 

  // setup the Event Trigger Prescale Register (ETPS)  if(numPwmTicksPerIsrTick == 3)    {      PWM_setIntPeriod(obj->pwmHandle[PWM_Number_1],PWM_IntPeriod_ThirdEvent);      PWM_setSocAPeriod(obj->pwmHandle[PWM_Number_1],PWM_SocPeriod_ThirdEvent);    }  else if(numPwmTicksPerIsrTick == 2)    {      PWM_setIntPeriod(obj->pwmHandle[PWM_Number_1],PWM_IntPeriod_SecondEvent);      PWM_setSocAPeriod(obj->pwmHandle[PWM_Number_1],PWM_SocPeriod_SecondEvent);    }  else    {      PWM_setIntPeriod(obj->pwmHandle[PWM_Number_1],PWM_IntPeriod_FirstEvent);      PWM_setSocAPeriod(obj->pwmHandle[PWM_Number_1],PWM_SocPeriod_FirstEvent);    }

  // setup the Event Trigger Clear Register (ETCLR)  PWM_clearIntFlag(obj->pwmHandle[PWM_Number_1]);  PWM_clearSocAFlag(obj->pwmHandle[PWM_Number_1]);

  // first step to synchronize the pwms  CLK_disableTbClockSync(obj->clkHandle);

  // since the PWM is configured as an up/down counter, the period register is set to one-half   // of the desired PWM period  PWM_setPeriod(obj->pwmHandle[PWM_Number_1],halfPeriod_cycles);  PWM_setPeriod(obj->pwmHandle[PWM_Number_2],halfPeriod_cycles);  PWM_setPeriod(obj->pwmHandle[PWM_Number_3],halfPeriod_cycles);

  // last step to synchronize the pwms  CLK_enableTbClockSync(obj->clkHandle);

  return;}  // end of HAL_setupPwms() function

赞(0)
未经允许不得转载:TI中文支持网 » 请教TI工程师28069F芯片AD的问题
分享到: 更多 (0)