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.

AD for speed setting

Other Parts Discussed in Thread: MOTORWARE

I am trying to use Analog input A4 for speed setting in my motor control project for f28054 based board.
Based on motorware_hal_tutorial.pdf, page 20, 21, I added following code in my Hal.c file.

ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_8,ADC_SocChanNumber_A4);
ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_8,ADC_Int1TriggersSOC);
ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_8,ADC_SocSampleDelay_9_cycles);

However, I am not getting changing value in ADRESULT register for CH8 (A4) when I very POT.
Also, I am getting following warning for middle line,

#190-D enumerated type mixed with another type hal.c /proj_lab03b line 891 C/C++ Problem

which makes me suspect that there is some error here and probably triggering pwm and ADC need different handling.
Since, A4 is not affected by AFE settings, I presume, that the code should work without any issue.

Can anybody throw some light on this?

  • did you make the other changes in hal.h and proj_lab##.c (pages 21-22)?
    what values are you getting for gPotentiometer?
  • Chris,
    As I can see, page 20,21 mention adding ADC8 channel with trigger source as ADCINT1,
    Then it mentions adding function
    static inline _iq HAL_readPotentiometerData(HAL_Handle handle) in hal.hal
    And finally adding variable
    gPotentiometer in projxlabxx.c file to read ADC value.
    I have done all that. Besides, I am observing ADCRESULT(8) in register watch window & see only decimal 68.
    Even if I change POT value, this value remains unaffected. After this for testing purpose, I changed trigger
    to EPWM1 like other channels and it worked (AD changed as desired with POT variation).
    Finally in ADCSOCxCTL register, as per spruhe5b meant for f2805x processor, for ADCSOCxCTL register, TRIGSEL bits do not contain
    option for triggering with ADCINT1 & one needs to use ADCINTSOCSEL1 register. Hence, I suspect that I need to do more than what manual suggests.
    Pl. throw some light on this.
  • I managed to trap problem. It was basically related to difference in function names
    ADC_setupSocTrigSrc()
    ADC_setSocTrigSrc()
    the top one is required for ADCINT1
  • good catch!
    yes, that's actually quite strange to me that there are two different versions...I'm going to tag that for our SW team to see if it's something we want to fix going forward