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.

Compiler/TM4C123GE6PM: Problem in stepper motor driver IC DRV8835 Using TM4C123 micro controller

Part Number: TM4C123GE6PM
Other Parts Discussed in Thread: DRV8835

Tool/software: TI C/C++ Compiler

Hello,

I was try to implement the Stepper motor driver DRV8835 IC interface with TM4C123 micro controller, in the only one step motor is routeing even if keep for continues running, please help out of this error where i am missing something and please consider below source code. or If you have any source code of same driver please send me.

NOTE: I AM USING MODE:0 in Mode_0 pins are IN1 and IN2 are normal GPIO pins.(toggle HIGH or LOW condition). 

This GPIO PIN Init code

void Motor_Driver_ONE(void)
{
Usbprint("***** MOTOR ONE Enable *****\r\n");
/**************** MOTOR-1 PB Pins ****************/

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); 
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_5 | GPIO_PIN_4);
ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_5, 0);
ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_4, 0);

/**************** MOTOR-1 PE Pins ****************/

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); 
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_5 | GPIO_PIN_4);
ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_5, 0);
ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_4, 0);

/**************** MOTOR-1 PD Pins ****************/

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); 
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_0);
ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, 0);
}

This while loop to s\run the continuously.

while(1)

ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_5, 0);
/*** IN1-> PHASE IN2-> ENABLE ***/
ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_5, 1); //AENBLE1 -> PE4
ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, 1); //BENBLE1 -> PD0
for(int i = 0; i <= 900; i++){}
ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_4, 1); //APHASE1 -> PB4
ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_4, 1); //BPHASE1 -> PE5
for(int i = 0; i <= 900; i++){}
ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_5, 0); //AENBLE1 -> PE4
ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, 0); //BENBLE1 -> PD0 
for(int i = 0; i <= 900; i++){}
ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_4, 0); //APHASE1 -> PB4
ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_4, 0); //BPHASE1 -> PE5
for(int i = 0; i <= 900; i++){}

}

 Please help out of this,

Thanks,

  • Hello Chethan,

    Your API usage is incorrect. To write to a GPIO pin, you need to use the GPIO_PIN_X mask, not '1'. With the way you have your source code, only 

    ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, 1); //BENBLE1 -> PD0

    is actually getting the pin written.

    To fix this, you'd use the following:

    ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_5, GPIO_PIN_5); //AENBLE1 -> PE4
    ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_PIN_0); //BENBLE1 -> PD0
    for(int i = 0; i <= 900; i++){}
    ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_4, GPIO_PIN_4); //APHASE1 -> PB4
    ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_4, GPIO_PIN_4); //BPHASE1 -> PE5

  • Hello Ralph Jacobi,

    That fine if use this

    ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_4, GPIO_PIN_4);

    or 

    ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_4, 1); it will work fine because just i was making GPIO pin high or low that's it, (if i prob in the CRO i able find the difference in that, 

    But i did not solution DRV8835 driver IC even if i tried in this ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_4, GPIO_PIN_4); the stepper motor not running please help me out, the above code was current or what Ralph Jacobi please let me know.

    Thanks & regards

    Chethan G R.

  • Hello Chethan,

    Did you update all of your functions? Port E4 and E5 would need the update too.

    You should also check the signals on an oscilloscope to make sure the waveforms are being output correctly.

    Also is there a reason you are using GPIO over PWM? I feel like PWM would be what you want to use in this case. We have multiple PWM examples in TivaWare to show how to configure PWM functionality.

    I am not familiar with the DRV8835 so I can only offer MCU-level guidance as to what areas to debug.

  • Hello Ralph Jacobi,

    Thanks for reply and support, now it is working. i changed the some GPIO toggling status or step according the link https://e2e.ti.com/support/motor-drivers/f/38/p/653351/2430821#2430821?jktype=e2e.

    and i used the mode 1 method in that no need use PWM we can toggle the GPIO pins and i am using four stepper motor driver IC in TM4C123 have limited PWM pins so that i used only GPIO pins

    Thanks & Regards

    Chethan G R.