[SOLVED] Crazyflie2.0 PWM setup to drive BRUSHLESS MOTOR

Post here to get support
Post Reply
Tia
Beginner
Posts: 4
Joined: Thu May 14, 2020 1:27 pm

[SOLVED] Crazyflie2.0 PWM setup to drive BRUSHLESS MOTOR

Post by Tia »

Hi, :D :D :D

I am wandering how to generate proper PWM signals (also ONESHOT125 needed) from Default connectors on my CF2.0 ,so that i can use external ESCs to drive Brushless Motor.

Since i'm not that into the DRIVER CODES in VM ,i need someone to help me with the configrations. Just tell me the key points ,ill try myself. Many thanks~ !
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Crazyflie2.0 PWM setup to drive BRUSHLESS MOTOR

Post by tobias »

In the motors_def_cf2.c there are configurations for this.

Code: Select all

/**
 * Brushless motors mapped to the standard motor connectors with pull-ups (~1K) to VBAT soldered.
 */
const MotorPerifDef* motorMapDefaltConBrushless[NBR_OF_MOTORS] =
{
  &CONN_M1_BL_INV,
  &CONN_M2_BL_INV,
  &CONN_M3_BL_INV,
  &CONN_M4_BL_INV
};
So in platform_cf2.c you should change the motor map.

Code: Select all

  {
    .deviceType = "CF20",
    .deviceTypeName = "Crazyflie 2.0",
    .sensorImplementation = SensorImplementation_mpu9250_lps25h,
    .physicalLayoutAntennasAreClose = true,
    .motorMap = motorMapDefaltConBrushless,
  },
Hopefully this works out of the box. Remember you have to solder pull-ups (~1k) to VBAT.
Tia
Beginner
Posts: 4
Joined: Thu May 14, 2020 1:27 pm

Re: Crazyflie2.0 PWM setup to drive BRUSHLESS MOTOR

Post by Tia »

yes, I get it.It really helps,thank you very much ~!
Tia
Beginner
Posts: 4
Joined: Thu May 14, 2020 1:27 pm

Re: Crazyflie2.0 PWM setup to drive BRUSHLESS MOTOR

Post by Tia »

tobias wrote: Fri May 15, 2020 8:22 am In the motors_def_cf2.c there are configurations for this.

Code: Select all

/**
 * Brushless motors mapped to the standard motor connectors with pull-ups (~1K) to VBAT soldered.
 */
const MotorPerifDef* motorMapDefaltConBrushless[NBR_OF_MOTORS] =
{
  &CONN_M1_BL_INV,
  &CONN_M2_BL_INV,
  &CONN_M3_BL_INV,
  &CONN_M4_BL_INV
};
So in platform_cf2.c you should change the motor map.

Code: Select all

  {
    .deviceType = "CF20",
    .deviceTypeName = "Crazyflie 2.0",
    .sensorImplementation = SensorImplementation_mpu9250_lps25h,
    .physicalLayoutAntennasAreClose = true,
    .motorMap = motorMapDefaltConBrushless,
  },
Hopefully this works out of the box. Remember you have to solder pull-ups (~1k) to VBAT.
hi:
Here i have get the method above tested. "MotorMap equals to 'motorMapDefaltConBrushless' and project codes are biuld with no error lists.However it comes with one problem while flashing hex files into the CF2.0 through J-link,as picture shows:
20200518215401.png
20200518213545.png
Those ‘zeros’ are strange, does it mean oversize of the program?

By the way ,my vm is up to date and if i config back to "default brushed motor"、biuld the project 、get hex file flashed, no error occurs with flashing. Did i miss anything somewhere?
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Crazyflie2.0 PWM setup to drive BRUSHLESS MOTOR

Post by tobias »

I tested building a cload build and flash it with the wireless bootloader and it works for me. I don't see how that change would effect anything other then a pointer value.
Tia
Beginner
Posts: 4
Joined: Thu May 14, 2020 1:27 pm

Re: Crazyflie2.0 PWM setup to drive BRUSHLESS MOTOR

Post by Tia »

tobias wrote: Tue May 19, 2020 6:31 am I tested building a cload build and flash it with the wireless bootloader and it works for me. I don't see how that change would effect anything other then a pointer value.
Yes,i referred to help docs in vm and tried (a similar way of yours ) to use ST-link to flash direct in local terminal. Finally it works and system log shows "use brushless motor "like words. Thanks very much for your guidance. :D :D :D
20200520202855.png
Post Reply