Part Number: TMS320F28379D Tool/software: Hello, I am currently using the TMS32028379D for ADC sensing and encountering an issue. I am utilizing an ADC interrupt with a system clock frequency of 100 MHz, triggering an interrupt every 10 µs to perform sensing. The sensing circuit in my system is structured as follows: The input current flows through a sensing resistor, generating a sensing voltage. This voltage is fed into a current sensor. The sensor output is then connected to the ADC pin. The ADC is configured for differential measurement. However, I am experiencing an issue where the ADC register values exhibit sudden jumps at specific current levels. The table below shows the measured input current (from a power meter) and the corresponding ADC register values (checked via the Expressions window). In certain regions, the register values increase significantly, causing incorrect current measurements—either overestimated or underestimated. The system uses a parallel converter structure, meaning there are two different input current values. The highlighted values in the table represent the change in ADC register values per 1A of current change. Ideally, the register values should change consistently, but they do not. <-- ADC VOLTAGE I initially suspected noise, so I reinforced the RC filters in both the code and PCB design. Additionally, I measured the voltage at the ADC pin, but there was no significant noise. This suggests that the issue may not be due to external noise, and the code might not be functioning as expected. void main(void) { InitSysCtrl(); DELAY_US(1000000); InitGpio(); DINT; InitPieCtrl(); IER = 0x0000; IFR = 0x0000; InitPieVectTable(); EALLOW; PieVectTable.ADCA1_INT=&adcAISR; EDIS; setupGPIO(); setupEPWM1(); setupEPWM2(); setupEPWM3(); setupEPWM4(); setupEPWM7(); setupEPWM8(); setupEPWM9(); setupADC(); setupADCSOC(); InitCpuTimers(); ConfigCpuTimer(&CpuTimer0, 100, 10); // // Initialize results buffer // for(resultsIndex = 0; resultsIndex < RESULTS_BUFFER_SIZE; resultsIndex++) { AdcaResults[resultsIndex] = 0; } resultsIndex = 0; bufferFull = 0; CpuTimer0Regs.TCR.all = 0x4000; IER |= M_INT1; PieCtrlRegs.PIEIER1.bit.INTx1 = 1; EINT; ERTM; while(1) { } } __interrupt void adcAISR(void) { //LPF tau_output = R_out*C_out; //=RC Zo_1=Ts+2*tau_output; Zo_2=Ts-2*tau_output; float adc_vp_raw = (float)AdcbResultRegs.ADCRESULT1; float adc_vn_raw = (float)AdcbResultRegs.ADCRESULT0; output_voltage_adc_VP[0]=(Ts * (adc_vp_raw + output_voltage_adc_VP[1]) - Zo_2 * output_voltage_adc_VP[1]) / Zo_1; output_voltage_adc_VN[0]=(Ts * (adc_vn_raw + output_voltage_adc_VN[1]) - Zo_2 * output_voltage_adc_VN[1]) / Zo_1; output_voltage_adc_diff[0]= output_voltage_adc_VP[0]- output_voltage_adc_VN[0]; Vo_current[0]=output_voltage_adc_diff[0]*0.70297+27.917; output_voltage_adc_VP[1] = output_voltage_adc_VP[0]; output_voltage_adc_VN[1] = output_voltage_adc_VN[0]; output_voltage_adc_diff[1] = output_voltage_adc_diff[0]; output_current_adc_diff= abs(AdcaResultRegs.ADCRESULT0)-abs(AdcaResultRegs.ADCRESULT1); Io_current[0]= output_current_adc_diff*0.038527193+7.873772556; tau_INV = R_INV*C_INV; //=RC Zo_INV1=Ts+2*tau_INV; Zo_INV2=Ts-2*tau_INV; float adc_llc1p_raw = (float)AdcaResultRegs.ADCRESULT2; float adc_llc1n_raw = (float)AdcaResultRegs.ADCRESULT3; float adc_llc2p_raw = (float)AdcbResultRegs.ADCRESULT5; float adc_llc2n_raw = (float)AdcbResultRegs.ADCRESULT4; input_current1P_adc[0]=(Ts * (adc_llc1p_raw + input_current1P_adc[1]) - Zo_INV2 * input_current1P_adc[1]) / Zo_INV1; input_current1N_adc[0]=(Ts * (adc_llc1n_raw + input_current1N_adc[1]) - Zo_INV2 * input_current1N_adc[1]) / Zo_INV1; input_current2P_adc[0]=(Ts * (adc_llc2p_raw + input_current2P_adc[1]) - Zo_INV2 * input_current2P_adc[1]) / Zo_INV1; input_current2N_adc[0]=(Ts * (adc_llc2n_raw + input_current2N_adc[1]) - Zo_INV2 * input_current2N_adc[1]) / Zo_INV1; LLC1_current_ADC_diff[0]= input_current1P_adc[0]-input_current1N_adc[0]; LLC2_current_ADC_diff[0]= input_current2P_adc[0]-input_current2N_adc[0]; Iin1_current[0] = LLC1_current_ADC_diff[0]*0.05978-0.174; Iin2_current[0] = LLC2_current_ADC_diff[0]*0.05238-0.3121; tau_current = R_INV*C_INV; Zc_1=Ts+2*tau_current; Zc_2=Ts-2*tau_current; Iin1_current_avg[0]=(Ts*(Iin1_current[0]+Iin1_current[1])-Zc_2*Iin1_current_avg[1])/Zc_1; Iin2_current_avg[0]=(Ts*(Iin2_current[0]+Iin2_current[1])-Zc_2*Iin2_current_avg[1])/Zc_1; Ie[0] = beta*(Iin1_current_avg[0] - Iin2_current_avg[0]); input_current1P_adc[1] = input_current1P_adc[0]; input_current1N_adc[1] = input_current1N_adc[0]; input_current2P_adc[1] = input_current2P_adc[0]; input_current2N_adc[1] = input_current2N_adc[0]; LLC1_current_ADC_diff[1] = LLC1_current_ADC_diff[0]; LLC2_current_ADC_diff[1] = LLC2_current_ADC_diff[0]; Iin1_current[1] = Iin1_current[0]; Iin2_current[1] = Iin2_current[0]; Iin1_current_avg[1] = Iin1_current_avg[0]; Iin2_current_avg[1] = Iin2_current_avg[0]; LLC1_voltage_ADC_diff= abs(AdcaResultRegs.ADCRESULT4)-abs(AdcaResultRegs.ADCRESULT5); LLC2_voltage_ADC_diff= abs(AdcbResultRegs.ADCRESULT3)-abs(AdcbResultRegs.ADCRESULT2); Vin1_current[0] = (LLC1_voltage_ADC_diff)*0.28912828-2.991734287; Vin2_current[0] = (LLC2_voltage_ADC_diff)*0.28912828-2.991734287; } void setupADC(void) { //single ended AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE); AdcSetMode(ADC_ADCB, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE); EALLOW; //ADCA AdcaRegs.ADCCTL2.bit.PRESCALE = 1; AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1; AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1; //ADCB AdcbRegs.ADCCTL2.bit.PRESCALE = 1; AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1; AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1; EDIS; DELAY_US(1000); } void setupADCSOC(void) { EALLOW; //ADCA AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0; // SOC0(=ADCA0) AdcaRegs.ADCSOC0CTL.bit.ACQPS = 19; // Sample window is 10 SYSCLK cycles AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0 AdcaRegs.ADCSOC1CTL.bit.CHSEL = 1; // SOC1(=ADCA1) AdcaRegs.ADCSOC1CTL.bit.ACQPS = 19; // Sample window is 10 SYSCLK cycles AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0 // AdcaRegs.ADCSOC2CTL.bit.CHSEL = 2; // SOC2(=ADCA2) AdcaRegs.ADCSOC2CTL.bit.ACQPS = 19; // Sample window is 10 SYSCLK cycles AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0 AdcaRegs.ADCSOC3CTL.bit.CHSEL = 3; // SOC3(=ADCA3) AdcaRegs.ADCSOC3CTL.bit.ACQPS = 19; // Sample window is 10 SYSCLK cycles AdcaRegs.ADCSOC3CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0 AdcaRegs.ADCSOC4CTL.bit.CHSEL = 4; // SOC4(=ADCA4) AdcaRegs.ADCSOC4CTL.bit.ACQPS = 19; // Sample window is 10 SYSCLK cycles AdcaRegs.ADCSOC4CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0 AdcaRegs.ADCSOC5CTL.bit.CHSEL = 5; // SOC5(=ADCA5) AdcaRegs.ADCSOC5CTL.bit.ACQPS = 19; // Sample window is 10 SYSCLK cycles AdcaRegs.ADCSOC5CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0 AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 5; // End of SOC5 will set INT1 flag AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // Enable INT1 flag AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // Make sure INT1 flag is cleared //ADCB AdcbRegs.ADCSOC0CTL.bit.CHSEL = 0; // SOC0(=ADCB0) AdcbRegs.ADCSOC0CTL.bit.ACQPS = 19; // Sample window is 10 SYSCLK cycles AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0 AdcbRegs.ADCSOC1CTL.bit.CHSEL = 1; // SOC1(=ADCB1) AdcbRegs.ADCSOC1CTL.bit.ACQPS = 19; // Sample window is 10 SYSCLK cycles AdcbRegs.ADCSOC1CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0 AdcbRegs.ADCSOC2CTL.bit.CHSEL = 2; // SOC2(=ADCB2) AdcbRegs.ADCSOC2CTL.bit.ACQPS = 19; // Sample window is 10 SYSCLK cycles AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0 AdcbRegs.ADCSOC3CTL.bit.CHSEL = 3; // SOC3(=ADCB3) AdcbRegs.ADCSOC3CTL.bit.ACQPS = 19; // Sample window is 10 SYSCLK cycles AdcbRegs.ADCSOC3CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0 AdcbRegs.ADCSOC4CTL.bit.CHSEL = 4; // SOC4(=ADCB4) AdcbRegs.ADCSOC4CTL.bit.ACQPS = 19; // Sample window is 10 SYSCLK cycles AdcbRegs.ADCSOC4CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0 AdcbRegs.ADCSOC5CTL.bit.CHSEL = 5; // SOC5(=ADCB5) AdcbRegs.ADCSOC5CTL.bit.ACQPS = 19; // Sample window is 10 SYSCLK cycles AdcbRegs.ADCSOC5CTL.bit.TRIGSEL = 1; // Trigger on CPUTIMER0 AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 5; // End of SOC5 will set INT1 flag AdcbRegs.ADCINTSEL1N2.bit.INT1E = 1; // Enable INT1 flag AdcbRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // Make sure INT1 flag is cleared EDIS; } I would appreciate any insights on what might be causing this issue and how to resolve it. Thank you.
↧
Forum Post: TMS320F28379D: Issue with ADC Sensing on TMS32028379D – Unexpected Register Value Jumps
↧