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.

Hercule RM42 launchpad and motor drive

Other Parts Discussed in Thread: LMD18200, HALCOGEN, DRV8848

Hello,

I got the RM42 launchpad and I am planning to use a lmd18200 or drv8848 to drive a dc motor.  I connected the N2HET00 and N2HET02 to the Ain1 and Ain2 for the DRV and N2HET04 for the PWM in the LMD with a GIO pin for direction. I got Code Composer 6 and Halcogen and did project 0 where I make the LED blink. But I still don't understand how Halcogen works, especially when we generate the het.h and het.c file. I tried doing similar steps for the blinking LED to the DC motor but realized that I need to have varying duty cycles and frequency. I look through the het.c files and saw pwmStart() and other functions like PWMSetSignal(). I am confused on the implementation of these functions like the parameters and how to use them. If someone can point me in the right direction on using Halcogen and CCS for motor control, I would appreciate it.


Thank you,

Robert Lee

  • What kind of DC motor do you want to drive? If you can share more details about what you want to achieve, we may be able to find some examples to help.

    Thanks and regards,

    Zhaohong
  • Hello,

    I am using a hsiang neng geared motor hn-gh12-2217y. For now I want to be able to just make the wheels turns. My ultimate goal is to eventually to remotely control the vehicle with my laptop to move the vehicle, but first I just want to be able to rotate the wheel to begin.

    Thank you,
    Robert Lee
  • Hello,


    Right now I am using hsiang neng geared motor hn-gh12-2217y. There aren't much information on it on the web since it is pretty old. Originally I was using an mbed and Sabertooth dual 12A motor driver for R/C to control the car, but I want to switch the mbed with a hercules rm42 launchpad because it is more powerful. I am also switching out the Sabertooth with 4 LMD18200 while keeping the motors the same. Right now I am just trying to write code on the hercules to move the motors through the sabertooth. I am trying to take one step at a time with this.
    Sorry for the late reply.

    Thank you,

    Robert Lee
  • Robert,

    I would suggest you first figuring out what waveform(s) you need to send to the motor driver for the motor to run correctly. Then we can help you to find some examples you can reuse.

    Thanks and regards,

    Zhaohong
  • Hello,

    On the mbed & sabertooth wiring, this was the code I ran to make it work:

    #include <iostream>
    using namespace std;

    #include "mbed.h"

    PwmOut wheel1(p21);
    PwmOut wheel2(p22);

    int main() {
    wheel1.period(0.020); // servo requires a 20ms period
    wheel2.period(0.020);
    while (1) {
    wheel1.pulsewidth(0.0014); // value between .001 (one direction) < .0015 (neutral) < .002 (opposite direction)
    wheel2.pulsewidth(0.0014);

    wait(3);

    wheel1.pulsewidth(0.0016); //reverse
    wheel2.pulsewidth(0.0016);

    wait(3);

    wheel1.pulsewidth(0.0016); //turning in one direction
    wheel2.pulsewidth(0.0014);

    wait(3);

    wheel1.pulsewidth(0.0014); //turning in another direction
    wheel2.pulsewidth(0.0016);

    wait(3);
    }
    }

    So from this, I understand that I would use PWM with a period of 20ms (The wait(3) was just there to differentiate between different wheel movement, so we can see it when it changes directions). The pulsewidth is .0014 seconds for one direction. So the duty cycle should be pulsewidth*100/period => .0014*100/.02 = 7? This would mean the duty cycle is 7% I believe. Is this what you were talking about of waveform?

    Thank you,
    Robert Lee
  • Robert,

    The information in the following thread should provide more infomation about how to use NHET.

    Thanks and regards,

    Zhaohong
  • Hello,

    Sorry for the late response, been busy. I don't see a thread on your reply.

    Thank you,
    Robert Lee
  • Robert,

    Please take a look at the following link. Sorry for the confusion.

    e2e.ti.com/.../395932

    Thanks and regards,

    Zhaohong