Simle Motor Controller format error

In my spare time I’ve been trying to solve a particular noise/format issue with my 18v15. I followed the guide here and soldered 0.1uF capacitors across the motor leads and to the chassis, but I’m still consistently seeing the errors. Specifically, the screenshot below:

Now, for a bit of background, I have two motor controller’s daisy chained together sharing the same RX line. The motors have been given ids of 10 and 12. Here is a snippet of code which generates the byte array. I am using the Pololu protocol with full motor resolution as described here

int setExitSafeStart(int fd, unsigned char id) {

    unsigned char bytes[3] = {0xAA, id, 0x03};
    if (write(fd, bytes, sizeof(bytes)) == -1) {
        perror("error writing");
        return SERIAL_ERROR;
    }

    return 0;
}

int setMotorSpeedWithId(int fd, int speed, unsigned char id) {

    unsigned char bytes[5];
    bytes[0] = 0xAA;
    bytes[1] = id;

   if (speed < 0){
       command[2] = 0x06;
       speed = -speed;
    } else {
       command[2] = 0x05;
    }
    
    bytes[3] = (speed & 0x1F);
    bytes[4] = (speed >> 5 & 0x7F);

    if (write(fd, bytes, sizeof(bytes)) == -1) {
        perror("error writing");
        return SERIAL_ERROR;
    }
    return 0;
}

I added some logging to the code for debug purposes. The speed values are output from an analog joystick. In this instance, the joystick was pushed forward almost full throttle (max = 3200) and then pushed backwards close to full reverse(max = -3200). As you can see the Pololu command switches accordingly from 0x85 to 0x86, clearing the MSB (0x05, 0x06) and sets the last two bytes to low 5 high 7.

Joystick forward speed output: 2848:
Sending bytes: AA:0C:05:00:59

Joystick reverse speed output: 3025:
Sending bytes: AA:0A:06:11:5E

What I have done to troubleshoot:

The particular motors I am using are 12v Pittman GM9236. To rule out the motors themselves I grabbed a couple very small RC motors to test with, however I still reproduced the same errors. I tried switching the polarity, twisting the motor leads, and soldering 3 capacitators per motor. Interestingly enough, I completely removed the motors from the motor controllers and not a single error was produced? The controllers blinked yellow and pulsed when throttling up or down, showing me that commands were being received without errors. This was great news, until I hooked the motor back up and it went red again with noise/format errors.

Given the information above, is there anything that looks out of place or doesn’t sound right? I do not have a scope to test with however based on the response I might try to bring this into work and use theirs.

Addition information just incase:
- The motors work fine for a few seconds when moving the joystick and then sporadically go red. Sometimes just one, sometimes both. Always with the same noise/format error.
- The power supply is a new 12V sealed lead acid battery.
- Both controllers are set to auto baud.
- I have never been able to cause a noise/format error within Pololu Control Center. Only with my own code.
- The platform is a Jetson TK1. Voltage levels are 1.8v on this system so a level shifter is used to step up SMC lines.
- 3 motors were used in testing, all with the same result, with and without capacitors.

  • setMotorSpeedWithId is called at 1 second intervals for now. This is very very slow for a joystick but I am debugging and thought maybe I was sending commands too fast.

Hello.

It is interesting that the controller seems to be working OK without the motors connected. It sounds possible that the serial line might be picking up some noise, which would then activate the safe start feature of the motor controller. Where is the level shifter for your serial line? Can you send me pictures that show your system (including any soldered connections)? I could not completely interpret your code, but it looks like you created the setExitSafeStart() function to reset the SMC error flags. Does that clear the error and allow the motor to run again? How frequently is the error occurring? Does it usually occur in certain situations like changing direction, slowing or accelerating?

-Nathan

@nathanb, your response directed me to the level shifter. I went to take a close up picture of the circuit for you when I realized something particularly odd. The shifter sits on a breadboard, 1 line comes in to the low end(ch1), and 2 lines come out of the corresponding high end(one for each controller). Now, I think this is where I went wrong all along. When I look at the daisy chaining documentation, it implies that one line comes into RX on controller 1, which is then daisy chained to controller 2. In other words, controller 2 does not have a direct RX line to the MCU, only controller 1 does. I rewired the controllers and sure enough, it works like a charm. Before I call success, I wanted to run my findings by you. I guess you could say I was “Sharing” the same RX line, but I was not “Daisy Chaining”? As a result both controllers were receiving the commands, but not in a synchronized serial fashion, which probably caused the sporadic noise/format errors?

Thank you for your help!

I am not certain connecting the RX lines of two SMCs to a single output would cause that sort of problem, but it seems possible that is the issue. Feel free to let us know if you have any additional problems.

-Nathan