http://wiki.paparazziuav.org/w/api.php?action=feedcontributions&user=QQ&feedformat=atomPaparazziUAV - User contributions [en]2024-03-29T08:34:59ZUser contributionsMediaWiki 1.37.1http://wiki.paparazziuav.org/w/index.php?title=Bebop/BLDC&diff=19473Bebop/BLDC2015-02-06T00:17:44Z<p>QQ: Add important informations. Fixed missing bytes</p>
<hr />
<div>== General ==<br />
The BLDC of the Bebop is the Brushless Driver Controller that controls all 4 brushless motors from the Bebop. Motors are 12 permanent magnets. This BLDC contains a closed loop Rotation Per Minute (RPM) controller, and also reads out the battery voltage.<br />
<br />
== Default LED behavior ==<br />
* Green LED blinking: bootloader mode.<br />
* Green LED fixed: nominal mode.<br />
* Red LED blinking: critical mode (error code: 10 or 11)<br />
* Orange LED fixed: minor error detected.<br />
<br />
== Sounds signification ==<br />
* Each motor makes a single tone after a successful init of the firmware.<br />
* No sound after the init: critical failure detected during the init.<br />
* All motors tone in infinite loop after a error detection. Use the command CLEAR_ERROR or PLAY_SOUND 0 for stopping.<br />
<br />
== BLDC Protocol ==<br />
BLDC is an i2c slave device. Its 7-bits slave address is 0x08.<br />
* 0x02 SET_REF_SPEED<br />
* 0x20 GET_OBS_DATA<br />
* 0x40 START_PROP<br />
* 0x4D TOGGLE_GPIO<br />
* 0x60 STOP_PROP<br />
* 0x80 CLEAR_ERROR<br />
* 0x82 PLAY_SOUND<br />
* 0xA0 GET_INFO<br />
<br />
=== START_PROP (0x40) ===<br />
Starts all propellers. The propellers will not start when the current error is not cleared. Motors ramp together, spin together, stop together. It's not possible to spin motors separately.<br />
<br />
Optional argument:1 byte<br />
* 0: Motor bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is clockwise and 0 is counterclockwise<br />
Receive: 0 byte<br />
<br />
=== SET_REF_SPEED (0x02) ===<br />
Sets the RPM reference of the motors. This request is ignored while START_PROP has not been sent and accepted.<br />
<br />
Arguments: 10 bytes<br />
* 0-1: RPM reference Left Front motor (uint16)<br />
* 2-3: RPM reference Right Front motor (uint16)<br />
* 4-5: RPM reference Right Back motor (uint16)<br />
* 6-7: RPM reference Left Back motor (uint16)<br />
* 8: Reserved (0x00)<br />
* 9: Checksum (see section bellow)<br />
Receive: 0 byte<br />
<br />
=== GET_OBS_DATA (0x20) ===<br />
Gets the observed data from the motors and battery.<br />
<br />
Arguments: 0 byte<br />
<br />
Receive: 15 bytes<br />
* 0-1: RPM observed Left Front motor (uint16)*<br />
* 2-3: RPM observed Right Front motor (uint16)*<br />
* 4-5: RPM observed Right Back motor (uint16)*<br />
* 6-7: RPM observed Left Back motor (uint16)*<br />
* 8-9: Battery voltage in mV (uint16)<br />
* 10: Status (uint8)<br />
* 11: Errno (uint8)<br />
* 12: bitmask of motors in fault (uint8)<br />
* 13: Temperature in degrees Celcius (uint8)<br />
* 14: Checksum (see section below)<br />
<nowiki />* Bit 15 is reserved for detecting maximum RPM (depending on voltage and altitude)<br />
<br />
==== Status ====<br />
is the combination of two uint4 words:<br />
* The first uint4 saves the state of the system state machine when an error occurred.<br />
* The second uint4 indicates the current state of the system state machine.<br />
<br />
Values of the state machine are:<br />
* 0: Init system<br />
* 1: System in idle (waiting for the START_PROP command)<br />
* 2: Ramping motors<br />
* 3/4: Spinning motors<br />
* 5: Stopping motors<br />
* 6: System aborted (critical error)<br />
<br />
==== Errno ====<br />
Error values are set in order of importance: if two errors occurred, the most important error smashes the less important.<br />
* 0: No error<br />
* 1: EEPROM corruption<br />
* 2: Motor stalled*<br />
* 3: Propeller security*<br />
* 4: Communication lost<br />
* 9: Battery voltage too low<br />
* 10: Incorrect number of LIPO cells<br />
* 11: Unplugged motor or broken motor phase or defectuous MOS*<br />
<nowiki />* Impacted motors information is given in byte12 as bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is fault and 0 is no fault.<br />
<br />
=== TOGGLE_GPIO (0x4D) ===<br />
Toggle GPIO outputs. The reset will put the BLDC into bootloader mode.<br />
<br />
Arguments: 1 byte<br />
* 0: GPIO bitmask (bit 0: Reset, bit 1: Red LED, bit 2: Green LED)<br />
Receive: 0 bytes<br />
<br />
=== STOP_PROP (0x60) ===<br />
Stop the propellers when turning.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== CLEAR_ERROR (0x80) ===<br />
Clear the current error.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== PLAY_SOUND (0x82) ===<br />
Play a sound. A negative number will loop the sound.<br />
<br />
Arguments: 1 byte<br />
* 0: Sound number (0: None, 1: Short beep, 2: Boot beep, 3: Be-Bop-Ah-Lula, negative: repeat) (int8)<br />
Receive: 0 bytes<br />
<br />
=== GET_INFO (0xA0) ===<br />
Get information about the BLDC.<br />
<br />
Arguments: 0 bytes<br />
Receive: 4 bytes or 13 bytes<br />
* 0: Software version (major)<br />
* 1: Software version (minor)<br />
* 2: Software type (ascii code)<br />
* 3: Number of motors controlled<br />
* 4-5: Number of flights (uint16)<br />
* 4-5: Time last flight (uint16)<br />
* 6-9: Full flight time (uint32)<br />
* 10: Last error code<br />
<br />
== Checksum ==<br />
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.<br />
<source lang="c"><br />
// Credits to Christophe De Wagter for figuring out the Checksum<br />
checksum = CMD_BYTE;<br />
for(int i = 0; i < packet_size; i++)<br />
checksum = checksum ^ packet[i];<br />
</source><br />
<br />
== Bootloader Protocol ==<br />
When the chip is powered on or reseted, the bootloader is started. Green LED is blinking. See the Cypress bootloader protocol documentation AN60317 or use the embedded tool BLDC_Host_Bootloader for flashing a new firmware or leaving the bootloader mode and launching the applicative firmware. Use the PSoC Creator 2.2 (or a more recent version) for creating your own cyacd files. Compile your bootloadable (applicative) project with the hex and elf files of the bootloader project (not given). Use the Miniprog3 for flashing your own bootloader application.<br />
<br />
=== BLDC_Host_Bootloader === <br />
Optional arguments: new_firmware.cyacd backup_firmware.cyacd<br />
<br />
Default behavior when no arguments are given:<br />
* new_firmware.cyacd is /lib/firmware/BLDC.cyacd<br />
* backup_firmware.cyacd is /lib/firmware/.BLDC.cyacd<br />
<br />
Behavior:<br />
If new_firmware.cyacd is present it will used to be flashed in the microcontroler. Once successfully flashed, the file will be renamed into backup_firmware.cycad. Backup file is used for fixing firmware flash corruption or restoring firmware after a flashling failure with (incorrect firmware, process aborted, etc).<br />
<br />
If new_firmware.cyacd is not present: nothing to flash. The bootloader will quit and launch the applicative firmware.<br />
<br />
Applicative firmware is launched if and only if no flash corruptions have been found, else the bootloader never leaves.<br />
<br />
=== Reseting the chip ===<br />
Toggle the \xres io will get the chip reseted and forced it to jump in bootloader mode.<br />
<source lang="c"><br />
echo 1 > /sys/class/gpio/gpio199<br />
echo 0 > /sys/class/gpio/gpio199<br />
</source><br />
<br />
== BLDC Test Bench ==<br />
This tool is used for testing motors with different kind of velocity reference inputs. Kill the Bebop software before calling it. Use the -h for displaying the help.<br />
Cvs file is created in /tmp and can be post processed with [http://www.scicoslab.org Scilab].<br />
<br />
Note: due to memory usage limitation in the microcontroler, motor settings and velocity regulator settings cannot be changed or read.</div>QQhttp://wiki.paparazziuav.org/w/index.php?title=Bebop/BLDC&diff=19472Bebop/BLDC2015-02-05T22:53:33Z<p>QQ: Add sound meanings</p>
<hr />
<div>== General ==<br />
The BLDC of the Bebop is the Brushless Driver Controller that controls all 4 brushless motors from the Bebop. Motors are 12 permanent magnets. This BLDC contains a closed loop Rotation Per Minute (RPM) controller, and also reads out the battery voltage.<br />
<br />
== Default LED behavior ==<br />
* Green LED blinking: bootloader mode.<br />
* Green LED fixed: nominal mode.<br />
* Red LED blinking: critical mode (error code: 10 or 11)<br />
* Orange LED fixed: minor error detected.<br />
<br />
== Sounds signification ==<br />
* Each motor makes a single tone after a successful init of the firmware.<br />
* No sound after the init: critical failure detected during the init.<br />
* All motors tone in infinite loop after a error detection. Use the command CLEAR_ERROR or PLAY_SOUND 0 for stopping.<br />
<br />
== BLDC Protocol ==<br />
* 0x02 SET_REF_SPEED<br />
* 0x20 GET_OBS_DATA<br />
* 0x40 START_PROP<br />
* 0x4D TOGGLE_GPIO<br />
* 0x60 STOP_PROP<br />
* 0x80 CLEAR_ERROR<br />
* 0x82 PLAY_SOUND<br />
* 0xA0 GET_INFO<br />
<br />
=== SET_REF_SPEED (0x02) ===<br />
Sets the RPM reference of the motors.<br />
<br />
Arguments: 10 bytes<br />
* 0-1: RPM reference Left Front motor (uint16)<br />
* 2-3: RPM reference Right Front motor (uint16)<br />
* 4-5: RPM reference Right Back motor (uint16)<br />
* 6-7: RPM reference Left Back motor (uint16)<br />
* 8: Reserved (0x00)<br />
* 9: Checksum (see section bellow)<br />
<br />
=== GET_OBS_DATA (0x20) ===<br />
Gets the observed data from the motors and battery.<br />
<br />
Arguments: 0 byte<br />
Receive: 14 bytes<br />
* 0-1: RPM observed Left Front motor (uint16)*<br />
* 2-3: RPM observed Right Front motor (uint16)*<br />
* 4-5: RPM observed Right Back motor (uint16)*<br />
* 6-7: RPM observed Left Back motor (uint16)*<br />
* 8-9: Battery voltage in mV (uint16)<br />
* 10: Status (uint8)<br />
* 11: Errno (uint8)<br />
* 12: Temperature in degrees Celcius (uint8)<br />
* 13: Checksum (see section below)<br />
<nowiki />* Bit 15 is reserved for detecting maximum RPM (depending on voltage and altitude)<br />
<br />
==== Status ====<br />
* 0: Init<br />
* 1: Idle<br />
* 2: Ramping<br />
* 3/4: Spinning<br />
* 5: Stopping<br />
* 6: Suicided<br />
<br />
==== Errno ====<br />
* 0: No error<br />
* 1: EEPROM corruption<br />
* 2: Motor stalled<br />
* 3: Propeller security<br />
* 4: Communication lost<br />
* 9: Battery voltage too low<br />
* 10: Incorrect number of LIPO cells<br />
* 11: Unplugged motor or broken motor phase or defectuous MOS<br />
<br />
=== START_PROP (0x40) ===<br />
Starts the propellers. The propellers will not start when the current error is not cleared.<br />
<br />
Optional argument:1 byte<br />
* 0: Motor bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is clockwise and 0 is counterclockwise<br />
Receive: 0 byte<br />
<br />
=== TOGGLE_GPIO (0x4D) ===<br />
Toggle GPIO outputs. The reset will put the BLDC into bootloader mode.<br />
<br />
Arguments: 1 byte<br />
* 0: GPIO bitmask (bit 0: Reset, bit 1: Red LED, bit 2: Green LED)<br />
Receive: 0 bytes<br />
<br />
=== STOP_PROP (0x60) ===<br />
Stop the propellers when turning.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== CLEAR_ERROR (0x80) ===<br />
Clear the current error.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== PLAY_SOUND (0x82) ===<br />
Play a sound. A negative number will loop the sound.<br />
<br />
Arguments: 1 byte<br />
* 0: Sound number (0: None, 1: Short beep, 2: Boot beep, 3: Be-Bop-Ah-Lula, negative: repeat) (int8)<br />
Receive: 0 bytes<br />
<br />
=== GET_INFO (0xA0) ===<br />
Get information about the BLDC.<br />
<br />
Arguments: 0 bytes<br />
Receive: 4 bytes or 13 bytes<br />
* 0: Software version (major)<br />
* 1: Software version (minor)<br />
* 2: Software type<br />
* 3: Number of motors<br />
* 4-5: Number of flights (uint16)<br />
* 4-5: Time last flight (uint16)<br />
* 6-9: Full flight time (uint32)<br />
* 10: Last error code<br />
<br />
== Checksum ==<br />
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.<br />
<source lang="c"><br />
// Credits to Christophe De Wagter for figuring out the Checksum<br />
checksum = CMD_BYTE;<br />
for(int i = 0; i < packet_size; i++)<br />
checksum = checksum ^ packet[i];<br />
</source><br />
<br />
== Bootloader Protocol ==<br />
When the chip is powered on or reseted, the bootloader is started. Green LED is blinking. See the Cypress bootloader protocol documentation AN60317 or use the embedded tool BLDC_Host_Bootloader for flashing a new firmware or leaving the bootloader mode and launching the applicative firmware. Use the PSoC Creator 2.2 (or a more recent version) for creating your own cyacd files. Compile your bootloadable (applicative) project with the hex and elf files of the bootloader project (not given). Use the Miniprog3 for flashing your own bootloader application.<br />
<br />
=== BLDC_Host_Bootloader === <br />
Optional arguments: new_firmware.cyacd backup_firmware.cyacd<br />
<br />
Default behavior when no arguments are given:<br />
* new_firmware.cyacd is /lib/firmware/BLDC.cyacd<br />
* backup_firmware.cyacd is /lib/firmware/.BLDC.cyacd<br />
<br />
Behavior:<br />
If new_firmware.cyacd is present it will used to be flashed in the microcontroler. Once successfully flashed, the file will be renamed into backup_firmware.cycad. Backup file is used for fixing firmware flash corruption or restoring firmware after a flashling failure with (incorrect firmware, process aborted, etc).<br />
<br />
If new_firmware.cyacd is not present: nothing to flash. The bootloader will quit and launch the applicative firmware.<br />
<br />
Applicative firmware is launched if and only if no flash corruptions have been found, else the bootloader never leaves.<br />
<br />
=== Reseting the chip ===<br />
Toggle the \xres io will get the chip reseted and forced it to jump in bootloader mode.<br />
<source lang="c"><br />
echo 1 > /sys/class/gpio/gpio199<br />
echo 0 > /sys/class/gpio/gpio199<br />
</source><br />
<br />
== BLDC Test Bench ==<br />
This tool is used for testing motors with different kind of velocity reference inputs. Kill the Bebop software before calling it. Use the -h for displaying the help.<br />
Cvs file is created in /tmp and can be post processed with [http://www.scicoslab.org Scilab].<br />
<br />
Note: due to memory usage limitation in the microcontroler, motor settings and velocity regulator settings cannot be changed or read.</div>QQhttp://wiki.paparazziuav.org/w/index.php?title=Bebop/BLDC&diff=19471Bebop/BLDC2015-02-05T22:32:11Z<p>QQ: Change the link</p>
<hr />
<div>== General ==<br />
The BLDC of the Bebop is the Brushless Driver Controller that controls all 4 brushless motors from the Bebop. Motors are 12 permanent magnets. This BLDC contains a closed loop Rotation Per Minute (RPM) controller, and also reads out the battery voltage.<br />
<br />
== Default LED behavior ==<br />
* Green LED blinking: bootloader mode.<br />
* Green LED fixed: nominal mode.<br />
* Red LED blinking: critical mode (error code: 10 or 11)<br />
* Orange LED fixed: minor error detected.<br />
<br />
== BLDC Protocol ==<br />
* 0x02 SET_REF_SPEED<br />
* 0x20 GET_OBS_DATA<br />
* 0x40 START_PROP<br />
* 0x4D TOGGLE_GPIO<br />
* 0x60 STOP_PROP<br />
* 0x80 CLEAR_ERROR<br />
* 0x82 PLAY_SOUND<br />
* 0xA0 GET_INFO<br />
<br />
=== SET_REF_SPEED (0x02) ===<br />
Sets the RPM reference of the motors.<br />
<br />
Arguments: 10 bytes<br />
* 0-1: RPM reference Left Front motor (uint16)<br />
* 2-3: RPM reference Right Front motor (uint16)<br />
* 4-5: RPM reference Right Back motor (uint16)<br />
* 6-7: RPM reference Left Back motor (uint16)<br />
* 8: Reserved (0x00)<br />
* 9: Checksum (see section bellow)<br />
<br />
=== GET_OBS_DATA (0x20) ===<br />
Gets the observed data from the motors and battery.<br />
<br />
Arguments: 0 byte<br />
Receive: 14 bytes<br />
* 0-1: RPM observed Left Front motor (uint16)*<br />
* 2-3: RPM observed Right Front motor (uint16)*<br />
* 4-5: RPM observed Right Back motor (uint16)*<br />
* 6-7: RPM observed Left Back motor (uint16)*<br />
* 8-9: Battery voltage in mV (uint16)<br />
* 10: Status (uint8)<br />
* 11: Errno (uint8)<br />
* 12: Temperature in degrees Celcius (uint8)<br />
* 13: Checksum (see section below)<br />
<nowiki />* Bit 15 is reserved for detecting maximum RPM (depending on voltage and altitude)<br />
<br />
==== Status ====<br />
* 0: Init<br />
* 1: Idle<br />
* 2: Ramping<br />
* 3/4: Spinning<br />
* 5: Stopping<br />
* 6: Suicided<br />
<br />
==== Errno ====<br />
* 0: No error<br />
* 1: EEPROM corruption<br />
* 2: Motor stalled<br />
* 3: Propeller security<br />
* 4: Communication lost<br />
* 9: Battery voltage too low<br />
* 10: Incorrect number of LIPO cells<br />
* 11: Unplugged motor or broken motor phase or defectuous MOS<br />
<br />
=== START_PROP (0x40) ===<br />
Starts the propellers. The propellers will not start when the current error is not cleared.<br />
<br />
Optional argument:1 byte<br />
* 0: Motor bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is clockwise and 0 is counterclockwise<br />
Receive: 0 byte<br />
<br />
=== TOGGLE_GPIO (0x4D) ===<br />
Toggle GPIO outputs. The reset will put the BLDC into bootloader mode.<br />
<br />
Arguments: 1 byte<br />
* 0: GPIO bitmask (bit 0: Reset, bit 1: Red LED, bit 2: Green LED)<br />
Receive: 0 bytes<br />
<br />
=== STOP_PROP (0x60) ===<br />
Stop the propellers when turning.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== CLEAR_ERROR (0x80) ===<br />
Clear the current error.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== PLAY_SOUND (0x82) ===<br />
Play a sound. A negative number will loop the sound.<br />
<br />
Arguments: 1 byte<br />
* 0: Sound number (0: None, 1: Short beep, 2: Boot beep, 3: Be-Bop-Ah-Lula, negative: repeat) (int8)<br />
Receive: 0 bytes<br />
<br />
=== GET_INFO (0xA0) ===<br />
Get information about the BLDC.<br />
<br />
Arguments: 0 bytes<br />
Receive: 4 bytes or 13 bytes<br />
* 0: Software version (major)<br />
* 1: Software version (minor)<br />
* 2: Software type<br />
* 3: Number of motors<br />
* 4-5: Number of flights (uint16)<br />
* 4-5: Time last flight (uint16)<br />
* 6-9: Full flight time (uint32)<br />
* 10: Last error code<br />
<br />
== Checksum ==<br />
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.<br />
<source lang="c"><br />
// Credits to Christophe De Wagter for figuring out the Checksum<br />
checksum = CMD_BYTE;<br />
for(int i = 0; i < packet_size; i++)<br />
checksum = checksum ^ packet[i];<br />
</source><br />
<br />
== Bootloader Protocol ==<br />
When the chip is powered on or reseted, the bootloader is started. Green LED is blinking. See the Cypress bootloader protocol documentation AN60317 or use the embedded tool BLDC_Host_Bootloader for flashing a new firmware or leaving the bootloader mode and launching the applicative firmware. Use the PSoC Creator 2.2 (or a more recent version) for creating your own cyacd files. Compile your bootloadable (applicative) project with the hex and elf files of the bootloader project (not given). Use the Miniprog3 for flashing your own bootloader application.<br />
<br />
=== BLDC_Host_Bootloader === <br />
Optional arguments: new_firmware.cyacd backup_firmware.cyacd<br />
<br />
Default behavior when no arguments are given:<br />
* new_firmware.cyacd is /lib/firmware/BLDC.cyacd<br />
* backup_firmware.cyacd is /lib/firmware/.BLDC.cyacd<br />
<br />
Behavior:<br />
If new_firmware.cyacd is present it will used to be flashed in the microcontroler. Once successfully flashed, the file will be renamed into backup_firmware.cycad. Backup file is used for fixing firmware flash corruption or restoring firmware after a flashling failure with (incorrect firmware, process aborted, etc).<br />
<br />
If new_firmware.cyacd is not present: nothing to flash. The bootloader will quit and launch the applicative firmware.<br />
<br />
Applicative firmware is launched if and only if no flash corruptions have been found, else the bootloader never leaves.<br />
<br />
=== Reseting the chip ===<br />
Toggle the \xres io will get the chip reseted and forced it to jump in bootloader mode.<br />
<source lang="c"><br />
echo 1 > /sys/class/gpio/gpio199<br />
echo 0 > /sys/class/gpio/gpio199<br />
</source><br />
<br />
== BLDC Test Bench ==<br />
This tool is used for testing motors with different kind of velocity reference inputs. Kill the Bebop software before calling it. Use the -h for displaying the help.<br />
Cvs file is created in /tmp and can be post processed with [http://www.scicoslab.org Scilab].<br />
<br />
Note: due to memory usage limitation in the microcontroler, motor settings and velocity regulator settings cannot be changed or read.</div>QQhttp://wiki.paparazziuav.org/w/index.php?title=Bebop/BLDC&diff=19470Bebop/BLDC2015-02-05T22:29:22Z<p>QQ: /* BLDC Test Bench */</p>
<hr />
<div>== General ==<br />
The BLDC of the Bebop is the Brushless Driver Controller that controls all 4 brushless motors from the Bebop. Motors are 12 permanent magnets. This BLDC contains a closed loop Rotation Per Minute (RPM) controller, and also reads out the battery voltage.<br />
<br />
== Default LED behavior ==<br />
* Green LED blinking: bootloader mode.<br />
* Green LED fixed: nominal mode.<br />
* Red LED blinking: critical mode (error code: 10 or 11)<br />
* Orange LED fixed: minor error detected.<br />
<br />
== BLDC Protocol ==<br />
* 0x02 SET_REF_SPEED<br />
* 0x20 GET_OBS_DATA<br />
* 0x40 START_PROP<br />
* 0x4D TOGGLE_GPIO<br />
* 0x60 STOP_PROP<br />
* 0x80 CLEAR_ERROR<br />
* 0x82 PLAY_SOUND<br />
* 0xA0 GET_INFO<br />
<br />
=== SET_REF_SPEED (0x02) ===<br />
Sets the RPM reference of the motors.<br />
<br />
Arguments: 10 bytes<br />
* 0-1: RPM reference Left Front motor (uint16)<br />
* 2-3: RPM reference Right Front motor (uint16)<br />
* 4-5: RPM reference Right Back motor (uint16)<br />
* 6-7: RPM reference Left Back motor (uint16)<br />
* 8: Reserved (0x00)<br />
* 9: Checksum (see section bellow)<br />
<br />
=== GET_OBS_DATA (0x20) ===<br />
Gets the observed data from the motors and battery.<br />
<br />
Arguments: 0 byte<br />
Receive: 14 bytes<br />
* 0-1: RPM observed Left Front motor (uint16)*<br />
* 2-3: RPM observed Right Front motor (uint16)*<br />
* 4-5: RPM observed Right Back motor (uint16)*<br />
* 6-7: RPM observed Left Back motor (uint16)*<br />
* 8-9: Battery voltage in mV (uint16)<br />
* 10: Status (uint8)<br />
* 11: Errno (uint8)<br />
* 12: Temperature in degrees Celcius (uint8)<br />
* 13: Checksum (see section below)<br />
<nowiki />* Bit 15 is reserved for detecting maximum RPM (depending on voltage and altitude)<br />
<br />
==== Status ====<br />
* 0: Init<br />
* 1: Idle<br />
* 2: Ramping<br />
* 3/4: Spinning<br />
* 5: Stopping<br />
* 6: Suicided<br />
<br />
==== Errno ====<br />
* 0: No error<br />
* 1: EEPROM corruption<br />
* 2: Motor stalled<br />
* 3: Propeller security<br />
* 4: Communication lost<br />
* 9: Battery voltage too low<br />
* 10: Incorrect number of LIPO cells<br />
* 11: Unplugged motor or broken motor phase or defectuous MOS<br />
<br />
=== START_PROP (0x40) ===<br />
Starts the propellers. The propellers will not start when the current error is not cleared.<br />
<br />
Optional argument:1 byte<br />
* 0: Motor bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is clockwise and 0 is counterclockwise<br />
Receive: 0 byte<br />
<br />
=== TOGGLE_GPIO (0x4D) ===<br />
Toggle GPIO outputs. The reset will put the BLDC into bootloader mode.<br />
<br />
Arguments: 1 byte<br />
* 0: GPIO bitmask (bit 0: Reset, bit 1: Red LED, bit 2: Green LED)<br />
Receive: 0 bytes<br />
<br />
=== STOP_PROP (0x60) ===<br />
Stop the propellers when turning.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== CLEAR_ERROR (0x80) ===<br />
Clear the current error.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== PLAY_SOUND (0x82) ===<br />
Play a sound. A negative number will loop the sound.<br />
<br />
Arguments: 1 byte<br />
* 0: Sound number (0: None, 1: Short beep, 2: Boot beep, 3: Be-Bop-Ah-Lula, negative: repeat) (int8)<br />
Receive: 0 bytes<br />
<br />
=== GET_INFO (0xA0) ===<br />
Get information about the BLDC.<br />
<br />
Arguments: 0 bytes<br />
Receive: 4 bytes or 13 bytes<br />
* 0: Software version (major)<br />
* 1: Software version (minor)<br />
* 2: Software type<br />
* 3: Number of motors<br />
* 4-5: Number of flights (uint16)<br />
* 4-5: Time last flight (uint16)<br />
* 6-9: Full flight time (uint32)<br />
* 10: Last error code<br />
<br />
== Checksum ==<br />
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.<br />
<source lang="c"><br />
// Credits to Christophe De Wagter for figuring out the Checksum<br />
checksum = CMD_BYTE;<br />
for(int i = 0; i < packet_size; i++)<br />
checksum = checksum ^ packet[i];<br />
</source><br />
<br />
== Bootloader Protocol ==<br />
When the chip is powered on or reseted, the bootloader is started. Green LED is blinking. See the Cypress bootloader protocol documentation AN60317 or use the embedded tool BLDC_Host_Bootloader for flashing a new firmware or leaving the bootloader mode and launching the applicative firmware. Use the PSoC Creator 2.2 (or a more recent version) for creating your own cyacd files. Compile your bootloadable (applicative) project with the hex and elf files of the bootloader project (not given). Use the Miniprog3 for flashing your own bootloader application.<br />
<br />
=== BLDC_Host_Bootloader === <br />
Optional arguments: new_firmware.cyacd backup_firmware.cyacd<br />
<br />
Default behavior when no arguments are given:<br />
* new_firmware.cyacd is /lib/firmware/BLDC.cyacd<br />
* backup_firmware.cyacd is /lib/firmware/.BLDC.cyacd<br />
<br />
Behavior:<br />
If new_firmware.cyacd is present it will used to be flashed in the microcontroler. Once successfully flashed, the file will be renamed into backup_firmware.cycad. Backup file is used for fixing firmware flash corruption or restoring firmware after a flashling failure with (incorrect firmware, process aborted, etc).<br />
<br />
If new_firmware.cyacd is not present: nothing to flash. The bootloader will quit and launch the applicative firmware.<br />
<br />
Applicative firmware is launched if and only if no flash corruptions have been found, else the bootloader never leaves.<br />
<br />
=== Reseting the chip ===<br />
Toggle the \xres io will get the chip reseted and forced it to jump in bootloader mode.<br />
<source lang="c"><br />
echo 1 > /sys/class/gpio/gpio199<br />
echo 0 > /sys/class/gpio/gpio199<br />
</source><br />
<br />
== BLDC Test Bench ==<br />
This tool is used for testing motors with different kind of velocity reference inputs. Kill the Bebop software before calling it. Use the -h for displaying the help.<br />
Cvs file is created in /tmp and can be post processed with Scilab.<br />
<br />
Note: due to memory usage limitation in the microcontroler, motor settings and velocity regulator settings cannot be changed or read.</div>QQhttp://wiki.paparazziuav.org/w/index.php?title=Bebop/BLDC&diff=19469Bebop/BLDC2015-02-05T22:16:37Z<p>QQ: Add new sections</p>
<hr />
<div>== General ==<br />
The BLDC of the Bebop is the Brushless Driver Controller that controls all 4 brushless motors from the Bebop. Motors are 12 permanent magnets. This BLDC contains a closed loop Rotation Per Minute (RPM) controller, and also reads out the battery voltage.<br />
<br />
== Default LED behavior ==<br />
* Green LED blinking: bootloader mode.<br />
* Green LED fixed: nominal mode.<br />
* Red LED blinking: critical mode (error code: 10 or 11)<br />
* Orange LED fixed: minor error detected.<br />
<br />
== BLDC Protocol ==<br />
* 0x02 SET_REF_SPEED<br />
* 0x20 GET_OBS_DATA<br />
* 0x40 START_PROP<br />
* 0x4D TOGGLE_GPIO<br />
* 0x60 STOP_PROP<br />
* 0x80 CLEAR_ERROR<br />
* 0x82 PLAY_SOUND<br />
* 0xA0 GET_INFO<br />
<br />
=== SET_REF_SPEED (0x02) ===<br />
Sets the RPM reference of the motors.<br />
<br />
Arguments: 10 bytes<br />
* 0-1: RPM reference Left Front motor (uint16)<br />
* 2-3: RPM reference Right Front motor (uint16)<br />
* 4-5: RPM reference Right Back motor (uint16)<br />
* 6-7: RPM reference Left Back motor (uint16)<br />
* 8: Reserved (0x00)<br />
* 9: Checksum (see section bellow)<br />
<br />
=== GET_OBS_DATA (0x20) ===<br />
Gets the observed data from the motors and battery.<br />
<br />
Arguments: 0 byte<br />
Receive: 14 bytes<br />
* 0-1: RPM observed Left Front motor (uint16)*<br />
* 2-3: RPM observed Right Front motor (uint16)*<br />
* 4-5: RPM observed Right Back motor (uint16)*<br />
* 6-7: RPM observed Left Back motor (uint16)*<br />
* 8-9: Battery voltage in mV (uint16)<br />
* 10: Status (uint8)<br />
* 11: Errno (uint8)<br />
* 12: Temperature in degrees Celcius (uint8)<br />
* 13: Checksum (see section below)<br />
<nowiki />* Bit 15 is reserved for detecting maximum RPM (depending on voltage and altitude)<br />
<br />
==== Status ====<br />
* 0: Init<br />
* 1: Idle<br />
* 2: Ramping<br />
* 3/4: Spinning<br />
* 5: Stopping<br />
* 6: Suicided<br />
<br />
==== Errno ====<br />
* 0: No error<br />
* 1: EEPROM corruption<br />
* 2: Motor stalled<br />
* 3: Propeller security<br />
* 4: Communication lost<br />
* 9: Battery voltage too low<br />
* 10: Incorrect number of LIPO cells<br />
* 11: Unplugged motor or broken motor phase or defectuous MOS<br />
<br />
=== START_PROP (0x40) ===<br />
Starts the propellers. The propellers will not start when the current error is not cleared.<br />
<br />
Optional argument:1 byte<br />
* 0: Motor bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is clockwise and 0 is counterclockwise<br />
Receive: 0 byte<br />
<br />
=== TOGGLE_GPIO (0x4D) ===<br />
Toggle GPIO outputs. The reset will put the BLDC into bootloader mode.<br />
<br />
Arguments: 1 byte<br />
* 0: GPIO bitmask (bit 0: Reset, bit 1: Red LED, bit 2: Green LED)<br />
Receive: 0 bytes<br />
<br />
=== STOP_PROP (0x60) ===<br />
Stop the propellers when turning.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== CLEAR_ERROR (0x80) ===<br />
Clear the current error.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== PLAY_SOUND (0x82) ===<br />
Play a sound. A negative number will loop the sound.<br />
<br />
Arguments: 1 byte<br />
* 0: Sound number (0: None, 1: Short beep, 2: Boot beep, 3: Be-Bop-Ah-Lula, negative: repeat) (int8)<br />
Receive: 0 bytes<br />
<br />
=== GET_INFO (0xA0) ===<br />
Get information about the BLDC.<br />
<br />
Arguments: 0 bytes<br />
Receive: 4 bytes or 13 bytes<br />
* 0: Software version (major)<br />
* 1: Software version (minor)<br />
* 2: Software type<br />
* 3: Number of motors<br />
* 4-5: Number of flights (uint16)<br />
* 4-5: Time last flight (uint16)<br />
* 6-9: Full flight time (uint32)<br />
* 10: Last error code<br />
<br />
== Checksum ==<br />
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.<br />
<source lang="c"><br />
// Credits to Christophe De Wagter for figuring out the Checksum<br />
checksum = CMD_BYTE;<br />
for(int i = 0; i < packet_size; i++)<br />
checksum = checksum ^ packet[i];<br />
</source><br />
<br />
== Bootloader Protocol ==<br />
When the chip is powered on or reseted, the bootloader is started. Green LED is blinking. See the Cypress bootloader protocol documentation AN60317 or use the embedded tool BLDC_Host_Bootloader for flashing a new firmware or leaving the bootloader mode and launching the applicative firmware. Use the PSoC Creator 2.2 (or a more recent version) for creating your own cyacd files. Compile your bootloadable (applicative) project with the hex and elf files of the bootloader project (not given). Use the Miniprog3 for flashing your own bootloader application.<br />
<br />
=== BLDC_Host_Bootloader === <br />
Optional arguments: new_firmware.cyacd backup_firmware.cyacd<br />
<br />
Default behavior when no arguments are given:<br />
* new_firmware.cyacd is /lib/firmware/BLDC.cyacd<br />
* backup_firmware.cyacd is /lib/firmware/.BLDC.cyacd<br />
<br />
Behavior:<br />
If new_firmware.cyacd is present it will used to be flashed in the microcontroler. Once successfully flashed, the file will be renamed into backup_firmware.cycad. Backup file is used for fixing firmware flash corruption or restoring firmware after a flashling failure with (incorrect firmware, process aborted, etc).<br />
<br />
If new_firmware.cyacd is not present: nothing to flash. The bootloader will quit and launch the applicative firmware.<br />
<br />
Applicative firmware is launched if and only if no flash corruptions have been found, else the bootloader never leaves.<br />
<br />
=== Reseting the chip ===<br />
Toggle the \xres io will get the chip reseted and forced it to jump in bootloader mode.<br />
<source lang="c"><br />
echo 1 > /sys/class/gpio/gpio199<br />
echo 0 > /sys/class/gpio/gpio199<br />
</source><br />
<br />
== BLDC Test Bench ==<br />
This tool is used for testing motors with different kind of velocity reference inputs. Kill the Bebop software before calling it. Use the -h for displaying the help. Note: with the released applicative BLDC firmware, motor settings and velocity regulator settings cannot be changed.</div>QQhttp://wiki.paparazziuav.org/w/index.php?title=Bebop/BLDC&diff=19468Bebop/BLDC2015-02-05T20:56:48Z<p>QQ: Change title</p>
<hr />
<div>== General ==<br />
The BLDC of the Bebop is the Brushless Driver Controller that controls all 4 brushless motors from the Bebop. Motors are 12 permanent magnets. This BLDC contains a closed loop Rotation Per Minute (RPM) controller, and also reads out the battery voltage.<br />
<br />
== BLDC Protocol ==<br />
* 0x02 SET_REF_SPEED<br />
* 0x20 GET_OBS_DATA<br />
* 0x40 START_PROP<br />
* 0x4D TOGGLE_GPIO<br />
* 0x60 STOP_PROP<br />
* 0x80 CLEAR_ERROR<br />
* 0x82 PLAY_SOUND<br />
* 0xA0 GET_INFO<br />
<br />
=== SET_REF_SPEED (0x02) ===<br />
Sets the RPM reference of the motors.<br />
<br />
Arguments: 10 bytes<br />
* 0-1: RPM reference Left Front motor (uint16)<br />
* 2-3: RPM reference Right Front motor (uint16)<br />
* 4-5: RPM reference Right Back motor (uint16)<br />
* 6-7: RPM reference Left Back motor (uint16)<br />
* 8: Reserved (0x00)<br />
* 9: Checksum (see section bellow)<br />
<br />
=== GET_OBS_DATA (0x20) ===<br />
Gets the observed data from the motors and battery.<br />
<br />
Arguments: 0 byte<br />
Receive: 14 bytes<br />
* 0-1: RPM observed Left Front motor (uint16)*<br />
* 2-3: RPM observed Right Front motor (uint16)*<br />
* 4-5: RPM observed Right Back motor (uint16)*<br />
* 6-7: RPM observed Left Back motor (uint16)*<br />
* 8-9: Battery voltage in mV (uint16)<br />
* 10: Status (uint8)<br />
* 11: Errno (uint8)<br />
* 12: Temperature in degrees Celcius (uint8)<br />
* 13: Checksum (see section below)<br />
<nowiki />* Bit 15 is reserved for detecting maximum RPM (depending on voltage and altitude)<br />
<br />
==== Status ====<br />
* 0: Init<br />
* 1: Idle<br />
* 2: Ramping<br />
* 3/4: Spinning<br />
* 5: Stopping<br />
* 6: Suicided<br />
<br />
==== Errno ====<br />
* 0: No error<br />
* 1: EEPROM corruption<br />
* 2: Motor stalled<br />
* 3: Propeller security<br />
* 4: Communication lost<br />
* 9: Battery voltage too low<br />
* 10: Incorrect number of LIPO cells<br />
* 11: Unplugged motor or broken motor phase or defectuous MOS<br />
<br />
=== START_PROP (0x40) ===<br />
Starts the propellers. The propellers will not start when the current error is not cleared.<br />
<br />
Optional argument:1 byte<br />
* 0: Motor bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is clockwise and 0 is counterclockwise<br />
Receive: 0 byte<br />
<br />
=== TOGGLE_GPIO (0x4D) ===<br />
Toggle GPIO outputs. The reset will put the BLDC into bootloader mode.<br />
<br />
Arguments: 1 byte<br />
* 0: GPIO bitmask (bit 0: Reset, bit 1: Red LED, bit 2: Green LED)<br />
Receive: 0 bytes<br />
<br />
=== STOP_PROP (0x60) ===<br />
Stop the propellers when turning.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== CLEAR_ERROR (0x80) ===<br />
Clear the current error.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== PLAY_SOUND (0x82) ===<br />
Play a sound. A negative number will loop the sound.<br />
<br />
Arguments: 1 byte<br />
* 0: Sound number (0: None, 1: Short beep, 2: Boot beep, 3: Be-Bop-Ah-Lula, negative: repeat) (int8)<br />
Receive: 0 bytes<br />
<br />
=== GET_INFO (0xA0) ===<br />
Get information about the BLDC.<br />
<br />
Arguments: 0 bytes<br />
Receive: 4 bytes or 13 bytes<br />
* 0: Software version (major)<br />
* 1: Software version (minor)<br />
* 2: Software type<br />
* 3: Number of motors<br />
* 4-5: Number of flights (uint16)<br />
* 4-5: Time last flight (uint16)<br />
* 6-9: Full flight time (uint32)<br />
* 10: Last error code<br />
<br />
== Checksum ==<br />
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.<br />
<source lang="c"><br />
// Credits to Christophe De Wagter for figuring out the Checksum<br />
checksum = CMD_BYTE;<br />
for(int i = 0; i < packet_size; i++)<br />
checksum = checksum ^ packet[i];<br />
</source></div>QQhttp://wiki.paparazziuav.org/w/index.php?title=Bebop/BLDC&diff=19467Bebop/BLDC2015-02-05T20:56:13Z<p>QQ: Minor updates</p>
<hr />
<div>== General ==<br />
The BLDC of the Bebop is the Brushless Driver Controller that controls all 4 brushless motors from the Bebop. Motors are 12 permanent magnets. This BLDC contains a closed loop Rotation Per Minute (RPM) controller, and also reads out the battery voltage.<br />
<br />
== Protocol ==<br />
* 0x02 SET_REF_SPEED<br />
* 0x20 GET_OBS_DATA<br />
* 0x40 START_PROP<br />
* 0x4D TOGGLE_GPIO<br />
* 0x60 STOP_PROP<br />
* 0x80 CLEAR_ERROR<br />
* 0x82 PLAY_SOUND<br />
* 0xA0 GET_INFO<br />
<br />
=== SET_REF_SPEED (0x02) ===<br />
Sets the RPM reference of the motors.<br />
<br />
Arguments: 10 bytes<br />
* 0-1: RPM reference Left Front motor (uint16)<br />
* 2-3: RPM reference Right Front motor (uint16)<br />
* 4-5: RPM reference Right Back motor (uint16)<br />
* 6-7: RPM reference Left Back motor (uint16)<br />
* 8: Reserved (0x00)<br />
* 9: Checksum (see section bellow)<br />
<br />
=== GET_OBS_DATA (0x20) ===<br />
Gets the observed data from the motors and battery.<br />
<br />
Arguments: 0 byte<br />
Receive: 14 bytes<br />
* 0-1: RPM observed Left Front motor (uint16)*<br />
* 2-3: RPM observed Right Front motor (uint16)*<br />
* 4-5: RPM observed Right Back motor (uint16)*<br />
* 6-7: RPM observed Left Back motor (uint16)*<br />
* 8-9: Battery voltage in mV (uint16)<br />
* 10: Status (uint8)<br />
* 11: Errno (uint8)<br />
* 12: Temperature in degrees Celcius (uint8)<br />
* 13: Checksum (see section below)<br />
<nowiki />* Bit 15 is reserved for detecting maximum RPM (depending on voltage and altitude)<br />
<br />
==== Status ====<br />
* 0: Init<br />
* 1: Idle<br />
* 2: Ramping<br />
* 3/4: Spinning<br />
* 5: Stopping<br />
* 6: Suicided<br />
<br />
==== Errno ====<br />
* 0: No error<br />
* 1: EEPROM corruption<br />
* 2: Motor stalled<br />
* 3: Propeller security<br />
* 4: Communication lost<br />
* 9: Battery voltage too low<br />
* 10: Incorrect number of LIPO cells<br />
* 11: Unplugged motor or broken motor phase or defectuous MOS<br />
<br />
=== START_PROP (0x40) ===<br />
Starts the propellers. The propellers will not start when the current error is not cleared.<br />
<br />
Optional argument:1 byte<br />
* 0: Motor bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is clockwise and 0 is counterclockwise<br />
Receive: 0 byte<br />
<br />
=== TOGGLE_GPIO (0x4D) ===<br />
Toggle GPIO outputs. The reset will put the BLDC into bootloader mode.<br />
<br />
Arguments: 1 byte<br />
* 0: GPIO bitmask (bit 0: Reset, bit 1: Red LED, bit 2: Green LED)<br />
Receive: 0 bytes<br />
<br />
=== STOP_PROP (0x60) ===<br />
Stop the propellers when turning.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== CLEAR_ERROR (0x80) ===<br />
Clear the current error.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== PLAY_SOUND (0x82) ===<br />
Play a sound. A negative number will loop the sound.<br />
<br />
Arguments: 1 byte<br />
* 0: Sound number (0: None, 1: Short beep, 2: Boot beep, 3: Be-Bop-Ah-Lula, negative: repeat) (int8)<br />
Receive: 0 bytes<br />
<br />
=== GET_INFO (0xA0) ===<br />
Get information about the BLDC.<br />
<br />
Arguments: 0 bytes<br />
Receive: 4 bytes or 13 bytes<br />
* 0: Software version (major)<br />
* 1: Software version (minor)<br />
* 2: Software type<br />
* 3: Number of motors<br />
* 4-5: Number of flights (uint16)<br />
* 4-5: Time last flight (uint16)<br />
* 6-9: Full flight time (uint32)<br />
* 10: Last error code<br />
<br />
== Checksum ==<br />
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.<br />
<source lang="c"><br />
// Credits to Christophe De Wagter for figuring out the Checksum<br />
checksum = CMD_BYTE;<br />
for(int i = 0; i < packet_size; i++)<br />
checksum = checksum ^ packet[i];<br />
</source></div>QQhttp://wiki.paparazziuav.org/w/index.php?title=Bebop/BLDC&diff=19466Bebop/BLDC2015-02-05T20:27:29Z<p>QQ: /* START_PROP (0x40) */</p>
<hr />
<div>== General ==<br />
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.<br />
<br />
== Protocol ==<br />
* 0x02 SET_REF_SPEED<br />
* 0x20 GET_OBS_DATA<br />
* 0x40 START_PROP<br />
* 0x4D TOGGLE_GPIO<br />
* 0x60 STOP_PROP<br />
* 0x80 CLEAR_ERROR<br />
* 0x82 PLAY_SOUND<br />
* 0xA0 GET_INFO<br />
<br />
=== SET_REF_SPEED (0x02) ===<br />
Sets the RPM reference of the motors.<br />
<br />
Arguments: 10 bytes<br />
* 0-1: RPM reference Left Front motor (uint16)<br />
* 2-3: RPM reference Right Front motor (uint16)<br />
* 4-5: RPM reference Right Back motor (uint16)<br />
* 6-7: RPM reference Left Back motor (uint16)<br />
* 8: Reserved (0x00)<br />
* 9: Checksum (see section bellow)<br />
<br />
=== GET_OBS_DATA (0x20) ===<br />
Gets the observed data from the motors and battery.<br />
<br />
Arguments: 0 byte<br />
Receive: 14 bytes<br />
* 0-1: RPM observed Left Front motor (uint16)*<br />
* 2-3: RPM observed Right Front motor (uint16)*<br />
* 4-5: RPM observed Right Back motor (uint16)*<br />
* 6-7: RPM observed Left Back motor (uint16)*<br />
* 8-9: Battery voltage in mV (uint16)<br />
* 10: Status (uint8)<br />
* 11: Errno (uint8)<br />
* 12: Temperature in degrees Celcius (uint8)<br />
* 13: Checksum (see section below)<br />
<nowiki />* Bit 15 is reserved for detecting maximum RPM (depending on voltage and altitude)<br />
<br />
==== Status ====<br />
* 0: Init<br />
* 1: Idle<br />
* 2: Ramping<br />
* 3/4: Spinning<br />
* 5: Stopping<br />
* 6: Suicided<br />
<br />
==== Errno ====<br />
* 0: No error<br />
* 1: EEPROM corruption<br />
* 2: Motor stalled<br />
* 3: Propeller security<br />
* 4: Communication lost<br />
* 9: Battery voltage too low<br />
* 10: Incorrect number of LIPO cells<br />
* 11: Unplugged motor or broken motor phase or defectuous MOS<br />
<br />
=== START_PROP (0x40) ===<br />
Starts the propellers. The propellers will not start when the current error is not cleared.<br />
<br />
Optional argument:1 byte<br />
* 0: Motor bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is clockwise and 0 is counterclockwise<br />
Receive: 0 byte<br />
<br />
=== TOGGLE_GPIO (0x4D) ===<br />
Toggle GPIO outputs. The reset will put the BLDC into bootloader mode.<br />
<br />
Arguments: 1 byte<br />
* 0: GPIO bitmask (bit 0: Reset, bit 1: Red LED, bit 2: Green LED)<br />
Receive: 0 bytes<br />
<br />
=== STOP_PROP (0x60) ===<br />
Stop the propellers when turning.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== CLEAR_ERROR (0x80) ===<br />
Clear the current error.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== PLAY_SOUND (0x82) ===<br />
Play a sound. A negative number will loop the sound.<br />
<br />
Arguments: 1 byte<br />
* 0: Sound number (0: None, 1: Short beep, 2: Boot beep, 3: Be-Bop-Ah-Lula, negative: repeat) (int8)<br />
Receive: 0 bytes<br />
<br />
=== GET_INFO (0xA0) ===<br />
Get information about the BLDC.<br />
<br />
Arguments: 0 bytes<br />
Receive: 4 bytes or 13 bytes<br />
* 0: Software version (major)<br />
* 1: Software version (minor)<br />
* 2: Software type<br />
* 3: Number of motors<br />
* 4-5: Number of flights (uint16)<br />
* 4-5: Time last flight (uint16)<br />
* 6-9: Full flight time (uint32)<br />
* 10: Last error code<br />
<br />
== Checksum ==<br />
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.<br />
<source lang="c"><br />
// Credits to Christophe De Wagter for figuring out the Checksum<br />
checksum = CMD_BYTE;<br />
for(int i = 0; i < packet_size; i++)<br />
checksum = checksum ^ packet[i];<br />
</source></div>QQhttp://wiki.paparazziuav.org/w/index.php?title=Bebop/BLDC&diff=19465Bebop/BLDC2015-02-05T20:25:41Z<p>QQ: /* Errno */</p>
<hr />
<div>== General ==<br />
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.<br />
<br />
== Protocol ==<br />
* 0x02 SET_REF_SPEED<br />
* 0x20 GET_OBS_DATA<br />
* 0x40 START_PROP<br />
* 0x4D TOGGLE_GPIO<br />
* 0x60 STOP_PROP<br />
* 0x80 CLEAR_ERROR<br />
* 0x82 PLAY_SOUND<br />
* 0xA0 GET_INFO<br />
<br />
=== SET_REF_SPEED (0x02) ===<br />
Sets the RPM reference of the motors.<br />
<br />
Arguments: 10 bytes<br />
* 0-1: RPM reference Left Front motor (uint16)<br />
* 2-3: RPM reference Right Front motor (uint16)<br />
* 4-5: RPM reference Right Back motor (uint16)<br />
* 6-7: RPM reference Left Back motor (uint16)<br />
* 8: Reserved (0x00)<br />
* 9: Checksum (see section bellow)<br />
<br />
=== GET_OBS_DATA (0x20) ===<br />
Gets the observed data from the motors and battery.<br />
<br />
Arguments: 0 byte<br />
Receive: 14 bytes<br />
* 0-1: RPM observed Left Front motor (uint16)*<br />
* 2-3: RPM observed Right Front motor (uint16)*<br />
* 4-5: RPM observed Right Back motor (uint16)*<br />
* 6-7: RPM observed Left Back motor (uint16)*<br />
* 8-9: Battery voltage in mV (uint16)<br />
* 10: Status (uint8)<br />
* 11: Errno (uint8)<br />
* 12: Temperature in degrees Celcius (uint8)<br />
* 13: Checksum (see section below)<br />
<nowiki />* Bit 15 is reserved for detecting maximum RPM (depending on voltage and altitude)<br />
<br />
==== Status ====<br />
* 0: Init<br />
* 1: Idle<br />
* 2: Ramping<br />
* 3/4: Spinning<br />
* 5: Stopping<br />
* 6: Suicided<br />
<br />
==== Errno ====<br />
* 0: No error<br />
* 1: EEPROM corruption<br />
* 2: Motor stalled<br />
* 3: Propeller security<br />
* 4: Communication lost<br />
* 9: Battery voltage too low<br />
* 10: Incorrect number of LIPO cells<br />
* 11: Unplugged motor or broken motor phase or defectuous MOS<br />
<br />
=== START_PROP (0x40) ===<br />
Starts the propellers. The propellers will not start when the current error is not cleared.<br />
<br />
Arguments: 0 bytes or 1 byte<br />
* 0: Motor bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is clockwise and 0 is counterclockwise<br />
Receive: 0 bytes<br />
<br />
=== TOGGLE_GPIO (0x4D) ===<br />
Toggle GPIO outputs. The reset will put the BLDC into bootloader mode.<br />
<br />
Arguments: 1 byte<br />
* 0: GPIO bitmask (bit 0: Reset, bit 1: Red LED, bit 2: Green LED)<br />
Receive: 0 bytes<br />
<br />
=== STOP_PROP (0x60) ===<br />
Stop the propellers when turning.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== CLEAR_ERROR (0x80) ===<br />
Clear the current error.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== PLAY_SOUND (0x82) ===<br />
Play a sound. A negative number will loop the sound.<br />
<br />
Arguments: 1 byte<br />
* 0: Sound number (0: None, 1: Short beep, 2: Boot beep, 3: Be-Bop-Ah-Lula, negative: repeat) (int8)<br />
Receive: 0 bytes<br />
<br />
=== GET_INFO (0xA0) ===<br />
Get information about the BLDC.<br />
<br />
Arguments: 0 bytes<br />
Receive: 4 bytes or 13 bytes<br />
* 0: Software version (major)<br />
* 1: Software version (minor)<br />
* 2: Software type<br />
* 3: Number of motors<br />
* 4-5: Number of flights (uint16)<br />
* 4-5: Time last flight (uint16)<br />
* 6-9: Full flight time (uint32)<br />
* 10: Last error code<br />
<br />
== Checksum ==<br />
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.<br />
<source lang="c"><br />
// Credits to Christophe De Wagter for figuring out the Checksum<br />
checksum = CMD_BYTE;<br />
for(int i = 0; i < packet_size; i++)<br />
checksum = checksum ^ packet[i];<br />
</source></div>QQhttp://wiki.paparazziuav.org/w/index.php?title=Bebop/BLDC&diff=19464Bebop/BLDC2015-02-05T20:19:53Z<p>QQ: /* GET_OBS_DATA (0x20) */</p>
<hr />
<div>== General ==<br />
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.<br />
<br />
== Protocol ==<br />
* 0x02 SET_REF_SPEED<br />
* 0x20 GET_OBS_DATA<br />
* 0x40 START_PROP<br />
* 0x4D TOGGLE_GPIO<br />
* 0x60 STOP_PROP<br />
* 0x80 CLEAR_ERROR<br />
* 0x82 PLAY_SOUND<br />
* 0xA0 GET_INFO<br />
<br />
=== SET_REF_SPEED (0x02) ===<br />
Sets the RPM reference of the motors.<br />
<br />
Arguments: 10 bytes<br />
* 0-1: RPM reference Left Front motor (uint16)<br />
* 2-3: RPM reference Right Front motor (uint16)<br />
* 4-5: RPM reference Right Back motor (uint16)<br />
* 6-7: RPM reference Left Back motor (uint16)<br />
* 8: Reserved (0x00)<br />
* 9: Checksum (see section bellow)<br />
<br />
=== GET_OBS_DATA (0x20) ===<br />
Gets the observed data from the motors and battery.<br />
<br />
Arguments: 0 byte<br />
Receive: 14 bytes<br />
* 0-1: RPM observed Left Front motor (uint16)*<br />
* 2-3: RPM observed Right Front motor (uint16)*<br />
* 4-5: RPM observed Right Back motor (uint16)*<br />
* 6-7: RPM observed Left Back motor (uint16)*<br />
* 8-9: Battery voltage in mV (uint16)<br />
* 10: Status (uint8)<br />
* 11: Errno (uint8)<br />
* 12: Temperature in degrees Celcius (uint8)<br />
* 13: Checksum (see section below)<br />
<nowiki />* Bit 15 is reserved for detecting maximum RPM (depending on voltage and altitude)<br />
<br />
==== Status ====<br />
* 0: Init<br />
* 1: Idle<br />
* 2: Ramping<br />
* 3/4: Spinning<br />
* 5: Stopping<br />
* 6: Suicided<br />
<br />
==== Errno ====<br />
* 0: No error<br />
* 2: Motor stalled<br />
* 3: Propeller security<br />
* 4: Communication lost<br />
* 9: Battery voltage too low<br />
<br />
=== START_PROP (0x40) ===<br />
Starts the propellers. The propellers will not start when the current error is not cleared.<br />
<br />
Arguments: 0 bytes or 1 byte<br />
* 0: Motor bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is clockwise and 0 is counterclockwise<br />
Receive: 0 bytes<br />
<br />
=== TOGGLE_GPIO (0x4D) ===<br />
Toggle GPIO outputs. The reset will put the BLDC into bootloader mode.<br />
<br />
Arguments: 1 byte<br />
* 0: GPIO bitmask (bit 0: Reset, bit 1: Red LED, bit 2: Green LED)<br />
Receive: 0 bytes<br />
<br />
=== STOP_PROP (0x60) ===<br />
Stop the propellers when turning.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== CLEAR_ERROR (0x80) ===<br />
Clear the current error.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== PLAY_SOUND (0x82) ===<br />
Play a sound. A negative number will loop the sound.<br />
<br />
Arguments: 1 byte<br />
* 0: Sound number (0: None, 1: Short beep, 2: Boot beep, 3: Be-Bop-Ah-Lula, negative: repeat) (int8)<br />
Receive: 0 bytes<br />
<br />
=== GET_INFO (0xA0) ===<br />
Get information about the BLDC.<br />
<br />
Arguments: 0 bytes<br />
Receive: 4 bytes or 13 bytes<br />
* 0: Software version (major)<br />
* 1: Software version (minor)<br />
* 2: Software type<br />
* 3: Number of motors<br />
* 4-5: Number of flights (uint16)<br />
* 4-5: Time last flight (uint16)<br />
* 6-9: Full flight time (uint32)<br />
* 10: Last error code<br />
<br />
== Checksum ==<br />
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.<br />
<source lang="c"><br />
// Credits to Christophe De Wagter for figuring out the Checksum<br />
checksum = CMD_BYTE;<br />
for(int i = 0; i < packet_size; i++)<br />
checksum = checksum ^ packet[i];<br />
</source></div>QQhttp://wiki.paparazziuav.org/w/index.php?title=Bebop/BLDC&diff=19463Bebop/BLDC2015-02-05T20:17:40Z<p>QQ: Describe 10th byte</p>
<hr />
<div>== General ==<br />
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.<br />
<br />
== Protocol ==<br />
* 0x02 SET_REF_SPEED<br />
* 0x20 GET_OBS_DATA<br />
* 0x40 START_PROP<br />
* 0x4D TOGGLE_GPIO<br />
* 0x60 STOP_PROP<br />
* 0x80 CLEAR_ERROR<br />
* 0x82 PLAY_SOUND<br />
* 0xA0 GET_INFO<br />
<br />
=== SET_REF_SPEED (0x02) ===<br />
Sets the RPM reference of the motors.<br />
<br />
Arguments: 10 bytes<br />
* 0-1: RPM reference Left Front motor (uint16)<br />
* 2-3: RPM reference Right Front motor (uint16)<br />
* 4-5: RPM reference Right Back motor (uint16)<br />
* 6-7: RPM reference Left Back motor (uint16)<br />
* 8: Reserved (0x00)<br />
* 9: Checksum (see section bellow)<br />
<br />
=== GET_OBS_DATA (0x20) ===<br />
Gets the observed data from the motors and battery.<br />
<br />
Arguments: 0 bytes<br />
Receive: 8 bytes or 13 bytes<br />
* 0-1: RPM observed Left Front motor (uint16)*<br />
* 2-3: RPM observed Right Front motor (uint16)*<br />
* 4-5: RPM observed Right Back motor (uint16)*<br />
* 6-7: RPM observed Left Back motor (uint16)*<br />
* 8-9: Battery voltage in mV (uint16)<br />
* 10: Status (uint8)<br />
* 11: Errno (uint8)<br />
* 12: Temperature in degrees Celcius (uint8)<br />
<nowiki />* Bit 15 is reserved for detecting maximum RPM (depending on voltage and altitude)<br />
<br />
==== Status ====<br />
* 0: Init<br />
* 1: Idle<br />
* 2: Ramping<br />
* 3/4: Spinning<br />
* 5: Stopping<br />
* 6: Suicided<br />
<br />
==== Errno ====<br />
* 0: No error<br />
* 2: Motor stalled<br />
* 3: Propeller security<br />
* 4: Communication lost<br />
* 9: Battery voltage too low<br />
<br />
=== START_PROP (0x40) ===<br />
Starts the propellers. The propellers will not start when the current error is not cleared.<br />
<br />
Arguments: 0 bytes or 1 byte<br />
* 0: Motor bitmask (0000ABCD, A:Left Upper, B:Right Upper, C: Right Back, D: Left Back) where 1 is clockwise and 0 is counterclockwise<br />
Receive: 0 bytes<br />
<br />
=== TOGGLE_GPIO (0x4D) ===<br />
Toggle GPIO outputs. The reset will put the BLDC into bootloader mode.<br />
<br />
Arguments: 1 byte<br />
* 0: GPIO bitmask (bit 0: Reset, bit 1: Red LED, bit 2: Green LED)<br />
Receive: 0 bytes<br />
<br />
=== STOP_PROP (0x60) ===<br />
Stop the propellers when turning.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== CLEAR_ERROR (0x80) ===<br />
Clear the current error.<br />
<br />
Arguments: 0 bytes<br />
Receive: 0 bytes<br />
<br />
=== PLAY_SOUND (0x82) ===<br />
Play a sound. A negative number will loop the sound.<br />
<br />
Arguments: 1 byte<br />
* 0: Sound number (0: None, 1: Short beep, 2: Boot beep, 3: Be-Bop-Ah-Lula, negative: repeat) (int8)<br />
Receive: 0 bytes<br />
<br />
=== GET_INFO (0xA0) ===<br />
Get information about the BLDC.<br />
<br />
Arguments: 0 bytes<br />
Receive: 4 bytes or 13 bytes<br />
* 0: Software version (major)<br />
* 1: Software version (minor)<br />
* 2: Software type<br />
* 3: Number of motors<br />
* 4-5: Number of flights (uint16)<br />
* 4-5: Time last flight (uint16)<br />
* 6-9: Full flight time (uint32)<br />
* 10: Last error code<br />
<br />
== Checksum ==<br />
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.<br />
<source lang="c"><br />
// Credits to Christophe De Wagter for figuring out the Checksum<br />
checksum = CMD_BYTE;<br />
for(int i = 0; i < packet_size; i++)<br />
checksum = checksum ^ packet[i];<br />
</source></div>QQ