Need help with wixel driving a drv8801

Hi,

I’m trying to drive a motor with a drv8801 controlled via a wixel. I can make the motor go forward and stop, but not go backwards.

I have connected wixel P0_0 —> 8801 DIR (aka PHASE), and wixel P0_1 —> 8801 PWM (aka ENABLE).

The wixel is powered via USB at present, the 8801 logic power is coming from the wixel 3.3 output and GND pins, and the motor with a 9v battery via the 8801 VMM and GND pins.

My init code:

setPort0PullType(LOW);
setDigitalOutput(P0_0, HIGH); // DIR defaults to forwards
setDigitalOutput(P0_1, LOW);  // PWM 0% 

My code for stop/forward/rev:

		case RFC_STOP:
			setDigitalOutput(P0_1, LOW);  // PWM 0%
			break;

		case RFC_FWD:
			setDigitalOutput(P0_0, HIGH); // Forward
			setDigitalOutput(P0_1, HIGH); // PWM 100%
			break;

		case RFC_REV:
			setDigitalOutput(P0_0, LOW);  // Backwards
			setDigitalOutput(P0_1, HIGH); // PWM 100%
			break;

Is the problem something to do with not getting the DIR pin properly low? That is what the line in the init code which sets P0 to pulldown was trying to ensure.

Any help appreciated,
David.

Hello, David.

You are not providing the right value for the first parameter in each call to setDigitalOutput. Here is some example code:

setDigitalOutput(1, HIGH);

Here is the documentation:

pololu.github.com/wixel-sdk/gpio_8h.html

–David

Thanks David, I just came back to say I’d fixed it by changing those parameters!

When I read the docs more carefully I figured they wouldn’t say to use (port * 10 + pin) if Px_y worked so I tried it and that fixed things.

When Px_y compiled I figured they were meant to be used.

Regards,
David.

Unfortunately, I am not sure how we would trigger a compiler error when Px_y is accidentally used in that way. The Px_y things are available so you can directly read or write to single bits in the port registers. The code “setDigitalInput(P1_0, HIGH);” is valid C code if you wanted to drive pin 0 or pin 1 high depending on the state of P1_0.

–David