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.

CCS/MSP430G2533: Coding to program a sensored BLDC motor using DRV8313EVM stand alone

Part Number: MSP430G2533
Other Parts Discussed in Thread: DRV8313EVM, DRV8313, MSP430G2553, MSP430F5529, DRV8323, DRV832X, MSP-EXP430F5529LP

Tool/software: Code Composer Studio

Hi,

I am currently working on an application to run a simple program on my sensored BLDC motor using DRV8313EVM module. I would like to run the motor in stand alone mode with a certain set of algorithms.

The algorithms would be running CW for 40% duty cycle for 1minute, 100% duty cycle for 3 minute CW, 80% duty cycle for 2 min CCW and repeat. 

1) For programming BLDC motor, usually there are 6 inputs need to be keyed in (INHA, INLA, INHB, INLB, INHC, INLC), however for the DRV8313EVM (MPS430G2553 chip), there are only points of EN1, EN2, EN3, IN1, IN2 and IN3? As far as I know, usually need to program High and Low for each channel but in this case there are one for EN and one for IN.

So how do I go about programming this sequence for CW and CCW as well as using timer to program the time using DRV8313EVM.

I am quite new to programming in CCS. Appreciate any advice/help

Thanks,

Thena

  • Hello Thenagharan,
    while I am not an expert on BLDC and the driver devices, looking into the User's Guide for the EVM in Figure 25 one can see, this DRV8313 being a more intelligent part, then just a pure H-bridge driver. As the block diagram of the device indicates, there is just one input signal of each of the H-Bridge stages for the three different phases. This is the case with many modern and intelligent TI motor drivers. They come with an integrated logic, which based on the PWM signal generate all the necessary commutation and high/low side signals. This is also the case for this part. That's the reason, why you see just the enable and the PWM-input signals.

    For the required signals, I'd recommend consulting the User's Guide for the DRV8313EVM www.ti.com/.../slvu815a.pdf. There are steps described, how to load the image, or import the CCS project which comes with the EVM into CCS.

    Best regards
    Peter
  • Hello Thenagharan,
    please let us know, whether you need further support on this. Many thanks in advance.

    Best regards
    Peter
  • Hi Peter,

    Thanks for the feedback.
    I understand in terms of giving the signal to just EN1, EN2, EN3, IN1, IN2 and IN3

    For Bldc motor, I am familiar with giving signal to high and low for each phase (so meaning total 6 pins) based on the motor datasheet.

    I followed the samples in the user guide, I was able to get the motor running with GUI, but I need to run the motor without the GUI (gives a voltage and the motor will run according to the algorithm). I tried to generate the config and check the codes but these are the codes I got (see below).
    There are no any codes in the void Process_UART_Data.

    My question would be :

    1) is it supposed to be like that ? (in order to program using CCS as stand alone, I would need MSP-EXP430G2 (currently awaiting for that)
    2) how do I write the codes for just one input of signals for the algorithm below?
    The algorithms would be running CW for 40% duty cycle for 1minute, 100% duty cycle for 3 minute CW, 80% duty cycle for 2 min CCW and repeat.

    Appreciate your help. :)


    /*
    #ifndef CONFIG_C_
    #define CONFIG_C_
    #include "msp430g2553.h"

    extern unsigned int INTEGRATION_CONSTANT;
    extern unsigned char START_UP_DUTY; //%
    extern unsigned char START_UP_MAX_DUTY ; //%
    extern unsigned char INCREMENTAL_DUTY ; //%
    extern unsigned char INCREMENTAL_TIME ; //mS
    extern unsigned int WAIT_TIME ; //mS
    extern unsigned char SPEED_DUTY_MAX; //%
    extern unsigned char SPEED_DUTY_MIN ; //%
    extern unsigned char SPEED_RAMP_CYCLES ;
    extern unsigned char Speed_Control,State,Hysteritic_Control,Rotation ;

    void Init_System_Variables(void)
    {
    INTEGRATION_CONSTANT = 20;
    START_UP_DUTY = 1; //%
    START_UP_MAX_DUTY = 15; //%
    INCREMENTAL_DUTY = 1; //%
    INCREMENTAL_TIME = 4; //mS
    WAIT_TIME = 200; //mS
    SPEED_DUTY_MAX = 97; //%
    SPEED_DUTY_MIN = 10; //%
    SPEED_RAMP_CYCLES = 2;
    Hysteritic_Control = 2;
    State = 1;
    Speed_Control = 0;
    Rotation = 0;
    }

    void Process_UART_Data (void) {}

    #endif

    */

    Thanks,
    Thena
  • Hello Thenagharan,
    I looked into the SW package, and you're right. The motor control portion of the code is "hidden" in a library file included in the project. The source file with the visible code, as you indicated, is just containing the processing of the UART data from the GUI, and based on the received data then calling the respective functions in the library.
    I have contacted the colleagues responsible for these tools, checking whether we are able to provide some source code, which you could use as a starting point. I'll come back to you as soon as I get feedback from them.

    Best regards
    Peter
  • Hi Peter,

    Thanks for the information and help.

    Looking forward for your reply. :)

    Thanks,

    Thena

  • Hi Thenagharan,
    to give you a brief update, the main problem with the code is IP protection. A great portion of the IP within the code, that's hidden in the library is not TI property.
    Despite of that, I talked to the responsible colleagues, and they are trying to put something together, which you could use as a starting point. I should receive it the next days. I'll come back to you on this as soon as I receive it.

    Best regards
    Peter
  • Hi Peter,

    Thanks for the update. :)

    Another quick question;

    I came across this sample code below but just curious about the code.

    In the code below, its written P2OUT &= ~ (BIT5);

    -- > meaning its clearing/reset the bit for P2.5 but in the comment it says reset bits P2.4, P2.5.

    Hence, should the code be P2OUT &= ~ (BIT4 | BIT5)?

    Because below that, there is also another code --> P1OUT &= ~(BIT4 | BIT5); this states it clearing/reset P1.4 and 1.5

    /* Reset switches for phase U (HIGH) */

    P2OUT &= ~(BIT5); /* Reset bits P2.4 , P2.5 */ 

    P2SEL &= ~(BIT5); /* Select P2.4 , P2.5 as I/O Function for Phase U*/

    /* Reset switches for phase V (LOW-HIGH)*/

    P1OUT &= ~(BIT4 | BIT5); /* Reset bits P1.4 , P1.5 */

    P1SEL &= ~(BIT4 | BIT5); /* Select P1.4 , P1.5 as I/O Function for Phase V*/

    Thanks,

    Thena

  • Hi Thenagharan,
    there is definitely a mismatch between the comments and the actual code instructions. I assume the code is correct, but the comments are incorrect. But it could of course be the other way round.
    Unfortunately people are not always disciplined enough on updating the comments, when they change the code during debugging.
    Could you please send me the link to the code? We need to correct it. Many thanks in advance.

    Best regards
    Peter
  • Hi Peter,

    haha. ok. understand.

    No worries.

    Here is the link of where I downloaded the software files -> http://www.ti.com/tool/BOOSTXL-DRV8323RS

    Its from the sample code given from the folder "DRV8323_MSP430F5529_Trapezoidal_Sensored_BLDC" --> in global.c file

    I downloaded it from the zip file DRV832x Software (MSP-EXP430F5529LP)--> I extracted that folder after installing "DRV832x_EVM_FW_1.0.0_windows-installer" found in that zip file.

    Thanks,

    Thena

  • Hi Thenagharan,
    many thanks for the additional information. We will file this as an erratum, to address its correction.

    Sorry for the delay on the PWM code. The colleagues seem to need some more time for it.

    Best regards
    Peter
  • Hi Thenagharan,
    sorry for the late response. Unfortunately the situation is a bit more complex, as as mentioned previously the BLDC code is strictly private due to external IP.
    We also need to change the responsibility for this thread on our side, as though the TIDA is making use of the MSP430, the problem is related to the TIDA design itself and not MSP430. Thus another team, who is responsible for the TIDA has to take over. We're contacting this team, and will come back to you as soon as possible.

    Best regards
    Peter
  • Hi Peter,

    No worries. Thanks for the update and do let me know if there is any progress on this. Appreciate it.

    Thanks,

    Thena

  • Thena,

    What assistance is needed from the Brushless Motor Drive team?

    Regards,

    -Adam
  • Hi,

    For DRV8313EVM, I followed the samples in the user guide, I was able to get the motor running with GUI, but I need to run the motor without the GUI (gives a voltage and the motor will run according to the algorithm). I tried to generate the config and check the codes but these are the codes I got (see below).
    There are no any codes in the void Process_UART_Data.

    My question would be :

    1) is it supposed to be like that ?  --> no any motor control portion code in the void Process_UART_Data (void) .
    2) how do I write the codes for just one input of signals for the algorithm below?
    The algorithms would be running CW for 40% duty cycle for 1minute, 100% duty cycle for 3 minute CW, 80% duty cycle for 2 min CCW and repeat.

    As mention by your colleague, "The motor control portion of the code is "hidden" in a library file included in the project. The source file with the visible code, as you indicated, is just containing the processing of the UART data from the GUI, and based on the received data then calling the respective functions in the library."

    Am i able to get that section when i try to generate the config file?

    Appreciate your help. :)


    /*
    #ifndef CONFIG_C_
    #define CONFIG_C_
    #include "msp430g2553.h"

    extern unsigned int INTEGRATION_CONSTANT;
    extern unsigned char START_UP_DUTY; //%
    extern unsigned char START_UP_MAX_DUTY ; //%
    extern unsigned char INCREMENTAL_DUTY ; //%
    extern unsigned char INCREMENTAL_TIME ; //mS
    extern unsigned int WAIT_TIME ; //mS
    extern unsigned char SPEED_DUTY_MAX; //%
    extern unsigned char SPEED_DUTY_MIN ; //%
    extern unsigned char SPEED_RAMP_CYCLES ;
    extern unsigned char Speed_Control,State,Hysteritic_Control,Rotation ;

    void Init_System_Variables(void)
    {
    INTEGRATION_CONSTANT = 20;
    START_UP_DUTY = 1; //%
    START_UP_MAX_DUTY = 15; //%
    INCREMENTAL_DUTY = 1; //%
    INCREMENTAL_TIME = 4; //mS
    WAIT_TIME = 200; //mS
    SPEED_DUTY_MAX = 97; //%
    SPEED_DUTY_MIN = 10; //%
    SPEED_RAMP_CYCLES = 2;
    Hysteritic_Control = 2;
    State = 1;
    Speed_Control = 0;
    Rotation = 0;
    }

    void Process_UART_Data (void) {}

    #endif

    */

    Thanks,

    Thena

  • Thena,

    We have given all info and code that we can. Did you get this resolved?

    Regards,

    -Adam

**Attention** This is a public forum