The problem i met is about the bus voltage sense in the motor control application.I cannot get the correct voltage value after the analog-digital conversion for the voltage variable.I post the code refered as the following.
#define ADC_CMD_VDC CFPR_EOQ|CFPR_CAL|CFPR_RFIFO(0)|CFPR_CHANNEL(28)
EQADC_A.CFPR[0].R = CFPR_EOQ|CFPR_RFIFO(0)|CPFR_ADC_REG_VALUE(((T_U32)1<<15)|1)|CFPR_ADC_REG_CTRL;
eqADC_Set_Mode(&EQADC_A, 0, CFIFO_CONTINUOUS_SCAN_MODE | CFIFO_RISING_MODE,CFIFO_ETPUB28_TRIGGER);
EQADC_A.IDCR0.B.CFFE0 = 1;//Enable CFIFO Fill DMA or Interrupt request
EQADC_A.IDCR0.B.CFFS0 = 1;//Generate DMA request to move data from the system memory to CFIFOx
EQADC_A.IDCR0.B.CFFE1 = 1;//Enable CFIFO Fill DMA or Interrupt request.
EQADC_A.IDCR0.B.CFFS1 = 1;
adc->CFCR0.B.SSE0 = 1;
{ (T_U32) &ADC_CMD_T0[0], (T_U32) &EQADC_A.CFPR[0].R, DMA_SIZE_32BIT, 4, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0 }, /*Group 0*/
{ (T_U32) &EQADC_A.RFPR[0].R, (T_U32)0xC3FC9000, DMA_SIZE_32BIT, 4, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1 },
T_U32 *Vdcdebug = 0xC3FC9000;
*Vdc = ((*Vdcdebug)*0.07202f)*1.0f-19.8f ;
When i adjust the input voltage from 10v~60v,the digital value always floating change about 8200 other then following.Please see the pic 1 showing.I has checked the input voltage which goes into MCU is correct and it will follow the input high voltage.The register also been checked and the change trend and its value is consistent with the following picture showing.
What is more,the Vdc seems to be lagrely change when i turned the motor slowly by hand movement.The picture i got from the freemaster GUI like the attached picture 2 shows.
Totally,it seems that the Vdcdebug digital value did not follow the change of the input voltage.Who can tell me where is the key point i need to concern in the next step?Thanks!
Hello,
I have contact our system engineer, he will check your issue.
Best regards,
Peter
Thanks very much!