Other Parts Discussed in Thread: DRV8837, CONTROLSUITE
Hello,
I use epwm1 to feed a DRV8837 (based on 2xDC motor example).
I use ADCs to sense motor current and 3 other signals.
ADC is sync on epwm1 to catch motor current.
It used to work fine for months but since the last update of my firmware I got a strange behaviour...
I don't think my changes are the real cause of this trouble see below
Initial code:
// Compute filtered value of initial guide sensor position for(j = SIGNAL_LENGTH; j > 0; j--) { iirHall.input = AdcResult.ADCRESULT1 << 3; // SOC1, IQ12 to 15 iirHall.calc(&iirHall); DELAY_US(40); } // Compute filtered value of initial paddle value for(j = SIGNAL_LENGTH; j > 0; j--) { iirClick.input = (AdcResult.ADCRESULT3 - AdcResult.ADCRESULT2) << 3; // SOC3 - SOC2, IQ12 to 15 iirClick.calc(&iirClick); DELAY_US(40); }
Changes:
// Compute filtered value for(j = SIGNAL_LENGTH; j > 0; j--) { // Initial guide sensor position iirHall.input = AdcResult.ADCRESULT1 << 3; // SOC1, IQ12 to 15 iirHall.calc(&iirHall); // Initial paddle value iirClick.input = (AdcResult.ADCRESULT3 - AdcResult.ADCRESULT2) << 3; // SOC3 - SOC2, IQ12 to 15 iirClick.calc(&iirClick); DELAY_US(40); }
In some unknown conditions, the ADCs do not start conversions (stays at offset value 80 after AdcOffsetSelfCal) or start later.
The TBCLKSYNC is enabled but the TBCTR is not always counting when starting from reset.
The following code make the issue even more frequent (not the case if TBCLKSYNC is enabled from DeviceInit() and no more changed)
// Self calibration on internal ref AdcInit(); // Enable 5V // Note: external 3.3V ref needs 2ms settling time GpioDataRegs.GPASET.bit.GPIO10 = 1; DELAY_US(2000.0L); // Initialize PWM module pwm1.PeriodMax = PWM_PRD_MAX; EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0; EDIS; PWM_INIT_MACRO(pwm1) EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1; EDIS; // Initialize ADC module ADC_MACRO_INIT()
The ADC conversions run well after a CCS restart in debug mode but neither after a reset.
On "release" run, the TMS320 is held around 800ms in reset by a MSP430 through XRS before starting.
If the MSP430 is reset, the TMS320 is reset again by the MSP430.
I guess this behaviour has been around since a while as the change seems so insignificant but now the TMS320 fail to start conversion frequently after reset.
Any idea on what may set the Timer Base module in trouble ?
Is there any other recommendation in order setting of ADC calibration, ePWM1 and ADCs soc ?
Is there any recommendation in case of using external ref for ADC after self calibration with internal bandgap ?
Config: CCS9.3 and ti-cgt-c2000_18.12.7.LTS
Thank you