Bebop/BLDC

From PaparazziUAV
Revision as of 15:55, 16 November 2014 by Fvantienen (talk | contribs) (Created page with "== General == The BLDC of the Bebop is the Brushless Driver Controller that controls all 4 brushless motors from the Bebop. This BLDC contains a closed loop RPM controller, an...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

General

The BLDC of the Bebop is the Brushless Driver Controller that controls all 4 brushless motors from the Bebop. This BLDC contains a closed loop RPM controller, and also reads out the battery voltage.

Protocol

  • 0x02 SET_REF_SPEED
  • 0x20 GET_OBS_DATA
  • 0x40 START_PROP
  • 0x4D TOGGLE_GPIO
  • 0x60 STOP_PROP
  • 0x80 CLEAR_ERROR
  • 0x82 PLAY_SOUND
  • 0xA0 GET_INFO

SET_REF_SPEED (0x02)

Arguments: 9 bytes

  • 0-1: RPM reference Left Front motor (uint16)
  • 2-3: RPM reference Right Front motor (uint16)
  • 4-5: RPM reference Right Back motor (uint16)
  • 6-7: RPM reference Left Back motor (uint16)
  • 8: Reserved (0x00)

GET_OBS_DATA (0x20)

Arguments: 0 bytes Receive: 8 bytes or 13 bytes

  • 0-1: RPM observed Left Front motor (uint16)*
  • 2-3: RPM observed Right Front motor (uint16)*
  • 4-5: RPM observed Right Back motor (uint16)*
  • 6-7: RPM observed Left Back motor (uint16)*
  • 8-9: Battery voltage in mV (uint16)
  • 10: Status (uint8)
  • 11: Errno (uint8)
  • 12: Temperature in degrees Celcius (uint8)

* Bit 15 is reserved for detecting maximum RPM (depending on voltage and altitude)

START_PROP (0x40)

Arguments: 0 bytes or 1 byte

  • 0: Motor bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is clockwise and 0 is counterclockwise

Receive: 0 bytes

TOGGLE_GPIO (0x4D)

Arguments: 1 byte

  • 0: GPIO bitmask (bit 0: Reset, bit 1: Red LED, bit 2: Green LED)

Receive: 0 bytes

STOP_PROP (0x60)

Arguments: 0 bytes Receive: 0 bytes

CLEAR_ERROR (0x80)

Arguments: 0 bytes Receive: 0 bytes

PLAY_SOUND (0x82)

Arguments: 1 byte

  • 0: Sound number (0: None, 1: Short beep, 2: Boot beep, 3: Be-Bop-Ah-Lula, negative: repeat)

Receive: 0 bytes

GET_INFO (0xA0)

Arguments: 0 bytes Receive: 4 bytes or 13 bytes

  • 0: Software version (major)
  • 1: Software version (minor)
  • 2: Software type
  • 3: Number of motors
  • 4-5: Number of flights (uint16)
  • 4-5: Time last flight (uint16)
  • 6-9: Full flight time (uint32)
  • 10: Last error code

Checksum

For all the packets with arguments or where we receive bytes there is a checksum byte at the end. This checksum is a simple XOR algorithm including the first command byte.

checksum = CMD_BYTE;
for(int i = 0; i < packet_size; i++)
   checksum = checksum ^ packet[i];