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: System unstable as ADC value increases

Part Number: LAUNCHXL-F280049C

Hello,

We have a 10k pot hooked up to pin6 (ADCINB3) of the BoosterPack Headers.  The ADC is working properly and reading values from 0 - 4095.  However, once we enable the motor flag and have the motor spinning there is an issue.  As we increase the ADC value the motor current starts to spike and the system goes unstable.  Any ideas?

the last section of both hal.c and hal,h in the snippets below are where we are having the issue (Throttle/ADC_SOC_NUMBER8)

//hal.c

    // configure the interrupt sources
    // configure the ample window to 15 system clock cycle wide by assigning 14
    // to the ACQPS of ADCSOCxCTL Register.
    // RB2/B1
    ADC_setInterruptSource(obj->adcHandle[1], ADC_INT_NUMBER1, ADC_SOC_NUMBER2);

    // configure the SOCs for hvkit_rev1p1
    // ISENA - PGA5->A14->RA0   //JFA Stock
    //ADC_setupSOC(obj->adcHandle[0], ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM6_SOCA,
                 //ADC_CH_ADCIN14, HAL_ADC_SAMPLE_WINDOW);

    ADC_setupSOC(obj->adcHandle[0], ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM6_SOCA,    //JFA
                 ADC_CH_ADCIN9, HAL_ADC_SAMPLE_WINDOW);

    // ISENB - PGA3->C7->RC0    //JFA Stock
    //ADC_setupSOC(obj->adcHandle[2], ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM6_SOCA,
                 //ADC_CH_ADCIN7, HAL_ADC_SAMPLE_WINDOW);

    ADC_setupSOC(obj->adcHandle[2], ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM6_SOCA,    //JFA
                     ADC_CH_ADCIN0, HAL_ADC_SAMPLE_WINDOW);

    // ISENC - PGA1->B7->RB0    //JFA Stock
    //ADC_setupSOC(obj->adcHandle[1], ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM6_SOCA,
                 //ADC_CH_ADCIN7, HAL_ADC_SAMPLE_WINDOW);

    ADC_setupSOC(obj->adcHandle[1], ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM6_SOCA,    //JFA
                     ADC_CH_ADCIN2, HAL_ADC_SAMPLE_WINDOW);

    // VSENA - A5->RA1
    ADC_setupSOC(obj->adcHandle[0], ADC_SOC_NUMBER1, ADC_TRIGGER_EPWM6_SOCA,
                 ADC_CH_ADCIN5, HAL_ADC_SAMPLE_WINDOW);

    // VSENB - B0->RB1
    ADC_setupSOC(obj->adcHandle[1], ADC_SOC_NUMBER1, ADC_TRIGGER_EPWM6_SOCA,
                 ADC_CH_ADCIN0, HAL_ADC_SAMPLE_WINDOW);

    // VSENC - C2->RC1
    ADC_setupSOC(obj->adcHandle[2], ADC_SOC_NUMBER1, ADC_TRIGGER_EPWM6_SOCA,
                 ADC_CH_ADCIN2, HAL_ADC_SAMPLE_WINDOW);

    // VSENVM - B1->RB2. 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_NUMBER2, ADC_TRIGGER_EPWM6_SOCA,
                 ADC_CH_ADCIN1, HAL_ADC_SAMPLE_WINDOW);

    //Added to measure external input from MSP430 driving speed //JFA
    ADC_setupSOC(obj->adcHandle[1], ADC_SOC_NUMBER8, ADC_TRIGGER_EPWM6_SOCA,
                     ADC_CH_ADCIN3, HAL_ADC_SAMPLE_WINDOW);




//hal.h

// convert phase A current        ->RA0/A14
    value = (float32_t)ADC_readResult(obj->adcResult[0], ADC_SOC_NUMBER0);
    pADCData->I_A.value[0] = value * current_sf;

    // convert phase B current        ->RC0/C7
    value = (float32_t)ADC_readResult(obj->adcResult[2], ADC_SOC_NUMBER0);
    pADCData->I_A.value[1] = value * current_sf;

    // convert phase C current        ->RB0/B7
    value = (float32_t)ADC_readResult(obj->adcResult[1], ADC_SOC_NUMBER0);
    pADCData->I_A.value[2] = value * current_sf;

    // convert phase A voltage        ->RA1/A5
    value = (float32_t)ADC_readResult(obj->adcResult[0], ADC_SOC_NUMBER1);
    pADCData->V_V.value[0] = value * voltage_sf;

    // convert phase B voltage        ->RB1/B0
    value = (float32_t)ADC_readResult(obj->adcResult[1], ADC_SOC_NUMBER1);
    pADCData->V_V.value[1] = value * voltage_sf;

    // convert phase C voltage        ->RC1/C2
    value = (float32_t)ADC_readResult(obj->adcResult[2], ADC_SOC_NUMBER1);
    pADCData->V_V.value[2] = value * voltage_sf;

    // convert dcBus voltage          ->RB2/B1
    value = (float32_t)ADC_readResult(obj->adcResult[1], ADC_SOC_NUMBER2);
    pADCData->dcBus_V = value * voltage_sf;

    // Measure Speed Input          ->RB2/B1   //JFA
    value = (float32_t)ADC_readResult(obj->adcResult[1], ADC_SOC_NUMBER8);
    pADCData->Throttle = value;

  • Did you use the ADC value to set any parameters for motor control?

    Try to add an RC filter (R=50~200/OHM, C=2nF~10nF) on the ADC input. And make sure the input voltage is positive and below 3.3V.

  • No, we do not have the ADC value to set any parameters for motor control.  In fact, we are using the value defined as "Throttle" from the examples.  RC filter is not an issue at this time as the values are stable enough and accurate.  The issue is that the incoming current increases as the "Throttle" ADC count increases until it trips the current fault.  This is strange as "Throttle" is not used anywhere and we even changed the name to be sure.  We are currently using ADC_TRIGGER_EPWM6_SOCA to setup the ADC.  Should we use a different EPWM?

  • Hi Jonathan,

    Might you have crossed two ADC channels in the process of adding SOC#8?

        // convert dcBus voltage          ->RB2/B1
        value = (float32_t)ADC_readResult(obj->adcResult[1], ADC_SOC_NUMBER2);
        pADCData->dcBus_V = value * voltage_sf;
    
        // Measure Speed Input          ->RB2/B1   //JFA
        value = (float32_t)ADC_readResult(obj->adcResult[1], ADC_SOC_NUMBER8);
        pADCData->Throttle = value;

  • Hello GI,

    Thanks for the response!  I do not think we crossed the two channels as the values are both different and correct.  

    Interestingly after debugging more it appears as though adjusting the pot is also somehow affecting I_A.value[2].  Even though the pot value is correct and runs from 0 - 4095, it is changing the value for I_A.value[2].  Not sure why this would be happening?  None of the other values defined below seem to be changing with the pot output.

    value = (float32_t)ADC_readResult(obj->adcResult[0], ADC_SOC_NUMBER0);
        pADCData->I_A.value[0] = value * current_sf;
    
        // convert phase B current        ->RC0/C7
        value = (float32_t)ADC_readResult(obj->adcResult[2], ADC_SOC_NUMBER0);
        pADCData->I_A.value[1] = value * current_sf;
    
        // convert phase C current        ->RB0/B7
        value = (float32_t)ADC_readResult(obj->adcResult[1], ADC_SOC_NUMBER0);
        pADCData->I_A.value[2] = value * current_sf;
    
        // convert phase A voltage        ->RA1/A5
        value = (float32_t)ADC_readResult(obj->adcResult[0], ADC_SOC_NUMBER1);
        pADCData->V_V.value[0] = value * voltage_sf;
    
        // convert phase B voltage        ->RB1/B0
        value = (float32_t)ADC_readResult(obj->adcResult[1], ADC_SOC_NUMBER1);
        pADCData->V_V.value[1] = value * voltage_sf;
    
        // convert phase C voltage        ->RC1/C2
        value = (float32_t)ADC_readResult(obj->adcResult[2], ADC_SOC_NUMBER1);
        pADCData->V_V.value[2] = value * voltage_sf;
    
        // convert dcBus voltage          ->RB2/B1
        value = (float32_t)ADC_readResult(obj->adcResult[1], ADC_SOC_NUMBER2);
        pADCData->dcBus_V = value * voltage_sf;
    
        // Measure Speed Input          ->RB2/B1   //JFA
        value = (float32_t)ADC_readResult(obj->adcResult[1], ADC_SOC_NUMBER15);
        pADCData->Throttle = value;

  • Ok your code show  ->RB2/B1 channel connected to dcBusVoltage and Measure Speed Input. Right ->RB0/B7 might be the culprit check the TRM analog MUX table and schematic to be sure they are not on the same mux line or shared between two JP headers via 0R's, that got me too. 

  • Make sure that the POT is connected to the correct pin for ADC-B3 on J1-Pin6 of F28004x LaunchPad, and the input voltage is between 0.0V to 3.3V.

     I have tested a motor on this kit with your configuration code as below on the kits. I don't think there is any issue to spin the motor if you just added the codes as you mentioned above in the example lab.

    Added code in HAL_setupADCs() in hal.c

    // 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);

    Added code in HAL_readADCDataWithOffsets() in hal.h

    // convert throttle ->RB3/B3

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