Hello,
I have a dual motor project (based on lab 12c) running on a LAUNCHXL-F28069M with two DRV8305 boards.
Now I and want to connect two potentiometers and read their values (e.g. to set SpeedRef).
I already found the HAL tutorial shipped with MotorWare and, based on it, got one potentiometer working (connected to ADCINA6). I added the following code to HAL_setupAdcs() in hal_2mtr.c:
// Potentiometer ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_15,ADC_SocChanNumber_A6); ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_15, ADC_Int1TriggersSOC); ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_15,ADC_SocSampleDelay_9_cycles);
And the following to hal_2mtr.h:
static inline _iq HAL_readPotentiometerData(HAL_Handle handle) { HAL_Obj *obj = (HAL_Obj *)handle; _iq value; // convert potentiometer from IQ12 to IQ24. value = _IQ12toIQ((_iq)ADC_readResult(obj->adcHandle, ADC_ResultNumber_15)); return(value); }
Now I want to add the second potentiometer which is connected to ADCINB6. First I thought, that I could simply duplicate the code and change the numbers but then I realized, that there are no Soc/Result numbers left. They are all in use because due to the "Initial Conversion Bug", ADCINA0 is read two times, using ADC_SocNumber_0 and _1.
Is there another possible workaround to avoid the bad initial conversion which allows me to use all 16 ADCs? Or maybe another way of reading the potentiometer results (these values are not timing critical, so in case this makes things easier, it would be okay if conversion for them is done at a slower rate).
Best, Felix