BigQuad deck ESC PWM signal not changing

Post here to get support
Post Reply
dedecun
Beginner
Posts: 11
Joined: Tue Jul 02, 2019 1:43 pm

BigQuad deck ESC PWM signal not changing

Post by dedecun »

Hi,

I have followed all the instructions for updating the firmware and getting the Crazyflie 2.1 ready for the BigQuad deck. However, I seem to have a persistent problem. When powering up, the ESCs beep and then the drone says that it is ready to fly (in the cfclient console) and the ESCs beep again. It also says that the BigQuad deck has been recognized and that the driver switched to brushless motors. However, probing the PWM signal with an oscilloscope (picture attached) going into the ESC from the BigQuad deck, there is a signal there and this signal has whatever frequency I denoted it to have (for example 50Hz, 400Hz or 2kHz), but the duty cycle is not changing at all, no matter the thrust input given through the gamepad. Is there something simple that I am missing? As I have looked through the forum and found similar issues, but no answer.
Attachments
thumbnail_20191008_111436.jpg
arnaud
Bitcraze
Posts: 2308
Joined: Tue Feb 06, 2007 12:36 pm

Re: BigQuad deck ESC PWM signal not changing

Post by arnaud »

Hi,

There can be at least two reason I can think off for the output thrust to stay at 0% (like it is for you, 1ms pulse is 0% thrust):
- The Crazyflie sensors are not calibrated. After POST the M1 LED blinks red slowly during sensor calibration, when the sensor are calibrated it starts blinking faster. For the calibration to work the Crazylfie needs to be stable (ie. put on a stable surface).
- You are using a controller that do not go back to 0 thrust and you are using Crazyradio to control the Crazyflie: the is a locking mechanism in the Crazyflie that looks for one setpoint with thrust = 0 before accepting any setpoint. This was made as a protection mechanism against gamepad like the PS3 gamepad that outputs full thrust when not initialized.

Both case are not specific to the big-quad and would also happen with a Crazyflie with brushed motors. So one advice would be to test your setup with an unmodified Crazyflie first (if you have one) and then try with the big-quad deck.
dedecun
Beginner
Posts: 11
Joined: Tue Jul 02, 2019 1:43 pm

Re: BigQuad deck ESC PWM signal not changing

Post by dedecun »

Hi, thanks for the answer.

None of the two I believe is the cause. As I said, it outputs "ready to fly" in the console after calibration of the sensors. Also I have tested many times the same setup with a pure Crazyflie, even tested right after this one not working.

Any other ideas?

Cheers
TheFalconType
Beginner
Posts: 2
Joined: Thu Oct 10, 2019 9:08 am

Re: BigQuad deck ESC PWM signal not changing

Post by TheFalconType »

Hello There,

This sounds very similar to the issue I currently am having. I've tried the old "power cycle" technique so many times, alas to no avail. If I find out the solution to the similar issue I am having, I will post it here too.
thefred
Beginner
Posts: 6
Joined: Thu Jan 16, 2020 11:23 am

Re: BigQuad deck ESC PWM signal not changing

Post by thefred »

Hi All,

I've been trying to debug this for a while now, so I will report how far I got.

When logging the thrust values from setpoint, I get thrust values coming from crtpCommanderRpytDecodeSetpoint (from crtp_commander_rpy.c), so I know I am decoding a package that is sending me thrust. I've logged the value before and after updating them and they both have sometimes non-zero results. (I believe its fine that values in the beginning, before I read the package are not zero, because setpoint is static pointer, so I believe I get values from a previous cycle, but I can't observe that since logging has a much lower update rate than the drone's internal loop).

But If I log the thrust value from setpoint in stabilizer.c soon after I run

Code: Select all

commanderGetSetpoint(&setpoint, &state);
logThrust[0] = setpoint.thrust;
I already get a zeroed thrust for the setpoint.

Moreover, if I try logging thrust in commanderGetSetpoint (in commander.c) it also shows me zeroes. However, if I log setpoint->thrust in commanderSetSetpoint, i get sometimes non-zero values.

So I think something between commanderSetSetpoint (that receives the setpoint from a package after crtpCommanderRpytDecodeSetpoint) and commanderGetSetpoint something is being lost :( .

TBH, I haven't done a similar thing in the base stock crazyflie with no decks, so maybe this is the normal behaviour, but I don't believe it could be.

I am wondering why could this be. What could have changed between adding the bigquad? My best guess so far is that the task execution stack might be off :o .

(also, I believe this is not a hardware issue because I can see the PWM signal change on the motors when I set motorSetEnable to 1 and change motorPowerSet values and I can get them to spin)

Please advise. Cheers!
thefred
Beginner
Posts: 6
Joined: Thu Jan 16, 2020 11:23 am

Re: BigQuad deck ESC PWM signal not changing

Post by thefred »

I found the bug. Will probably make a ticket about it in the github repo.

line 84

Code: Select all

extRxInit();
in function bigquadInit in bigquad.c

Code: Select all

static void bigquadInit(DeckInfo *info)
{
  if(isInit) {
    return;
  }

  DEBUG_PRINT("Switching to brushless.\n");
  motorsInit(motorMapBigQuadDeck);
  //extRxInit();
#ifdef BQ_DECK_ENABLE_PM
  pmEnableExtBatteryVoltMeasuring(BIGQUAD_BAT_VOLT_PIN, BIGQUAD_BAT_VOLT_MULT);
  pmEnableExtBatteryCurrMeasuring(BIGQUAD_BAT_CURR_PIN, BIGQUAD_BAT_AMP_PER_VOLT);
#endif

#ifdef BQ_DECK_ENABLE_OSD
  uart1Init(115200);
  mspInit(&s_MspObject, osdResponseCallback);
  xTaskCreate(osdTask, BQ_OSD_TASK_NAME,
              configMINIMAL_STACK_SIZE, NULL, BQ_OSD_TASK_PRI, NULL);
#endif

  isInit = true;
}
need to be commented out (as above). What extRxInit() does is load an external setpoint reader task with a higher priority that overrides whatever your controller was initially setting as setpoint.

I don't know why it does that, so maybe this functionality should be set with a parameter, so I am not sure what the intended functionality is to propose a fix. (I believe this setting is a mix of the implementation of the CPPM output with an external controller and these functionalities need to be properly separated and defined, say with compiler tags, like BQ_DECK_ENABLE_CPPM and BQ_DECK_ENABLE_EXT and do the appropriate ifdefs, but I am too much of a newbie to propose something like that)

Commenting this out will allow you to test the drone with cfclient and a controller though.

All the best
tobias
Bitcraze
Posts: 2059
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: BigQuad deck ESC PWM signal not changing

Post by tobias »

That is a good find. The quick solution would be, as you say, to have to enable it during compile time. Let's discuss how to do it in the issue when it is created.
Post Reply