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.

Control stepper motor using DRV8818 and MSP430G2553

Other Parts Discussed in Thread: DRV8818, MSP430G2553

Hello,

I'm using DRV8818 and MSP430G2553 to control the stepper motor 1.8 degree. Schematic I attach below. I write code for MSP430G2553 but it doesn't work, and I can't find out why. So I hope someone can help me? Here's my code:

#include <msp430g2553.h>
#define bit0    (0x01<<0)
#define bit1    (0x01<<1)
#define bit2    (0x01<<2)
#define bit3    (0x01<<3)
#define bit4    (0x01<<4)
#define bit5    (0x01<<5)
#define bit6    (0x01<<6)
#define bit7    (0x01<<7)

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;  // Stop WDT

  BCSCTL1 = CALBC1_16MHZ;
  DCOCTL = CALDCO_16MHZ;
  P1DIR |= 0x70;
  P1OUT |= 0x70;
  P1OUT &=~ bit5;
  P2DIR |= 0x3E;
  P2OUT |= 0x2E;
  P1DIR |= bit2;
  P1OUT &=~ bit2;
  __bis_SR_register(GIE);// enable global interrupt
   // Start Timer_A
   TA0CCR0 = 8000 -1;          // 1000Hz
   TA0CCR1 = 4000;
   TA0CCTL1 = OUTMOD_7;    //reset/set mode
   P1SEL |= bit2;
   TA0CTL |= TASSEL_2 + MC_1;// Start timerA0 in up mode , SMCLK
}

p1.2: Step; p1.4: Sleep; p1.5: Enable; p1. 6: Home

p2.1: Reset; p2.2: SRn; p2.3: USM0; p2.4: USM1; p2.5: DIR

6557.DRV8818.rar

  • Hi

    Not sure your problem is about the MCU part or the driver part.

    Is your code running with desired output, but the motor driver do not work?

    Have you checked all the input signals(output from MCU) to the driver?

    One thing in your code is that P1.6 Home should be input. HOMEn is a output signal from the driver side.

    Please identify where the problem comes from first. and if the problem is because of the MCU output, you may get better support on the MSP430 forum.

    Thanks.

    Wilson

    Motor Appication Team