Strange servo behaviour with "Brushed With Relay" Motor

Hi,

I’m building a Rover with a brushed motor and “Pololu G2 High-Power Motor Driver”.

FC ist AUAV-X2.1 (which has a IOMCU)
Rover 4.0.0 stable

Motor is on SERVO2
MOT_PWM_TYPE 3 “Brushed With Relay”
SERVO2_FUNCTION 70

SERVO3 is the steering servo

From IOMCU hwdef.dat I can see that CH1 and CH2 are in timer group TIM2.
So it should be fine, if I connect motor on CH2 and don’t connect anything on CH1.
SERVO1_FUNCTION is set to PassThrough, because I want to have the signal also on SBUS-OUT. But the problem also exists, if I disable SERVO1 completely.

But the PWM signal of CH3 steering servo is randomly one of of the pictures below.
So I have to power the rover several times until I get the right servo signals. Need about 3-5 tries. If it hit the right signal, it is working correctly.

(sorry, I have only an old fashioned analog oszi :slight_smile:

Steering OK: (2 ms/div)
https://c.web.de/@337861202954682728/LMUnEkoBTiKAt2Ebe8qHUw

Steering working, but off center and wrong scaling (1ms/div)
https://c.web.de/@337861202954682728/b7i9DD1SSIyziu-ZYDX-LQ

Steering servo not working at all: (1ms/div)
https://c.web.de/@337861202954682728/cAAzBC5tTia_2ZlEBWgIdw

My parameter settings:
20191201-Bronco-400.param (16.2 KB)

Does anybody have an idea what could be wrong?

Hi @RainFly,

So the Pololu G2 High-Power Motor Driver is working? If “yes” this is really good to hear because it hasn’t been confirmed to work before so we can add it to the Verified Motor Drivers section of the wiki page.

I suspect the issue is related to the pwm output groups. Could you try connecting it to SERVO5 instead?

Hello, I don’t think the pwm groups is working yet. The backend part is ready but we don’t have way to parametrize which channel will be on which type.

Yes, I’m using exactly this Pololu G2 High-Power Motor Driver.

Motor driver works perfect out of the box.
Wiring RC-Output to PWM.
First GPIO (AUX5 with AUAV-X2.1) to DIR.

I have it in a Traxxas TRX-4 crawler with the stock Titan brushed motor. I’m not a crawler expert. But speed control works quite sensitive with high torgue even at very low speed. Break at stick neutral position is also good.
The driver is in a sealed, watertight box. But it stays cool without cooling.
With 16kHz PWM frequency the motor is silent.
My plan was to replace this setup with a brushless system. But it works for me better as expected, so I keep it for now.

1 Like

My thinking was that IOMCU co-processor is also running ChibiOS.
So this hwdef.dat should be valid: https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_HAL_ChibiOS/hwdef/iomcu/hwdef.dat

Furthermore I thought that PWM (type, frequency) is set on a timer group basis.
For iomcu CH1+CH2 are on TIM2:
2019-12-02%2016_17_59
So I thought configure CH2 (or CH1) to “Brushed with Relay” PWM mode, only CH1 and CH2 are set to brushed-motor PWM mode.
CH3, where steering servo is connected, is in a different timer group TIM4. So I thought CH3 should still produce servo PWM.

I already have connected 3 additional servo on CH4-6 for front/rear differential-lock and gear switch. I think they were working always correctly. But will check tonight again.
I’ll also try to connect the steering servo to CH7 or CH8 tonight.

I forgot to mention, that sometimes after powering up also the motor PWM (CH2) is audible. So the motor PWM frequency on CH2 is also sometimes below/different from the configured 16 kHz.

Again, I’m surprised that the different PWM-types are set randomly after powering up.

I connected steering servo to CH7.
Same picture as described in the initial post. Randomly it works, sometimes not.
Also the servo on CH4-6 only work, if steering servo is working.

1 Like

@RainFly,

Thanks again for the report and the confirmation on the Pololu motor driver.

Sorry to ask you to do more and more but I was wondering if you could download a dataflash log when it works and when it doesn’t work? It might be necessary to set LOG_DISARMED = 1 in order to produce logs when the vehicle isn’t armed.

@rmackay9
Here are some logs.
I did: Power up, arm, manual mode, steering right/left, activate diffllock-servo, motor forward/backward a little.
ServoNotWorking.zip (535.3 KB)
ServoWorkingMotorAudible.zip (538.0 KB)
AllWorking.zip (343.2 KB)

1 Like

In the meantime I moved the throttle "Brushed With Relay” away from the IOMCU CH 2 to the FMU CH 9. All IOMCU CH1-8 are now working reliable with servos.