This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28069: Weird ADC error reading related to PWM5 initialization

Part Number: TMS320F28069

Dear Champs,

I am asking this for our customer.

The user is debugging codes and found something weird.

In their code, they have statements like below.

    EPwm5Regs.TBPRD = wTzRefPeriod;

    EPwm5Regs.CMPA.half.CMPA = 0;

    EPwm5Regs.TBPHS.all = 0;

    EPwm5Regs.TBCTR = 0;

 

    EPwm5Regs.TBCTL.bit.PRDLD = TB_SHADOW;

    EPwm5Regs.TBCTL.bit.CLKDIV = EPWM5_CLKDIV;

    EPwm5Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1;

    EPwm5Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_DISABLE;

    EPwm5Regs.TBCTL.bit.PHSEN = TB_DISABLE;

    EPwm5Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;

 

    EPwm5Regs.AQCTLA.bit.ZRO = AQ_SET;

    EPwm5Regs.AQCTLA.bit.CAU = AQ_CLEAR;

    EPwm5Regs.AQCSFRC.bit.CSFA = 0;

 

    EPwm5Regs.DBCTL.bit.OUT_MODE = DB_DISABLE

Note that 

They found ADC B0 to B3 would get large error in reading if "EPwm5Regs.AQCSFRC.bit.CSFA = 0;" was there. But if they commented this line "EPwm5Regs.AQCSFRC.bit.CSFA = 0;", then the ADC B0 to B3 reading became correct.

Note that even they disabled PWM5 by disabling its clock "SysCtrlRegs.PCLKCR1.bit.EPWM5ENCLK = 0", the issue was still there.

Also note that this only happened when the load was very high. That is, with light load, they did not observe this issue.

We believe this is related to noise, but we could not explain why this noise is related to this line "EPwm5Regs.AQCSFRC.bit.CSFA = 0;" 

Questions:

Do you have any comment or suggestion for us to debug this issue?

Does this PWM setting have anything to do with ADC reading? Like internal connection?

Wayne Huang

  • Wayne,

    I don't see a digital relationship between the CSFA bit versus the ADC conversions. Can you see what the value of the CSFA bit is when the line is included or removed in the program? The TRM says that the bit is 0 out of reset so I don't think that instruction is doing anything from a logic standpoint.

    The fact that this only happens when the load is high makes me think that there might be a layout sensitivity. I recommend looking into this possibility. Does a "high load" affect the device operating conditions? Is the ADC error consistent? Are the errors AC or DC in nature?

    -Tommy