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.

LAUNCHXL-F280049C: simple potentiometer throttle with lab06 - torque control.

Part Number: LAUNCHXL-F280049C
Other Parts Discussed in Thread: TMDSHVMTRINSPIN, CONTROLSUITE,

Hi all, Smile

I can see in this lab in file "hal_data.h" there is a Throttle value. but it is unused or not connected. what is this for?

i would like to connect a potentiometer to an analog input and use it as a throttle to control the "IdqSet_A.value[1]" value so i will have basic torque control for demonstrating this board to my company. can you please give me some example code to do this?

many thanks!

shany

  • You might find the "throttle" is used in the example lab and is linked to ADCINB3.

    1. Connect the potentiometer to an ADC input pin on the kit.

    2. Configure the ADC in HAL_setupADCs() in hal.c as below

    // Vthrottle - B3->RB3. hvkit board has capacitor on Vbus feedback, so
    // the sampling doesn't need to be very long to get an accurate value
    ADC_setupSOC(obj->adcHandle[1], ADC_SOC_NUMBER3, ADC_TRIGGER_EPWM6_SOCA,
    ADC_CH_ADCIN3, HAL_ADC_SAMPLE_WINDOW);

    3. Read ADC result in HAL_readADCDataWithOffsets() in hal.h as below

    // convert throttle ->RB3/B3
    value = (float32_t)ADC_readResult(obj->adcResult[1], ADC_SOC_NUMBER3);
    pADCData->throttle = value;

    4. Convert the ADC result to the target setting value. You need to add this function according to your system/motor as below

    IdqSet_A.value[1] = adcData.throttle * ConvertCoef.

  • Thank you Luo for the quick responseSmiley

    Fortunately,after adding your code, i can see a conversion taking place in the adcData throttle value.

    but it looks like  ADCINB3 is taken buy the current sensor Ia and i can see its nominal value in the throttle variable.

    im using the tmdshvmtrinspin kit as reference design.

    what other ACD inputs can i use for the throttle, and what do i need to change in your working code to use other input?

    many many thanks!

    shany

  • It seems like there is no external interface for ADC input on the tmdshvmtrinspin kit.

    You might refer to the schematic of the tmdshvmtrinspin kit and controlCard to find a spare ADC channel for the throttle input.

    The tmdshvmtrinspin schematic is in the folder below.

    C:\ti\controlSUITE\development_kits\HVMotorCtrl+PfcKit_v2.1\~HVMotorCtrl+PFC-HWdevPkg

  • Thank you.

    I miss led you, im sorry.

    im using only the code part of the  tmdshvmtrinspin. my actual hardware is the LAUNCHXL-F280049C +  our own custom inverter. 

    so i have the following free ADCINs: 

    ADCINB1

    ADCINB2

    ADCINA9

    ADCINA1

    ADCINA6

    ADCINB6

    ADCINC14

    ADCINC3

    ADCINC5

    ADCINA0

    and more...

    i need the code to implement the throttle on one of these free ADC inputs.

    what do i need to change in the code? for example to make ADCINA6 to work with the throttle.

     

    much more thanks

    shany

  • You might use the spare ADC channel to replace the ADCINB3 in the above example code. If you want to use ADCINA6 that could be as below

    2. Configure the ADC in HAL_setupADCs() in hal.c as below


    ADC_setupSOC(obj->adcHandle[0], ADC_SOC_NUMBER3, ADC_TRIGGER_EPWM6_SOCA,
    ADC_CH_ADCIN6, HAL_ADC_SAMPLE_WINDOW);

    3. Read ADC result in HAL_readADCDataWithOffsets() in hal.h as below


    value = (float32_t)ADC_readResult(obj->adcResult[0], ADC_SOC_NUMBER3);
    pADCData->throttle = value;