Part Number: TMS320F280037C
Other Parts Discussed in Thread: C2000WARE
Hello,
I have some custom hardware being controlled by a F280037C using the Universal Motor Control lab.
Currently, the code gets to the following loop:
// write the PWM compare values
HAL_writePWMData(obj->halMtrHandle, &obj->pwmData);
// enable the PWM
HAL_enablePWM(obj->halMtrHandle);
for(offsetCnt = 0; offsetCnt < 32000; offsetCnt++)
{
// clear the ADC interrupt flag
ADC_clearInterruptStatus(MTR1_ADC_INT_BASE, MTR1_ADC_INT_NUM);
while(ADC_getInterruptStatus(MTR1_ADC_INT_BASE, MTR1_ADC_INT_NUM) == false);
HAL_readMtr1ADCData(&obj->adcData);
if(offsetCnt >= 2000) // Ignore the first 2000 times
{
// Offsets in phase current sensing
where it is forever stuck waiting for an ADC callback:
static inline bool
ADC_getInterruptStatus(uint32_t base, ADC_IntNumber adcIntNum)
{
//
// Check the arguments.
//
ASSERT(ADC_isBaseValid(base));
//
// Get the specified ADC interrupt status.
//
return((HWREGH(base + ADC_O_INTFLG) & (1U << (uint16_t)adcIntNum)) != 0U);
}
The PWM is supposed to trigger the SOC to take a reading, and the ADC should raise this interrupt, incrementing 'offsetCnt'.
However, 'offsetCnt' never increments.
I am fairly certain I have correctly modified the lab to allow my hardware to function, but here I am.
I can force an ADC callback by setting 'AdcbRegs.ADCSOCFRC1.SOC3' to 1, forcing one of the ADC's to take a reading. 'offsetCnt' increments by 1 when I do this.
Here are the EPWM registers during this loop:
EPwm4Regs.TBPRD Register 0x0FA0 EPwm4Regs.TZFLG Register 0x0006 EPwm2Regs.TZFLG Register 0x0006 EPwm3Regs.TZFLG Register 0x0006
Any tips on where I should be looking? I am pouring over the 'Building Custom Board' section of the 'Motor Control SDK Universal Project and Lab' right now.
I feel like I almost have this working...



