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.

BOOSTXL-DRV8320S: I can't read the ISEN pin properly.

Part Number: BOOSTXL-DRV8320S
Other Parts Discussed in Thread: MSP430F5529, DRV832X, , DRV8320

Hi,

I am controlling the DRV8320S motor driver with the MCP430F5529LP development board through the code, but I cannot read the correct current from the ISEN pin.

I looked at the current reading side of the DRV832X_MSP430F5529_Trapezoidal_Sensored_BLDC example, as far as I understand, you are reading over phase A. Why did you do it like this?

ADC settings I use.

void ADC12_init(void)
{
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6,GPIO_PIN0);
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6,GPIO_PIN1);
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6,GPIO_PIN2);
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6,GPIO_PIN5);
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6,GPIO_PIN6);
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P7,GPIO_PIN0);

    ADC12_A_configureMemoryParam CH0_configureMemoryParam = {0};
    ADC12_A_configureMemoryParam CH1_configureMemoryParam = {0};
    ADC12_A_configureMemoryParam CH2_configureMemoryParam = {0};
    ADC12_A_configureMemoryParam CH3_configureMemoryParam = {0};
    ADC12_A_configureMemoryParam CH4_configureMemoryParam = {0};
    ADC12_A_configureMemoryParam CH5_configureMemoryParam = {0};

    CH0_configureMemoryParam.memoryBufferControlIndex = ADC12_A_MEMORY_0;
    CH0_configureMemoryParam.inputSourceSelect = ADC12_A_INPUT_A0;
    CH0_configureMemoryParam.positiveRefVoltageSourceSelect = ADC12_A_VREFPOS_AVCC;
    CH0_configureMemoryParam.negativeRefVoltageSourceSelect = ADC12_A_VREFNEG_AVSS;
    CH0_configureMemoryParam.endOfSequence = ADC12_A_NOTENDOFSEQUENCE;

    CH1_configureMemoryParam.memoryBufferControlIndex = ADC12_A_MEMORY_1;
    CH1_configureMemoryParam.inputSourceSelect = ADC12_A_INPUT_A1;
    CH1_configureMemoryParam.positiveRefVoltageSourceSelect = ADC12_A_VREFPOS_AVCC;
    CH1_configureMemoryParam.negativeRefVoltageSourceSelect = ADC12_A_VREFNEG_AVSS;
    CH1_configureMemoryParam.endOfSequence = ADC12_A_NOTENDOFSEQUENCE;

    CH2_configureMemoryParam.memoryBufferControlIndex = ADC12_A_MEMORY_2;
    CH2_configureMemoryParam.inputSourceSelect = ADC12_A_INPUT_A2;
    CH2_configureMemoryParam.positiveRefVoltageSourceSelect = ADC12_A_VREFPOS_AVCC;
    CH2_configureMemoryParam.negativeRefVoltageSourceSelect = ADC12_A_VREFNEG_AVSS;
    CH2_configureMemoryParam.endOfSequence = ADC12_A_NOTENDOFSEQUENCE;

    CH3_configureMemoryParam.memoryBufferControlIndex = ADC12_A_MEMORY_5;
    CH3_configureMemoryParam.inputSourceSelect = ADC12_A_INPUT_A5;
    CH3_configureMemoryParam.positiveRefVoltageSourceSelect = ADC12_A_VREFPOS_AVCC;
    CH3_configureMemoryParam.negativeRefVoltageSourceSelect = ADC12_A_VREFNEG_AVSS;
    CH3_configureMemoryParam.endOfSequence = ADC12_A_NOTENDOFSEQUENCE;

    CH4_configureMemoryParam.memoryBufferControlIndex = ADC12_A_MEMORY_6;
    CH4_configureMemoryParam.inputSourceSelect = ADC12_A_INPUT_A6;
    CH4_configureMemoryParam.positiveRefVoltageSourceSelect = ADC12_A_VREFPOS_AVCC;
    CH4_configureMemoryParam.negativeRefVoltageSourceSelect = ADC12_A_VREFNEG_AVSS;
    CH4_configureMemoryParam.endOfSequence = ADC12_A_NOTENDOFSEQUENCE;

    CH5_configureMemoryParam.memoryBufferControlIndex = ADC12_A_MEMORY_12;
    CH5_configureMemoryParam.inputSourceSelect = ADC12_A_INPUT_A12;
    CH5_configureMemoryParam.positiveRefVoltageSourceSelect = ADC12_A_VREFPOS_AVCC;
    CH5_configureMemoryParam.negativeRefVoltageSourceSelect = ADC12_A_VREFNEG_AVSS;
    CH5_configureMemoryParam.endOfSequence = ADC12_A_NOTENDOFSEQUENCE;

    ADC12_A_init(ADC12_A_BASE,ADC12_A_SAMPLEHOLDSOURCE_SC,ADC12_A_CLOCKSOURCE_ACLK,ADC12_A_CLOCKDIVIDER_1);
    ADC12_A_setupSamplingTimer(ADC12_A_BASE,ADC12_A_CYCLEHOLD_256_CYCLES,ADC12_A_CYCLEHOLD_4_CYCLES,ADC12_A_MULTIPLESAMPLESENABLE);
    ADC12_A_setResolution(ADC12_A_BASE,ADC12_A_RESOLUTION_12BIT);

    ADC12_A_configureMemory(ADC12_A_BASE,&CH0_configureMemoryParam);
    ADC12_A_configureMemory(ADC12_A_BASE,&CH1_configureMemoryParam);
    ADC12_A_configureMemory(ADC12_A_BASE,&CH2_configureMemoryParam);
    ADC12_A_configureMemory(ADC12_A_BASE,&CH3_configureMemoryParam);
    ADC12_A_configureMemory(ADC12_A_BASE,&CH4_configureMemoryParam);
    ADC12_A_configureMemory(ADC12_A_BASE,&CH5_configureMemoryParam);

    /* VSENA */
    ADC12_A_clearInterrupt(ADC12_A_BASE,ADC12IFG0);
    ADC12_A_enableInterrupt(ADC12_A_BASE,ADC12IE0);

    /* VSENB */
    ADC12_A_clearInterrupt(ADC12_A_BASE,ADC12IFG1);
    ADC12_A_enableInterrupt(ADC12_A_BASE,ADC12IE1);

    /* VSENC */
    ADC12_A_clearInterrupt(ADC12_A_BASE,ADC12IFG2);
    ADC12_A_enableInterrupt(ADC12_A_BASE,ADC12IE2);

    /* VSENVM */
    ADC12_A_clearInterrupt(ADC12_A_BASE,ADC12IFG5);
    ADC12_A_enableInterrupt(ADC12_A_BASE,ADC12IE5);

    /* POT */
    ADC12_A_clearInterrupt(ADC12_A_BASE,ADC12IFG6);
    ADC12_A_enableInterrupt(ADC12_A_BASE,ADC12IE6);

    /* ISEN */
    ADC12_A_clearInterrupt(ADC12_A_BASE,ADC12IFG12);
    ADC12_A_enableInterrupt(ADC12_A_BASE,ADC12IE12);

    __enable_interrupt();

    ADC12_A_enable(ADC12_A_BASE);
    ADC12_A_startConversion(ADC12_A_BASE,
                            ADC12_A_MEMORY_0 |
                            ADC12_A_MEMORY_1 |
                            ADC12_A_MEMORY_2 |
                            ADC12_A_MEMORY_5 |
                            ADC12_A_MEMORY_6 |
                            ADC12_A_MEMORY_12, ADC12_A_REPEATED_SEQOFCHANNELS);
}

ADC interrupt

#pragma vector = ADC12_VECTOR
__interrupt void ADC12ISR (void)
{
    switch (__even_in_range(ADC12IV, 34))
    {
        case 0: break; //Vector 0: No interrupt
        case 2: break; //Vector 2: ADC overflow
        case 4: break; //Vector 4: ADC timing overflow
        case 6:
            phaseA = ADC12_A_getResults(ADC12_A_BASE,ADC12_A_MEMORY_0);
            break; //Vector 6: ADC12IFG0
        case 8:
            phaseB = ADC12_A_getResults(ADC12_A_BASE,ADC12_A_MEMORY_1);
            break; //Vector 8: ADC12IFG1
        case 10:
            phaseC = ADC12_A_getResults(ADC12_A_BASE,ADC12_A_MEMORY_2);
            break; //Vector 10: ADC12IFG2
        case 12:break; //Vector 12: ADC12IFG3
        case 14: break; //Vector 14: ADC12IFG4
        case 16:
            //vccSupplyVoltage = ADC12_A_getResults(ADC12_A_BASE,ADC12_A_MEMORY_5);
            vccSupplyVoltage = ADC12_A_getResults(ADC12_A_BASE,ADC12_A_MEMORY_5) * 0.014;
            break; //Vector 16: ADC12IFG5
        case 18:
            drvPOT = ADC12_A_getResults(ADC12_A_BASE,ADC12_A_MEMORY_6);

            if( POT_counter <= 5)
                POT_Toplam += ADC12_A_getResults(ADC12_A_BASE,ADC12_A_MEMORY_6);

            if( POT_counter == 5 )
                POT_Ortalama = POT_Toplam/5;

            if( POT_counter > 5 )
                POT_Ortalama = ( POT_Ortalama * 4 + ADC12_A_getResults(ADC12_A_BASE,ADC12_A_MEMORY_6)) / 5;

            if( POT_counter < 6)
                POT_counter++;

            //PWM = POT_Ortalama / 25.6;

            break; //Vector 18: ADC12IFG6
        case 20: break; //Vector 20: ADC12IFG7
        case 22: break; //Vector 22: ADC12IFG8
        case 24: break; //Vector 24: ADC12IFG9
        case 26: break; //Vector 26: ADC12IFG10
        case 28: break; //Vector 28: ADC12IFG11
        case 30:
            //drvISEN = ADC12_A_getResults(ADC12_A_BASE,ADC12_A_MEMORY_12);

            if( ISEN_counter <= 5)
                ISEN_Toplam += ADC12_A_getResults(ADC12_A_BASE,ADC12_A_MEMORY_12);

            if( ISEN_counter == 5 )
                ISEN_Ortalama = ISEN_Toplam/5;

            if( ISEN_counter > 5 )
                ISEN_Ortalama = ( ISEN_Ortalama * 4 + ADC12_A_getResults(ADC12_A_BASE,ADC12_A_MEMORY_12)) / 5;

            if( ISEN_counter < 6)
                ISEN_counter++;

            drvISEN = ISEN_Ortalama;

            break; //Vector 30: ADC12IFG12
        case 32: break; //Vector 32: ADC12IFG13
        case 34: break; //Vector 34: ADC12IFG14
        default: break;
    }
}

While the engine is running, the adc value on the compiler is constantly changing. When I measure the ISEN pin with a multimeter, the value appears to be 75mA.

What is wrong here?

Ali,

  • Hi Ali,

    I will have time to check the DRV832X_MSP430F5529_Trapezoidal_Sensored_BLDC example tomorrow. Can you reiterate if the code you attached is your code or example code?

    Are you using the MSP-EXP430F5529 + BOOSTXL-DRV8320S out of the box? Does the GUI show more accurate current values compared to the compiler? 

    Current sense may be totaled for all three phases if I recall from the GUI, I will need to check this out later.

    What is the current and voltage you are running at with your motor?

    Thanks,

    Aaron

  • Hi Aaron,

    The code I added is my code, yeah.

    MSP-EXP430F5529 + BOOSTXL-DRV8320S is not as it came out of the box, I had to replace 1 of the mosfets because 1 Mosfet exploded. (I wrote about this in another topic. The DRV8320 was solid, the problem was the mosfet)

    I feed the motor with an 18v / 5A supply.

    Ali

  • Ali,

    Do you have a scope you can check the ISEN pin with or a current probe that you can measure the phase current directly?

    That would help us debug here since a multimeter is often very slow and will average the fast signal so it is not so helpful.

    Regards.

    -Adam

  • Hi Adam,

    I only have a multimeter with which I can measure the current value.

    Could you explain to me the following lines in the sample code that Ti In gave, the "Motor Phase Current Limit" value in the GUI defaults to 900 (DEC), which is 2.6A. what is the reason of this?

    Does the operation done on the code side in Picture 1 have anything to do with the ISEN pin and what is its relationship with the place where we set the Current on the GUI?

    Picture 1

    Picture 2

    Picture 3

  • Hi Ali,

    The motor phase current limit is a software current limit to trigger overcurrent used for the algorithm. You can alter the value as follows:

    From Picture 1, it appears that the sensoredTrapController.MotorPhaseCurrent reads the raw ADC value of the ISEN pin and then compares it to the MOTOR_PHASE_CURRENT_LIMIT value and if the absolute value of it is higher, then it triggers an OC fault. 

    If you can provide ISEN as a scope capture, we can measure the voltage on that pin and compare that current value to what the ADC is capturing on the GUI. 

    Thanks,
    Aaron

  • Hi Aaron,

    sorry for my late reply, 

    If you have the DRV8320S development board, can you try to read the ISEN pin for me and share the code you read with me? My values are constantly changing. When the motor is running without load, it draws 0.49A from the power supply. When I try to read this value from the ISEN pin, it constantly changes in the range of 200 - 40 (DEC).

    ISEN pin = 0.72mV        (DEC) = It ranges from 200 to 40

    POT pin = 0.72mV        (DEC) = 94 

    Thanks,

  • Hi,

    The problem is solved, we put a 100uf capacitor on the output of the ISEN pin.

    Thanks,