Issue controlling brushless ESCs with Crazyflie 2.0

Firmware/software/electronics/mechanics
Post Reply
jgsuw
Beginner
Posts: 7
Joined: Mon Jun 04, 2018 9:47 pm

Issue controlling brushless ESCs with Crazyflie 2.0

Post by jgsuw » Sat Dec 29, 2018 2:10 am

Hello Bitcraze,

Sorry for the repost, but I initially placed this in the wrong message board!

I am working on a custom deck for Crazyflie 2.0, the purpose of which is to allow the Crazyflie to control brushless motors with a 1-2 cell battery, while preserving some of the expansion deck IO (SPI for the flow deck, and UART for a custom peripheral sensor). Hence why I am designing a custom deck to interface the Crazyflie with ESCs and to distribute power. My hope is for the deck to enable scaling the power and payload capability of the Crazyflie, while preserving as much of the system and its user interface as possible.

Recently I have succeeded in controlling ESCs which are connected to the expansion pins TX2, RX2, IO1, and IO2, using push-pull outputs. To accomplish this, I created a deck driver based off the bigquad driver, and I also used the motor peripherals defined in motors_defs_cf2.h

However, so far my approach does not work when the system is powered directly via a battery (be it one cell, or two cells). In that case, the expansion pins TX2, RX2, IO1, and IO2, are not being driven with the necessary control signal. I expect to see a 400Hz PWM signal with 1ms-2ms pulses according to the motor control efforts, but instead these pins are just sitting at VCC.

But, when I connect the Crazyflie to my PC using the micro-USB port, then suddenly the expected control signals appear, and I can control the motors using a gamepad in the Crazyflie Client program. Also, when I do this, I still have the LIPO battery connected to the Crazyflie. So, it would appear that my approach will not work unless there is around 5 volts present on VUSB. Sure enough, in the case of the bigquad deck, 5V is provided to VUSB at the expansion header.

Why am I having this issue? Is it necessary for there to be power on VUSB to use brushless motors? From a hardware perspective, I don't see a need for such a dependency. I suspect that this issue is caused somewhere in the Crazyflie's firmware. I would prefer to circumvent this issue if possible, and would greatly appreciate any insight that this community can provide. For the record, I am currently working from the 2018.10 tag of bitcraze crazyflie-firmware repository.

Best Regards,
Joseph Sullivan

tobias
Bitcraze
Posts: 1754
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Issue controlling brushless ESCs with Crazyflie 2.0

Post by tobias » Fri Jan 04, 2019 1:39 pm

That is strange indeed! I don't know if you seen the RZR but it does basically the same but using some new unused pins of the STM32F4. I have not seen anything like that.

On the big quad we use pull-ups to 5V and open-drain output of the STM32F4 to generate the PWM signal. Could it be that the pins are configured in open-drain mode and you need to have them in push-pull?

jgsuw
Beginner
Posts: 7
Joined: Mon Jun 04, 2018 9:47 pm

Re: Issue controlling brushless ESCs with Crazyflie 2.0

Post by jgsuw » Fri Jan 04, 2019 11:40 pm

Thank you for your reply Tobias.

I had not seen RZR before, this is excellent news! I was about 50% of the way to getting that capability myself, but now I am relieved to know that Bitcraze is working on a similar product. Do you have any guess as to when it will be released? I have been working with Bitcraze hardware for a USAF funded research center at a public university in the United States, and we are very keen on scaling our project to support larger sensor payloads, while sticking with Bitcraze hardware, estimators, software etc. If Bitcraze would benefit, I would be thrilled to contribute in some way to testing prototype hardware and firmware for RZR. It would certainly benefit us here at the University of Washington Biology department!

Also, about the outputs, I had them configured as push-pull, and was monitoring the ESC signals on an oscilloscope. I was definitely surprised when the control signals started working after plugging in a micro USB cable. I'm not sure what to make of it, but seeing as RZR is in the works, in the mean time I may put this question on the backburner.

Post Reply