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.

C2000WARE-MOTORCONTROL-SDK: using other ADC for motor current measurements

Part Number: C2000WARE-MOTORCONTROL-SDK
Other Parts Discussed in Thread: LAUNCHXL-F280049C, BOOSTXL-DRV8320RS

We are using LaunchXL-F280049C LaunchPad and BoostXL-DRV8320RS.  Currently we have the BoostXL on Site 1 of the LaunchPad.  The motor control code from TI gets Current Sense A via PGA1_IN, Current Sense B via PGA3_IN, and Current Sense C via PGA5_IN.  In the application hardware, we plan to use A/D (not through the PGA).  What would need to be done in the TI motorcontroller firmware to use A/D inputs for current sense (as opposed to PGA)?

  • Yes, you can use the other ADC pins without PGA  for current sensing. You just need to change the ADC configuration in hal.c and hardware parameters in user.h as the attached documentation file4744.Guidelines for new hardware boards with motor control SDK.pdf.

  • Thanks for the pdf, it points me to what I will need to focus on.  Can you send a link to where the document is on the TI site, just incase there are other documents posted that might provide additional info for transitioning to new hardware.

    Additional Questions:

    In the pdf at the end, "Notes 1: Need to change the PGA and CMPSS configuration in the functions HAL_setupPGAs() and HAL_setupCMPSSs() if used both modules".  Can you provide more specific guidance on what needs to be changed in the PGA and CMPSS configurations?  In my case when using the A/D directly for the motor currents, can I just comment out HAL_setupPGAs() in "hal.c"? and what needs to be changed in "HAL_setupCMPSSs()"?

  • what needs to be changed in "HAL_setupCMPSSs()"?

    You need to modify the MUX channel values to match analog subsystem Fig.12-4  via Table 9-2 in TRM.

  • Yes, you can comment or ignore the  HAL_setupPGAs() if you don't use the PGA.

    All of the configuration functions are in hal.c, please refer to chapter 12, 16, and 18 of the F28004x technical manual to change the CMPSS and PWM trip-zone configuration code

  • Can you take me through two examples.

    1) If we were to use Analog A3 instead of PGA1, specifically what would need to be done?

    2) If we were to use Analog C5 instead of PGA1, specifically what would need to be done?

  • As the documentation attached above. You might refer to the following codes.

    Step 1: Make sure that the ADC base address is set in HAL_init() as below in hal.c

    // initialize the ADC handles
    obj->adcHandle[0] = ADCA_BASE;
    obj->adcHandle[1] = ADCB_BASE;
    obj->adcHandle[2] = ADCC_BASE;

    // initialize the ADC results
    obj->adcResult[0] = ADCARESULT_BASE;
    obj->adcResult[1] = ADCBRESULT_BASE;
    obj->adcResult[2] = ADCCRESULT_BASE;

    Step  2: Set the ADC channel A3/C5 for sampling in HAL_setupADCs() in hal.c

    Q1: ADC_setupSOC(obj->adcHandle[0], ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM6_SOCA,
    ADC_CH_ADCIN3, HAL_ADC_SAMPLE_WINDOW);

    Q2: ADC_setupSOC(obj->adcHandle[2], ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM6_SOCA,
    ADC_CH_ADCIN5, HAL_ADC_SAMPLE_WINDOW);

    ADC_SOC_NUMBER0 or other  ADC_SOC_NUMBER(ncan be only used once for each ADC modules (ADCA/ADCB/ADCC)

    Step 3: Read ADC result accordingly in HAL_readADCDataWithOffsets() in hal.h

    Q1: value = (float32_t)ADC_readResult(obj->adcResult[0], ADC_SOC_NUMBER0);

    Q2: value = (float32_t)ADC_readResult(obj->adcResult[2], ADC_SOC_NUMBER0);

    If you haven't had a chance to look at the workshop material, I think this will help demystify some of the terminology and architecture as well.

    https://training.ti.com/c2000-f28004x-microcontroller-workshop?context=1137791-1137780