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.

DRV8302-HC-C2-KIT: TMS320F28035 - ADC reading problem

Part Number: DRV8302-HC-C2-KIT

Hi every one,

I have been working on DRV8302-HC-C2-KIT with ti\controlSUITE\development_kits\DRV830x-HC-C2-KIT_v105\InstaSPIN_BLDC project. My main goal is sensorless trapezoidal control of BLDC motor. 

Although it is working fine with example code, I failed when I tried to get meaningful values from ADC channel, i mean DC bus current.

In this project, DC bus current is reading through ADC-A2 as can be seen below.

and also I initialized ADC with example code, ADC_MACRO_INIT() as follows. 

#define ADC_MACRO_INIT()																				\
																								\
 DELAY_US(ADC_usDELAY);																			\
    AdcRegs.ADCCTL1.all=ADC_RESET_FLAG;															\
	asm(" NOP ");																				\
	asm(" NOP ");    																			\
																								\
	EALLOW;																						\
	 AdcRegs.ADCCTL1.bit.ADCBGPWD	= 1;	/* Power up band gap */								\
																								\
	DELAY_US(ADC_usDELAY);					/* Delay before powering up rest of ADC */			\
																								\
	AdcRegs.ADCCTL1.bit.ADCREFSEL	= 0;														\
   	AdcRegs.ADCCTL1.bit.ADCREFPWD	= 1;	/* Power up reference */							\
   	AdcRegs.ADCCTL1.bit.ADCPWDN 	= 1;	/* Power up rest of ADC */							\
	AdcRegs.ADCCTL1.bit.ADCENABLE	= 1;	/* Enable ADC */									\
																								\
	asm(" RPT#100 || NOP");																		\
																								\
	AdcRegs.ADCCTL1.bit.INTPULSEPOS=1;															\
	AdcRegs.ADCCTL1.bit.TEMPCONV=0;																\
																								\
	DELAY_US(ADC_usDELAY);																		\
																								\
	/******* CHANNEL SELECT *******/															\
																								\
																								\
	AdcRegs.ADCSOC0CTL.bit.CHSEL 	= 15;	/*Dummy meas. avoid 1st sample issue Rev0 Picollo*/	\
	AdcRegs.ADCSOC0CTL.bit.TRIGSEL  = 5;														\
	AdcRegs.ADCSOC0CTL.bit.ACQPS 	= 6;														\
																								\
	AdcRegs.ADCSOC1CTL.bit.CHSEL 	= 15; 	/* ChSelect: ADC B7-> V Phase A */					\
	AdcRegs.ADCSOC1CTL.bit.TRIGSEL 	= 5;	/* Set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1*/	\
	AdcRegs.ADCSOC1CTL.bit.ACQPS 	= 6;	/* Set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)*/						\
																								\
	AdcRegs.ADCSOC2CTL.bit.CHSEL 	= 7;	/* ChSelect: ADC A7-> V Phase B */					\
	AdcRegs.ADCSOC2CTL.bit.TRIGSEL  = 5;														\
	AdcRegs.ADCSOC2CTL.bit.ACQPS 	= 6;														\
																								\
	AdcRegs.ADCSOC3CTL.bit.CHSEL 	= 12;	/* ChSelect: ADC B4-> V Phase C */ 					\
	AdcRegs.ADCSOC3CTL.bit.TRIGSEL  = 5;														\
	AdcRegs.ADCSOC3CTL.bit.ACQPS 	= 6;														\
																								\
	AdcRegs.ADCSOC4CTL.bit.CHSEL 	= 2;	/* ChSelect: ADC A2-> Low Side DC Bus Return Cur.*/	\
	AdcRegs.ADCSOC4CTL.bit.TRIGSEL 	= 6;														\
	AdcRegs.ADCSOC4CTL.bit.ACQPS 	= 6;	/* 6 idi    */									 	\
																								\
	AdcRegs.INTSEL1N2.bit.INT1E     = 1;	/* Enabled ADCINT1 */								\
	AdcRegs.INTSEL1N2.bit.INT1CONT  = 0;	/* Disable ADCINT1 Continuous mode */				\
	AdcRegs.INTSEL1N2.bit.INT1SEL	= 4;	/* Setup EOC4 to trigger ADCINT1 to fire */			\
																								\
	EDIS;																						\
																								\
    /* Set up Event Trigger with CNT_zero enable for Time-base of EPWM1 */						\
    EPwm1Regs.ETSEL.bit.SOCAEN = 1;     /* Enable SOCA */										\
    EPwm1Regs.ETSEL.bit.SOCASEL = 2;    /* Enable TBCNTR = PRD event for SOCA */				\
    EPwm1Regs.ETPS.bit.SOCAPRD = 1;     /* Generate SOCA on the 1st event */					\
	EPwm1Regs.ETCLR.bit.SOCA = 1;       /* Clear SOCA flag */									\
																								\
	/* Set up and SOCB pulse for current sampling*/												\
    EPwm1Regs.ETSEL.bit.SOCBEN = 1;     /* Enable SOCB */										\
    EPwm1Regs.ETSEL.bit.SOCBSEL = 6;    /* Enable TBCNTR = CMPB incrementing event for SOCB */	\
    EPwm1Regs.ETPS.bit.SOCBPRD = 1;     /* Generate SOCB on the 1st event */					\
	EPwm1Regs.ETCLR.bit.SOCB = 1;       /* Clear SOCB flag */

#endif // __F2803XIDC_VEMF_H__

However, I couldn't see any meaningful relation in ADC results. 

Also, I measured the bus current on TP23 (can be seen above), and got some linear relation between measured voltages with bus currents. 

I tabulated the measurement results as follows:

ADC Value Bus current
2060 0.1
2060 0.1
2061 0.1
2060 0.13
2060 0.16
2060 0.18
2060 0.22
1855 0.26
1811 0.31
1850 0.36
1915 0.43
1963 0.49
1980 0.56
1975 0.64
1931 1.11
1900 1.65
1870 2.34

Bus current Measured voltage from TP23
0.1 1.65
0.31 1.647
1.15 1.632
2.45 1.605

I have got some improvements with different ACQPS values but still didn't get meaningful relation between ADC input and register values. 

Any suggestions will be appreciated, thanks for your time.

Best regards,

Yasin

  • The measured currents are correct, the feedback voltage on ADC pin is closed to 1.65V if the low side bus current equal to zero, and the equation is

    I_bus = (1.65 - Vin) * Gain as the code in reference.

    IDCfdbk=-((_IQ15toIQ(AdcResult.ADCRESULT4<<3)-IDC_offset)<<1);

  • Hey Luo,

    I am afraid you didn't notice the nonsense of the ADC values. I am rewriting some values from the table I gave above.

    2060 -> 0.10A

    1850 -> 0.36A

    1980 -> 0.56A

    1870 -> 2.34A

    So, please fit these values in your equation and then I hope you will understand me.

  • Hello,

    I have still same problem. To be clear, I am rewriting again my problem:

    Bus current Measured voltage from TP23 using multimeter

    ADC Register Result

    0.1 1.65 2060
    0.31 1.647 1811
    1.15 1.632 ~ 1930
    2.45 1.605 ~ 1870

    As can be seen from table, I got some awkward results such as 1811 for 0,31A and 1930 for 1,15A. I was expected something like ~ 1850 for 1.15 due to other results (0.31 and 2.45).

    Is there any suggestions or someone has familiar problems?

    Thank you for your time.

  • Hello Luo;

    The same problem exists in my project. There is no problem when I read the voltage values from the TP23 connector. However, when I look at the ADC measurement of the process, I see a non-lineer result. There is a 12-bit ADC cycle.

    My ADC value;
    2060 -> 0.10A
    
    1850 -> 0.36A
    
    1980 -> 0.56A
    
    1870 -> 2.34A
    How do I evaluate the ADC result in terms of current results? There seems to be a problem.

    Sincelery


  • How did you get these current values? Are they from the DC power supply? You can't use a multimeter to measure the voltage on TP23 directly. Please use an oscilloscope to monitor the voltage on TP23, and use a current probe to measure the current on low side DC-bus. You may find both voltage and current waveform are not continuous signals.

    The ADC configuration is right in this project and the current sample works well, you may follow the guide to try the reference step by step. Btw, we don't recommend to use the current loop on this kit for InsraSPIN-BLDC, you may refer to DRV8312-kit to sample the dc-bus current if you want to implement the current close loop.

  • 1- We read the current values via DC power supply.

    2- We only read the voltage output from TP23.

    3- We measured the TP23 output directly with the multimeter.

    The ADC results are directly the value of the ADC register. In addition, we achieved these results with the same reference design. I'm going to take the measurements you said with the oscilloscope and share the results again.

    Sincelery

  • Good, please go ahead. Let's know if you have any further questions. We'd like to close this thread first. Thanks!