Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of Virtual Com Port (composite USB) and DSHOT motor signal protocol #1050

Merged
merged 15 commits into from
Jun 1, 2022

Conversation

tobbeanton
Copy link
Member

@tobbeanton tobbeanton commented May 20, 2022

This is a pretty hefty PR but it was hard to break it down...

  • ST USB device driver updated to V2.2.1
  • Virtual com port (VCP) has been implemented alongside the Crazyflie interface making a composite USB device.
  • VCP is used to support BLHeli 4-way passthough interface. Works with the BLHeliConfiguratior for windows (in wine in linux).
  • DSHOT implementation for CF2.1-BL prototype and Bolt 1.1
  • 4way protocol and logic adapted from Betaflight.
  • FreeRTOS task notifications enabled and used for 4-wire interface.
  • 4way task created with max priority since the half-duplex uart protocol used (AVRootloader) to communicate with the ESCs is bit-banged.
  • Crazyflie 2.1 Brushless config added to Crazyflie platform.

Documentation is still lacking and will be made when things are a bit more clear and figured out as part of getting Bolt out of early access.

The crazyflie-lib-python cfusb driver needs to be new for the cfclient to be able to connect using USB.

@knmcguire knmcguire marked this pull request as ready for review May 25, 2022 08:01
@knmcguire
Copy link
Contributor

I'm getting a build error for the cfbl.

make cfbl_defconfig
make -j16

Results in this error:

../src/drivers/src/motors.c: In function 'motorsPrepareDshot':
../src/drivers/src/motors.c:403:5: error: 'dmaWait' undeclared (first use in this function)
  403 |     dmaWait++;
      |     ^~~~~~~
../src/drivers/src/motors.c:403:5: note: each undeclared identifier is reported only once for each function it appears in
../src/drivers/src/motors.c: At top level:
cc1: error: unrecognized command line option '-Wno-stringop-overread' [-Werror]
cc1: all warnings being treated as errors
make[4]: *** [../scripts/Makefile.build:190: src/drivers/src/motors.o] Error 1
make[3]: *** [../scripts/Makefile.build:311: src/drivers/src] Error 2
make[2]: *** [../scripts/Makefile.build:311: src/drivers] Error 2
make[2]: *** Waiting for unfinished jobs....

The CI doesn't use this config yet so that is why it didn't catch this

Copy link
Contributor

@knmcguire knmcguire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a lot... and I won't be able to review it all, for the communication part @evoggy is probably the best.

Maybe we need to do release testing width for the size of this PR

@@ -0,0 +1,5 @@
CONFIG_MOTORS_ESC_PROTOCOL_DSHOT=y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the configfile is called cfbl_defconfig eventhough the platform calls it cf21b. Should we try to uniform it somehow?

@@ -95,6 +95,26 @@
#define MOTORS_BL_PWM_PERIOD MOTORS_BL_PWM_CNT_FOR_PERIOD
#define MOTORS_BL_PWM_PRESCALE (uint16_t)(MOTORS_BL_PWM_PRESCALE_RAW - 1)
#define MOTORS_BL_POLARITY TIM_OCPolarity_Low
#elif defined(CONFIG_MOTORS_ESC_PROTOCOL_DSHOT)
/**
* *VARNING* Make sure the brushless driver is configured correctly as on the Crazyflie with normal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: Warning

src/drivers/interface/motors.h Outdated Show resolved Hide resolved
src/hal/src/usbd_desc.c Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants