Page 1 of 1

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

Posted: Thu May 14, 2020 2:12 pm
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~ !

Re: Crazyflie2.0 PWM setup to drive BRUSHLESS MOTOR

Posted: Fri May 15, 2020 8:22 am
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.

Re: Crazyflie2.0 PWM setup to drive BRUSHLESS MOTOR

Posted: Fri May 15, 2020 10:44 am
by Tia
yes, I get it.It really helps,thank you very much ~!

Re: Crazyflie2.0 PWM setup to drive BRUSHLESS MOTOR

Posted: Tue May 19, 2020 12:26 am
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?

Re: Crazyflie2.0 PWM setup to drive BRUSHLESS MOTOR

Posted: Tue May 19, 2020 6:31 am
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.

Re: Crazyflie2.0 PWM setup to drive BRUSHLESS MOTOR

Posted: Wed May 20, 2020 12:55 pm
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