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.

DRV8305: current offset compensation

Part Number: DRV8305


Hello,

In control-suite for HVPM-sensored-servo we can find the following code for current offset compensation:

interrupt void OffsetISR(void)
{
// Verifying the ISR
    IsrTicker++;
    
// DC offset measurement for ADC 

    if (IsrTicker>=5000)
    	{	
    		offsetA= _IQmpy(K1,offsetA)+_IQmpy(K2,_IQ12toIQ(AdcResult.ADCRESULT1)); 		        //Phase A offset
    		offsetB= _IQmpy(K1,offsetB)+_IQmpy(K2,_IQ12toIQ(AdcResult.ADCRESULT2));			//Phase B offset
    		offsetC= _IQmpy(K1,offsetC)+_IQmpy(K2,_IQ12toIQ(AdcResult.ADCRESULT3));			//Phase C offset
    	}

	if (IsrTicker > 20000)
	{
		EALLOW;
		PieVectTable.ADCINT1=&MainISR;		
		EDIS;
	}
    
// Enable more interrupts from this timer
	AdcRegs.ADCINTFLG.bit.ADCINT1=1;
	
// Acknowledge interrupt to recieve more interrupts from PIE group 1
	PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;

}

I have some question about this code:

1-)Why does it wait for 5000 cycles before starting current offset compensation?

2-)Why does it last for 15000 cycles after it enter in compensation loop?

3-)What are the K1 and K2 and What is the offset calculation formula?

4-)and what is the problem of just using one sample (first sample) for current offset compensation?

Regards,

Mohammad.