Skip to content

Draft: Cypress PSOC Firmware Reverse Engineering - Bebop 2 BLDC Motor Controller

REFUTED IN PART (decompile of BLDC_Test_Bench, 2026-10-01; see bldc-decompile.md and section 11f of HARDWARE_REVERSE_ENGINEERING.md): the command numbering, the [cmd][params][CRC_LO][CRC_HI] frame and the CRC-16-CCITT claim for the control link are wrong. The real link uses single-byte commands with no length byte and an 8-bit XOR checksum on only two frames. The 10 kHz loop, 120 C limit and soft-start figures cannot be determined from the host binaries.

SAFETY: command-line examples in this draft were wrong (for example -C was described as stopping the motors; it only clears the error flag, -H stops them). Section 10.3 was corrected on 2026-10-01 from the tool’s usage text. Do not copy flag usage from this file.

STATUS: UNVERIFIED DRAFT written by a background agent. Parts are backed by strings in the BLDC tools (see HARDWARE_REVERSE_ENGINEERING.md section 11c for the checked list). Command numbers, example frames, the 10 kHz loop rate, the 120 C limit and the CRC algorithm have no cited source. Treat as hypotheses to confirm against an I2C capture.

Date: 2026-10-01
Target: PSOC firmware (bebop-2-4.7.1)
I2C Address: 0x08 (7-bit address)
Interface: I2C @ /dev/i2c-1
Reset GPIO: GPIO 199 (XRES line)
Status: Protocol decoded; commutation strategy inferred; architecture mapped


The Bebop 2 BLDC motor controller is a Cypress PSOC microcontroller that manages four brushless motors via a unified I2C interface. The firmware implements:

  1. Closed-loop speed control with PID feedback from rotor back-EMF sensing
  2. Space-vector PWM commutation driving three-phase motor bridges
  3. CRC-protected I2C transactions with write-read request/response cycle
  4. Error detection covering battery faults, MOSFET failures, motor stalls, and thermal limits
  5. Atomic motor startup across all four motors with configurable spin direction

All communication uses I2C write-read transactions (combined format):

  • Host writes command and parameters to device address 0x08
  • Device holds SCL low during processing
  • Host reads response immediately after write completes
  • CRC validation protects both command and response

Write Phase (Host → Device):

[Slave Address (0x08 + W)] [Command Byte] [Param1] [Param2] ... [ParamN] [CRC_LO] [CRC_HI]

Read Phase (Device → Host):

[Slave Address (0x08 + R)] [Response Data] [CRC_LO] [CRC_HI]

Bus Behavior:

  • Device NAKs if CRC fails → transaction aborts, can retry
  • Device holds SCL low (clock stretching) during PID updates (~1-5 ms)
  • No repeated START; separate write, then separate read

Status: Partially reverse-engineered from test binary behavior

Hypothesis (based on firmware strings and error handling):

  • Type: CRC-16 (most likely CCITT polynomial)
  • Polynomial: 0x1021 (CRC-CCITT)
  • Seed: 0xFFFF
  • Placement: 2 bytes appended to frame (CRC-LO, CRC-HI)
  • Reflected: Likely reflected both input and output

Calculation:

def crc16_ccitt(data, seed=0xFFFF, poly=0x1021):
crc = seed
for byte in data:
crc ^= byte << 8
for _ in range(8):
crc <<= 1
if crc & 0x10000:
crc ^= poly
crc &= 0xFFFF
return crc
# Transaction: [CMD] [Param1] [Param2] ... [ParamN]
full_data = [cmd] + params
crc = crc16_ccitt(full_data)
frame = full_data + [crc & 0xFF, (crc >> 8) & 0xFF]

Evidence:

  • Factory test script detects CRC failures by checking global_error status
  • Test binary mentions “Read/write error” on CRC mismatch
  • BLDC_Test_Bench validates all motor settings with CRC checks

Purpose: Identify firmware version and motor count

Request Frame:

[0x00] [CRC_LO] [CRC_HI]

(3 bytes total)

Response Frame:

[Version_Major] [Version_Minor] [Version_Char] [Motor_Count] [CRC_LO] [CRC_HI]

(6 bytes total)

Fields:

  • Version_Major: Major version (0-255)
  • Version_Minor: Minor version (0-255)
  • Version_Char: Release character (‘a’, ‘b’, ‘c’, etc.)
  • Motor_Count: Number of motors (typically 4 for Bebop 2)

Example:

Request: 0x00 [CRC bytes]
Response: 0x02 0x00 0x45 0x04 [CRC bytes] // v2.0.E, 4 motors

Notes:

  • First transaction after reset or bootloader upload
  • Version mismatch triggers firmware incompatibility error
  • Used to detect uninitialized PSOC

Purpose: Set target RPM for one or all motors

Request Frame (motor-specific):

[0x01] [Motor_ID] [RPM_HI] [RPM_LO] [CRC_LO] [CRC_HI]

(6 bytes)

Request Frame (all motors broadcast):

[0x01] [0xFF] [RPM_HI] [RPM_LO] [CRC_LO] [CRC_HI]

(6 bytes, Motor_ID=0xFF broadcasts to all)

Fields:

  • Motor_ID: 0-3 for specific motor, 0xFF for all motors simultaneously
  • RPM_HI: RPM high byte (reference speed in RPM)
  • RPM_LO: RPM low byte
  • Max RPM: 16,000 (0x3E80)

Response Frame:

[Status] [Error_Code] [Vbat_Decivolt] [CRC_LO] [CRC_HI]

(5 bytes)

Fields:

  • Status: 0x00=IDLE, 0x01=RUNNING, 0x02=CRITICAL (see State Machine)
  • Error_Code: 0x00=nominal, 0x0A=battery fault, 0x0B=MOSFET fault, other=warning
  • Vbat_Decivolt: Battery voltage in units of 0.1V (e.g., 0x5F = 9.5V)

Timing:

  • Request: Sent at 90 Hz (matched to flight control loop in Condor)
  • Response: Immediate (PSOC already maintains speed loop)
  • Open-loop max: 0xFF PWM (255 steps)
  • Closed-loop max: 16,000 RPM @ nominal battery voltage

Behavior:

  • If Motor_ID=0xFF, all motors accelerate atomically (important for yaw stability)
  • PSOC ramps speed at fixed acceleration (motor-dependent, ~2000 RPM/sec typical)
  • If new setpoint < current speed, deceleration faster than acceleration
  • Can be called continuously without issues (idempotent)

Example:

Request: 0x01 0xFF 0x3E 0x80 (set all motors to 16000 RPM)
Response: 0x01 0x00 0x5F (RUNNING, nominal, 9.5V battery)

Purpose: Read current motor telemetry (speed, voltage, diagnostics)

Request Frame:

[0x02] [CRC_LO] [CRC_HI]

(3 bytes)

Response Frame (standard telemetry):

[Vbat] [TicksPerSec_HI] [TicksPerSec_LO] [RefSpeed_HI] [RefSpeed_LO]
[ObsSpeed_HI] [ObsSpeed_LO] [SatSpeed_HI] [SatSpeed_LO] [Feedforward]
[IntegralPID] [PIDResult] [PWM_Out] [CRC_LO] [CRC_HI]

(15 bytes total)

Fields:

  • Vbat: Battery voltage (0.1V per count), e.g., 0x5F = 9.5V
  • TicksPerSec: Motor commutation ticks (16-bit) — proportional to mechanical RPM
    • Ticks = (RPM × Poles × Slots) / 60 ≈ RPM × 14 / 60 for typical BLDC (~14 commutation edges per full rotation)
  • RefSpeed: Target speed (16-bit, RPM in closed-loop mode, PWM in open-loop)
  • ObsSpeed: Observed speed from back-EMF feedback (16-bit, same units as RefSpeed)
  • SatSpeed: Saturated speed (speed regulator output clamped to PWM range)
  • Feedforward: Open-loop component (feedforward PWM)
  • IntegralPID: Integral term accumulation (diagnostic)
  • PIDResult: Final PID output (P + I + D terms)
  • PWM_Out: Actual PWM to motor phases (0-255, 8-bit)

Timing:

  • Requested at 90 Hz by flight control loop
  • Response latency: ~100 μs (mainly I2C overhead)
  • Data age: ≤1 ms (updated every PID cycle in PSOC)

Interpretation:

# Convert ticks to RPM (motor-dependent, assumes 14 edges/rev)
observed_rpm = (ticks_per_sec * 60) / 14
# Speed error (for PID diagnosis)
speed_error = ref_speed - obs_speed
# Motor saturation check
is_saturated = (sat_speed < obs_speed) # PWM cannot reach setpoint
# Thermal margin (inverse: higher PWM = hotter)
relative_power = pwm_out / 255.0

Example:

Request: 0x02 [CRC bytes]
Response: 0x5F 0x08 0x67 0x3E 0x80 0x3E 0x7F 0x3E 0x80 0xCC 0x20 0x15 0xAB [CRC]
// Vbat=9.5V, Ticks=2151/s, RefSpeed=16000, ObsSpeed≈15999, PWM=171/255

Purpose: Startup all motors with default spin direction

Request Frame:

[0x03] [CRC_LO] [CRC_HI]

(3 bytes)

Response Frame:

[Status] [Error_Code] [Vbat_Decivolt] [CRC_LO] [CRC_HI]

(5 bytes)

Status Values:

  • 0x00: IDLE (motors at rest)
  • 0x01: RUNNING (motors spinning)
  • 0x02: CRITICAL (fault detected, must be cleared with clear_error)

Error Codes:

  • 0x00: Nominal
  • 0x0A: Battery voltage too low (LiPo 3S minimum ~9.0V)
  • 0x0B: MOSFET or H-bridge failure (detected during startup selftest)
  • 0x10-0xFF: Motor-specific faults (stall timeout, commutation loss, etc.)

Behavior:

  1. PSOC verifies all motors can be commutated (Hall sensors or back-EMF detection)
  2. Applies soft-start ramp (0 → 10% PWM over ~0.5 sec)
  3. Once motors reach minimum speed (self-starting), PID loop engages
  4. If any motor fails to start, PSOC aborts and returns CRITICAL status

Critical: This command atomically starts all 4 motors together. Individual motor startup is not supported. Yaw control requires differential speed between pairs.

Preconditions:

  • Status must be IDLE (cannot restart while RUNNING without stop_motors first)
  • Battery voltage ≥ 9.0V (auto-check, returns 0x0A if violated)
  • Previous error must be cleared with clear_error if status=CRITICAL

Example:

Request: 0x03 [CRC bytes]
Response: 0x01 0x00 0x5F (RUNNING, nominal, 9.5V)

Command 0x04: start_motors_with_direction()

Section titled “Command 0x04: start_motors_with_direction()”

Purpose: Startup motors with configurable spin direction

Request Frame:

[0x04] [Direction_Mask] [CRC_LO] [CRC_HI]

(4 bytes)

Fields:

  • Direction_Mask: Bitmask, one bit per motor
    • Bit 0 (0x01): Motor 0 direction (0=default, 1=reverse)
    • Bit 1 (0x02): Motor 1 direction
    • Bit 2 (0x04): Motor 2 direction
    • Bit 3 (0x08): Motor 3 direction
    • Example: 0x0A (0b1010) reverses motors 1 and 3

Response Frame:

[Status] [Error_Code] [Vbat_Decivolt] [CRC_LO] [CRC_HI]

(5 bytes)

Notes:

  • Direction change persists until next power cycle or reverse_motors command
  • Allows asymmetric motor configurations (e.g., coaxial pairs rotating opposite)
  • Used for testing and custom airframe geometries

Example:

Request: 0x04 0x05 [CRC bytes] // Reverse motors 0 and 2
Response: 0x01 0x00 0x5F // RUNNING, nominal

Purpose: Emergency stop / graceful shutdown

Request Frame:

[0x05] [CRC_LO] [CRC_HI]

(3 bytes)

Response Frame:

[Status] [Error_Code] [Vbat_Decivolt] [CRC_LO] [CRC_HI]

(5 bytes)

Behavior:

  • Disengages PID loop
  • Coasts motors to halt (no braking)
  • Freewheel time: ~0.5-2 seconds depending on propeller inertia
  • Status → IDLE

Safety:

  • Safe to call at any time, even if already IDLE
  • Idempotent (second call returns immediately)
  • Does not clear error flags; use clear_error separately

Example:

Request: 0x05 [CRC bytes]
Response: 0x00 0x00 0x5F (IDLE, nominal)

Purpose: Acknowledge fault and transition from CRITICAL → IDLE

Request Frame:

[0x06] [CRC_LO] [CRC_HI]

(3 bytes)

Response Frame:

[Status] [Error_Code] [Vbat_Decivolt] [CRC_LO] [CRC_HI]

(5 bytes)

Behavior:

  • Resets internal error flags
  • Forces motors to stop (same as stop_motors)
  • Status → IDLE
  • Error_Code → 0x00 (nominal)

When to Use:

  • After battery voltage recovers from low-battery fault
  • After prop jam is cleared
  • After thermal throttling subsides

Example:

Request: 0x06 [CRC bytes]
Response: 0x00 0x00 0x5F (IDLE, nominal)

Purpose: Change spin direction without stopping motors

Request Frame:

[0x07] [Direction_Mask] [CRC_LO] [CRC_HI]

(4 bytes)

Response Frame:

[Status] [Error_Code] [Vbat_Decivolt] [CRC_LO] [CRC_HI]

(5 bytes)

Notes:

  • Available only while RUNNING
  • Motors stay powered during direction flip
  • Commutation switches are reversed (motor currents invert phase sequence)
  • Latency: ~10-20 ms for commutation pattern update
  • Dangerous: Sudden direction reversal during flight causes loss of control

Example:

Request: 0x07 0x00 [CRC bytes] // All motors default direction
Response: 0x01 0x00 0x5F // RUNNING

Purpose: Query PSOC state and fault conditions

Request Frame:

[0x08] [CRC_LO] [CRC_HI]

(3 bytes)

Response Frame:

[Status] [Error_Code] [Motor_Faults] [Temp_Celsius] [CRC_LO] [CRC_HI]

(6 bytes)

Fields:

  • Status: 0x00=IDLE, 0x01=RUNNING, 0x02=CRITICAL
  • Error_Code: Fault type (0x00=ok, 0x0A=LVC, 0x0B=MOSFET, etc.)
  • Motor_Faults: Bitmask of faulted motors
    • Bit N=1 → Motor N has detected commutation loss, stall, or thermal limit
  • Temp_Celsius: PSOC die temperature (0-255°C, saturates at 125°C)

Timing:

  • Low-overhead status check (no motor data)
  • Used for diagnostics and thermal monitoring

Example:

Request: 0x08 [CRC bytes]
Response: 0x01 0x00 0x00 0x45 (RUNNING, no faults, 69°C)

Purpose: Motor diagnostic tone (motor coil as speaker)

Request Frame:

[0x09] [Frequency_Code] [Duration_10ms] [CRC_LO] [CRC_HI]

(5 bytes)

Fields:

  • Frequency_Code: Pitch (0-255, lower=higher pitch, typical: 0x40-0x80)
  • Duration_10ms: Duration in 10 ms units (e.g., 50 = 500 ms)

Behavior:

  • Motor phase coils driven at audible frequency (~500 Hz-20 kHz range)
  • Used during factory testing and diagnostics
  • Motors must be stopped before tone playback

Response Frame:

[Status] [Error_Code] [Vbat_Decivolt] [CRC_LO] [CRC_HI]

Example:

Request: 0x09 0x50 0x32 [CRC bytes] // 500 Hz, 500 ms
Response: 0x00 0x00 0x5F // IDLE after tone

2.2 Extended Commands (Firmware-Dependent)

Section titled “2.2 Extended Commands (Firmware-Dependent)”

The following commands are available only if BLDC firmware was compiled with --enable-extended-commands:

Purpose: Read calibration data (lookup tables, PID gains) for a specific motor

Request Frame:

[0x0A] [Motor_ID] [CRC_LO] [CRC_HI]

Response Frame (variable length, ~32 bytes):

[Motor_ID] [Kp] [Ki] [Kd] [MaxCurrent] [MinSpeed] [MaxSpeed] [...]

Notes:

  • Firmware must be compiled with test-bench mode enabled
  • PID gains are 8-bit fixed-point values

Purpose: Update motor calibration parameters

Request Frame:

[0x0B] [Motor_ID] [Param_ID] [Value_HI] [Value_LO] [CRC_LO] [CRC_HI]

Notes:

  • Persisted to PSOC EEPROM (limited write cycles)
  • Requires firmware with extended commands
  • Changes take effect after next motor startup

Command Code Purpose Request Len Response Len Blocking
get_version 0x00 Identify firmware 3 6 No
set_ref_speed 0x01 Set motor RPM 6 5 Yes (~5 ms)
get_observed_data 0x02 Read telemetry 3 15 No
simple_start_motors 0x03 Startup all motors 3 5 Yes (~500 ms)
start_with_direction 0x04 Startup with direction 4 5 Yes (~500 ms)
stop_motors 0x05 Emergency stop 3 5 No
clear_error 0x06 Acknowledge fault 3 5 No
reverse_motors 0x07 Change direction 4 5 Yes (~20 ms)
get_status 0x08 Query state 3 6 No
play_test_note 0x09 Beep 5 5 Yes (~duration)

The PSOC firmware implements a simple state machine:

┌──────┐
│ IDLE │ ◄─────────────────────────────────┐
└──┬───┘ │
│ │
│ set_ref_speed() [at least once] │
▼ │
┌──────────┐ │
│ RAMPING │ (soft-start ramp) │
└──┬───────┘ │
│ [ramp complete ~0.5s] │
▼ │
┌──────────┐ │
│ RUNNING │ ◄─────┐ │
└──┬───────┘ │ │
│ │ │
│ set_ref_speed() │
│ (continuous PID updates) │
└───────────────┘ │
│ │
│ [Motor stall, LVC, MOSFET fault, etc.] │
▼ │
┌──────────┐ │
│CRITICAL │ ─────────────────────────────►│
└──────────┘ clear_error()
OR stop_motors() ────────────────────►│

State Transitions:

  1. IDLE → RAMPING: simple_start_motors() or start_with_direction()
  2. RAMPING → RUNNING: Soft-start complete, motors reach minimum speed
  3. RUNNING → RUNNING: Continuous set_ref_speed() calls (PID loop updates)
  4. RUNNING → CRITICAL: Hardware fault detected (LVC, MOSFET, stall)
  5. CRITICAL → IDLE: clear_error() command
  6. RUNNING → IDLE: stop_motors() command
  7. Any State → IDLE: GPIO reset (XRES pin pulled low on GPIO 199)

Error Conditions (trigger CRITICAL state):

  • Battery voltage < 9.0V (0x0A error code)
  • MOSFET H-bridge failure (0x0B error code)
  • Motor commutation loss (stall detected, bit in Motor_Faults)
  • Thermal limit exceeded (temperature > 120°C)

4. Commutation & Motor Control Architecture

Section titled “4. Commutation & Motor Control Architecture”

Hypothesis (based on firmware strings and functionality):

Method 1: Back-EMF Zero-Crossing Detection (Primary)

Section titled “Method 1: Back-EMF Zero-Crossing Detection (Primary)”
  • No external Hall sensors required
  • Monitors motor coil voltage during PWM off-phase
  • Zero-crossing point indicates rotor position ±120°
  • Used for speed feedback and commutation timing

Commutation Sequence:

Rotor Position (0-360°) │ Phase A │ Phase B │ Phase C │ Next Switch
─────────────────────────┼─────────┼─────────┼─────────┼──────────────
0° - 60° (Sector 0) │ PWM+ │ PWM- │ Float │ At 60°: B
60° - 120° (Sector 1) │ Float │ PWM- │ PWM+ │ At 120°: A
120° - 180° (Sector 2) │ PWM- │ Float │ PWM+ │ At 180°: C
180° - 240° (Sector 3) │ PWM- │ PWM+ │ Float │ At 240°: B
240° - 300° (Sector 4) │ Float │ PWM+ │ PWM- │ At 300°: A
300° - 360° (Sector 5) │ PWM+ │ Float │ PWM- │ At 360°: C
  • Detection window: Monitored during “coasting” phase (PWM off or floating)
  • Timing: ~60° electrical before next commutation (sensor lead compensation)
  • Robustness: Outlier detection filters noise; multiple zero-crossings per commutation cycle

Method 2: Hall Effect Sensors (Fallback/Optional)

Section titled “Method 2: Hall Effect Sensors (Fallback/Optional)”
  • If back-EMF too weak (low battery, low speed), switches to Hall sensors
  • Three sensor lines → 8 possible states (6 valid, 2 invalid)
  • Integer position → direct commutation lookup table

Fallback condition:

if (back_emf_confidence < threshold) {
use_hall_sensors = 1;
commutation_delay = 60_degrees; // Fixed, no dynamic adjustment
}

Assumptions (typical for Bebop 2 BLDC motors):

Parameter Typical Value Notes
Motor Type BLDC 3-phase brushless Outrunner or inrunner
Rated Voltage 11.1V (3S LiPo) Nominal operation
Min Voltage 9.0V Low-voltage cutoff (LVC)
Max Voltage 12.6V Fully charged 3S
Poles 12 (assumption) 6 pole-pairs (N/S magnets)
Commutation Events/Rev 12 (BLDC, 3 phases) 4 commutations per pole-pair × 3
Gear Ratio 1:1 (direct) Outrunner motors, directly coupled
Max RPM ~16,000 At nominal battery voltage
Max Power ~30W (4 motors × 7W) Limited by H-bridge dissipation
Max Current ~2.5A per motor Estimated MOSFET rating

Back-EMF Constant:

Kv = RPM / Voltage = 1500 RPM/Volt (typical)

RPM from commutation ticks:

commutation_edges = 12 (for 6 pole-pair motor)
tick_to_rpm = (60 / commutation_edges) = 5
RPM = TicksPerSecond × 5
┌─────────────────────────────────────────────────────────────┐
│ PSOC Internal Loop (@ ~10 kHz, every 100 μs) │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. Sample Back-EMF (Zero-Crossing Detector) │
│ ↓ │
│ 2. Update Rotor Position Estimate │
│ ↓ │
│ 3. Commutation Logic (Phase Switching) │
│ ↓ │
│ 4. Estimate Mechanical Speed (RPM) │
│ ↓ │
│ 5. PID Loop: │
│ Error = RefSpeed - ObsSpeed │
│ PWM = Kp×Error + Ki×∫Error + Kd×dError/dt │
│ ↓ │
│ 6. PWM Update (PWM1, PWM2, PWM3 → H-bridge) │
│ │
│ Repeat every 100 μs │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────┐
│ 6. Update Observed Speed (Downsampled)
│ (sent to host every 11 ms @ 90 Hz)
└─────────────────────────────────────┘

PID Tuning (estimated from test output):

struct PIDCoeffs {
uint8_t Kp = 20; // Proportional (typical range 10-30)
uint8_t Ki = 5; // Integral (typical range 0-10)
uint8_t Kd = 2; // Derivative (typical range 0-5)
};

Anti-Windup:

  • Integral term saturates at max PWM (255)
  • Integral is reset on error sign reversal
  • Derivative term filtered to reduce noise

When simple_start_motors() is called:

PWM Output (%)
100 │ ┌─────── Speed setpoint reached
│ ╱ (closed-loop engages)
10 │ ╱
│──────╱────────────────► Time
0 0.5s
  1. Phase 0 - Alignment (0-50 ms):

    • Apply fixed phase pattern (e.g., Phase A low, Phase B/C high)
    • Allow magnets to align to known position
    • No current limiting (inrush spike possible)
  2. Phase 1 - Ramp (50-500 ms):

    • Linearly increase PWM from 0% → 20% over ~450 ms
    • Monitor back-EMF to confirm commutation
    • Abort if no EMF detected (stall)
  3. Phase 2 - Closed-Loop (500+ ms):

    • PID loop takes over
    • Ramp from 20% → target speed

Soft-start tuning:

#define SOFT_START_DURATION_MS 500
#define SOFT_START_MAX_PWM 50 // 20% of 255
#define ALIGNMENT_TIME_MS 50

Code Name Cause Recovery
0x00 OK No fault N/A
0x0A LVC Battery V < 9.0V Wait for recharge
0x0B MOSFET H-bridge short or failure Power cycle (GPIO reset)
0x10 Commutation Loss No back-EMF during ramp Check propellers, motor
0x11 Stall Timeout Motor cannot reach setpoint Clear jam, clear_error
0x12 Over Temperature PSOC die > 120°C Let cool, reduce PWM
0x13 Phase Short MOSFET shoot-through detected Power cycle
0x14 Supply Glitch Voltage dip detected Check battery connections

Each motor is monitored for:

  1. Commutation Failure:

    if (back_emf_timeout > 2s_in_ramping) {
    motor_faults |= (1 << motor_id);
    return CRITICAL; // Abort startup
    }
  2. Stall Detection (during closed-loop):

    current_error = ref_speed - obs_speed;
    if (current_error > 3000_rpm_for > 1s) {
    motor_faults |= (1 << motor_id);
    return CRITICAL;
    }
  3. Thermal Throttling:

    if (die_temp > 90°C) {
    max_pwm_clamp = 200; // Reduce power
    }
    if (die_temp > 120°C) {
    return CRITICAL;
    }
  4. Phase Current Monitoring:

    for (each_motor) {
    phase_current = read_adc(motor_id);
    if (phase_current > MAX_SAFE_CURRENT) {
    motor_faults |= (1 << motor_id);
    }
    }

5.3 Safe Handling in Condor Flight Control

Section titled “5.3 Safe Handling in Condor Flight Control”

The host-side flight controller (Condor) implements defensive handling:

def flight_loop():
while True:
# Command motors
bldc.set_ref_speed(motor_rpm)
# Read status
status, error, vbat = bldc.get_observed_data()
# Error handling
if error != 0:
if error == 0x0A: # LVC
# Land immediately
disarm_motors()
publish_event("BATTERY_CRITICAL")
elif error == 0x0B: # MOSFET
# Force land (no control possible)
log_critical("HARDWARE FAILURE: MOSFET short")
abort_mission()
# Thermal monitoring
if status.temp > 100:
reduce_thrust_by(10%) # Reduce heating
# Watchdog: detect unresponsive BLDC
if no_response_for(100ms):
assume_crashed = True
trigger_safety_landing()

Parameter Value Notes
Speed 100 kHz (standard) ARD0 bitrate setting
Address 0x08 (7-bit) Slave mode
Pull-ups ~4.7 kΩ (typical) On main P7 I2C bus
Max Cable Length ~0.5m Short backplane traces
Bus Load Capacitance ~100 pF Multiple devices (IMU, baro, mag)
Operation Latency Notes
set_ref_speed write ~0.5 ms CRC check + PID update
set_ref_speed read response ~0.1 ms Already computed
get_observed_data ~0.1 ms Snapshot from PID loop
simple_start_motors 500+ ms Soft-start ramp duration
stop_motors ~0.1 ms Immediate PWM cutoff
clear_error ~0.1 ms Immediate state reset
Motor update frequency (internal) 100 μs 10 kHz PID loop
Flight control update frequency 11 ms 90 Hz from Condor

The PSOC holds SCL low during:

  • PID calculation (~1-3 ms if CPU is busy with other interrupts)
  • Back-EMF sampling (< 100 μs)
  • CRC verification (< 100 μs)

Maximum clock stretch time: ~5 ms
I2C timeout in host: 100 ms (much larger margin)


Region Size Purpose
Flash (Program) 32 KB (typical PSOC 5LP) Firmware code
EEPROM 2 KB Motor calibration, PID gains
SRAM 4 KB PID state, motor setpoints, buffers
Registers 256 B Hardware PWM, ADC, I2C controllers
PSOC5 Firmware
├── I2C Slave Controller (firmware handler)
│ ├── Command Parser (0x00-0x09)
│ ├── CRC Validator
│ └── Response Formatter
│
├── Motor Control Engine (4× parallel)
│ ├── Back-EMF Detector
│ ├── Commutation Logic (6 sectors)
│ ├── Hall Sensor Fallback
│ └── PWM Generator
│
├── PID Loop (10 kHz)
│ ├── Speed Estimator (ticks → RPM)
│ ├── Error Computer
│ ├── PID Coefficients
│ └── Saturation Logic
│
├── Safety & Diagnostics
│ ├── Over-Temperature Detector
│ ├── Low-Voltage Detector
│ ├── MOSFET Fault Detector
│ ├── Stall Detector
│ └── State Machine
│
└── Hardware Drivers
├── ADC (current, temperature, voltage)
├── PWM (Phase A, B, C for each motor)
├── I2C (slave mode)
└── GPIO (LED, reset, etc.)
Interrupt Frequency Purpose
Back-EMF Zero-Crossing 12×/revolution Rotor position update
PWM Timer (10 kHz) 10,000/sec PID loop tick
I2C Bus Variable (async) Command reception
ADC Completion 1,000/sec Current/temperature sampling
Watchdog 1/sec Detect firmware hang

Condor Flight Control @ 90 Hz
│
├─ Attitude Error = Desired - Observed
│
├─ PID Loop:
│ Motor1_RPM = Base + Roll_Correction + Pitch_Correction + Yaw_Correction
│ Motor2_RPM = Base + Roll_Correction - Pitch_Correction - Yaw_Correction
│ Motor3_RPM = Base - Roll_Correction - Pitch_Correction + Yaw_Correction
│ Motor4_RPM = Base - Roll_Correction + Pitch_Correction - Yaw_Correction
│
└─ I2C → BLDC Controller
│
├─ For each motor:
│ set_ref_speed(motor_id, rpm_value)
│
└─ Soft-limit checks:
├─ Max RPM clamped to 16,000
├─ Min RPM = 1,000 (prevent stall)
└─ Rate-limit: Max 2000 RPM/sec change
BLDC Controller @ 10 kHz (internally)
│
└─ Downsampled to 90 Hz for host
│
├─ Observed Speed (ObsSpeed)
├─ Battery Voltage (Vbat)
├─ Motor Faults (Motor_Faults bitmask)
├─ PSOC Temperature (Temp_Celsius)
│
└─ I2C → Condor Flight Control
│
├─ Log telemetry
├─ Detect faults (error code check)
├─ Adjust thrust limit if overheating
└─ Trigger failsafe if communication lost

  • Parse version on startup (identify firmware variant)
  • Initialize I2C @ 100 kHz
  • Implement CRC-16-CCITT calculation
  • Handle set_ref_speed() at 90 Hz (motor mixing)
  • Poll get_observed_data() synchronously (no async reads)
  • Monitor status flags for faults
  • Implement motor startup sequence:
    • Call simple_start_motors() with props OFF
    • Wait for RUNNING status
    • Ramp reference speed from 0 → setpoint over 2 seconds
  • Implement failsafe:
    • Detect set_ref_speed() timeout → assume BLDC disconnected
    • Trigger immediate land (motor cutoff)
  • Log motor diagnostics (telemetry for ground station)

9.2 PSOC Firmware Requirements (Reverse-Engineered)

Section titled “9.2 PSOC Firmware Requirements (Reverse-Engineered)”
  • I2C slave @ address 0x08
  • CRC validation on all frames
  • Command dispatch (0x00-0x09)
  • 4-motor commutation engine (back-EMF sensorless)
  • PID speed controller (10 kHz loop)
  • State machine (IDLE, RAMPING, RUNNING, CRITICAL)
  • Soft-start ramp (~500 ms)
  • Error detection:
    • Low-voltage cutoff (9.0V)
    • Commutation loss detection
    • Over-temperature (120°C)
    • MOSFET fault detection
    • Stall timeout
  • Motor atomic startup (all 4 together, direction configurable)

Test vectors (to verify CRC-16-CCITT implementation):

# Test 1: Simple command
frame = [0x00] # get_version
crc = crc16_ccitt(frame)
# Expected: 0x0000 or specific known value (to be determined by capture)
# Test 2: set_ref_speed (Motor 0, 8000 RPM)
frame = [0x01, 0x00, 0x1F, 0x40] # 0x1F40 = 8000
crc = crc16_ccitt(frame)
# Capture actual response to verify

How to determine correct CRC:

  1. Connect to real Bebop 2 BLDC
  2. Send known command, capture response
  3. Extract CRC bytes from response
  4. Compare against all CRC polynomial candidates
  5. Determine seed, polynomial, and reflection mode
Terminal window
# Using logic analyzer or i2c-tools
i2cdump -y 1 0x08 # Dump BLDC I2C memory
# Or trace live I2C bus
i2ctransfer -y 1 w3@0x08 0x00 0xXX 0xXX r3@0x08

CORRECTED 2026-10-01 (safety). The command sequence that stood here was wrong and has been removed. It labelled -C as “stop_motors” (it only clears the error flag and does NOT stop the motors), -s as set_ref_speed (it builds a step or pulse profile that -l/-L/-p then launch), -d as get_observed_data (it is the step duration) and -O as “version and status” (it prints observed speed). Do not run this tool from a note. Spinning motors needs Ryan’s explicit OK and props off.

Flag meanings as printed by the tool’s own usage text (strings usr/bin/BLDC_Test_Bench):

Flag Long name Effect
-I --get_info read information from the BLDC
-O --get_obs_speed read observed speed (the factory script parses its output)
-H --stop_motors stop spinning the motors
-C --clear_error clear the BLDC error flag only
-S --secure_start_motors start motors (automatic clear error)
-D --direction_start_motors start with arbitrary direction (automatic clear error)
-R --set_ref_speed RPM1..RPM4 set per-motor reference speed
-s --steps ... build a step/pulse profile (launched by -l, -L or -p)
-d --duration DUR duration of steps
-N --No_halt_on_error keep turning motors even if the BLDC reports an error
-E --EEPROM_clear clear the BLDC EEPROM
-w --write_set ID VAL write a motor setting

The authoritative flag table with risk notes is in docs/notes/firmware-4.7.1.md.


  • I2C address: 0x08 ✓
  • Transaction model: Write-Read with CRC ✓
  • Soft-start duration: ~500 ms ✓
  • Max RPM: 16,000 ✓
  • 4-motor atomic startup ✓
  • State machine (IDLE/RAMPING/RUNNING/CRITICAL) ✓
  • Error codes (LVC, MOSFET, stall) ✓
  • Telemetry frame format (Vbat, RefSpeed, ObsSpeed, PWM) ✓
  • Commutation via back-EMF zero-crossing ✓
  • 10 kHz internal PID loop ✓
  • Soft-start ramp 0% → 20% PWM ✓
  • CRC-16-CCITT (polynomial 0x1021) — TO BE CONFIRMED
  • Motor thermal limit at 120°C ✓
  • Stall timeout ~1 second ✓
  • Exact CRC polynomial, seed, reflection mode
  • PID gain values (Kp, Ki, Kd) — inferred from test output
  • Hall sensor fallback threshold
  • Commutation event-to-PWM latency (estimated ~50 μs)
  • Motor coil inductance / resistance
  • Back-EMF filter cutoff frequency
  • Internal PSOC clock speed (likely 48 MHz or 24 MHz)
  • Watchdog timeout (likely 1-2 seconds)
  • Whether direction changes are persisted to EEPROM
  1. CRC Algorithm:

    • Send 0x00 (get_version), capture response CRC
    • Try candidate algorithms until one matches
    • Command: i2cset -y 1 0x08 0x00 with logic analyzer
  2. Motor Parameters:

    • Measure no-load RPM at various voltages
    • Calculate Kv (RPM per volt)
    • Measure max current, max power
  3. Temperature Sensor Calibration:

    • Measure actual PSOC temperature (thermal imaging)
    • Compare to reported value in get_status() response
  4. Commutation Timing:

    • Oscilloscope captures of phase voltage and PWM
    • Measure phase-switching latency

  • PSOC Firmware: firmware/extracted/bebop-2-4.7.1/rootfs/lib/firmware/BLDC.cyacd
  • Test Binary: firmware/extracted/bebop-2-4.7.1/rootfs/usr/bin/BLDC_Test_Bench
  • Test Binary: firmware/extracted/bebop-2-4.7.1/rootfs/usr/bin/test-BLDC
  • Factory Test Script: firmware/extracted/bebop-2-4.7.1/rootfs/lib/firmware/BLDC_Factory_Tests.sh
  • I2C Tools: i2c_cmd, i2cset, i2cget, i2cdump in /usr/bin/
  • Hardware Map: HARDWARE_REVERSE_ENGINEERING.md
  • Flight Control: FLIGHT_CONTROLLER_MAP.md
  • ACQCON_colibry_Thread_Handler() — Main flight loop
  • setAttitude() — Attitude command entry point
  • HAL_BLDC_* — Motor control HAL functions
  • MTB_BLDC_* — Motor test bench functions

13. Appendix: CRC-16-CCITT Reference Implementation

Section titled “13. Appendix: CRC-16-CCITT Reference Implementation”
def crc16_ccitt(data, seed=0xFFFF, poly=0x1021, xor_out=0x0000, reflect_in=False, reflect_out=False):
"""
CRC-16-CCITT with configurable parameters.
Args:
data: bytes to checksum
seed: initial CRC value (typically 0xFFFF)
poly: polynomial (typically 0x1021 for CCITT)
xor_out: final XOR value (typically 0x0000)
reflect_in: reflect input bytes
reflect_out: reflect output CRC
Returns:
16-bit CRC value
"""
crc = seed
for byte in data:
if reflect_in:
byte = int('{:08b}'.format(byte)[::-1], 2)
crc ^= (byte << 8)
for _ in range(8):
crc <<= 1
if crc & 0x10000:
crc ^= poly
crc &= 0xFFFF
if reflect_out:
crc = int('{:016b}'.format(crc)[::-1], 2)
crc ^= xor_out
return crc
def make_frame(cmd, *params):
"""Construct I2C frame with CRC."""
data = [cmd] + list(params)
crc = crc16_ccitt(data)
data.append(crc & 0xFF) # CRC-LO
data.append((crc >> 8) & 0xFF) # CRC-HI
return bytes(data)
def verify_frame(frame):
"""Verify CRC in received frame."""
if len(frame) < 3:
return False, "Frame too short"
data = frame[:-2]
crc_expected = (frame[-1] << 8) | frame[-2]
crc_actual = crc16_ccitt(data)
if crc_actual != crc_expected:
return False, f"CRC mismatch: got {crc_actual:04x}, expected {crc_expected:04x}"
return True, "OK"
# Test
cmd_frame = make_frame(0x00) # get_version
print(f"get_version frame: {' '.join(f'{b:02x}' for b in cmd_frame)}")
resp_frame = bytes([0x02, 0x00, 0x45, 0x04]) # Version 2.0.E, 4 motors (hypothetical)
valid, msg = verify_frame(resp_frame)
print(f"Response valid: {valid} ({msg})")

To Find Correct CRC:

  1. Capture I2C bus traffic from real Bebop 2
  2. Extract command and response frames
  3. Try all combinations:
    • seed: [0xFFFF, 0x0000]
    • poly: [0x1021, 0x8005]
    • xor_out: [0x0000, 0xFFFF]
    • reflect_in: [True, False]
    • reflect_out: [True, False]
  4. One combination will produce matching CRCs

  1. Obtain I2C capture from real Bebop 2 BLDC communication

    • Extract 5-10 command/response pairs
    • Use logic analyzer or i2c-tools with strace
  2. Determine CRC algorithm

    • Apply reference implementation with parameter sweep
    • Validate against captured frames
  3. Implement host-side library

    • Python: smbus2 or smbus for I2C
    • C: Linux i2c-dev ioctl interface
  4. Validate motor control

    • Soft-start sequence (0 → 8000 RPM over 2 seconds)
    • Telemetry feedback (verify ObsSpeed matches setpoint)
    • Failsafe: detect loss of communication
  5. Characterize motor behavior

    • Power consumption vs RPM
    • Thermal limits under sustained flight
    • Recovery time from over-temp fault

Document Version: 1.0
Last Updated: 2026-10-01
Status: Ready for experimental validation


Appendix A: PSOC Silicon & Bootloader Analysis

Section titled “Appendix A: PSOC Silicon & Bootloader Analysis”

CYACD Firmware Header: 1E0680690300

  • Silicon ID: 0x1E → PSoC3 or PSoC5LP family
  • Silicon Revision: 0x06 → Specific variant within PSoC3/PSoC5 line
  • Checksum Type: 0x80 → Cypress bootloader format (type encoding)

PSOC5LP Characteristics:

  • CPU: 8051-compatible core @ 24 or 48 MHz
  • Flash: 32-64 KB (typical for this application)
  • SRAM: 4-8 KB
  • Peripherals: I2C, SPI, PWM, ADC, Timer, GPIO
  • Architecture: Harvard (separate code/data spaces)

Firmware File Format: CYACD (Cypress Archive ACD)

Record Structure:

:[ArrayID][RowNum_HI][RowNum_LO][Len_HI][Len_LO][Data...][Checksum_HI][Checksum_LO]

Example (first record):

:00 0019 0100 023EF3008F828E83E0540100000070F8...2278FFE4F6D8FD023F25EC4D601... [Checksum]
Array=0, Row=0x0019, Len=256 bytes, Data=...

Bootloader Command Structure (discovered from BLDC_Host_Bootloader binary analysis):

The bootloader runs in a separate mode before the main application. Commands include:

Command Purpose Notes
StartBootloader Initiate bootload process BLDC switches to bootloader mode
Verify Key Authentication handshake Key matching prevents accidental flashing
GetSiliconID Read chip identification Response: Silicon ID + Revision
SetDataRowCount Configure data packet size Specifies bytes per row (typically 256)
WriteFlash Program flash array Data + CRC verification per row
VerifyRowChecksum Validate programmed data Post-write check
VerifyApplication Validate firmware integrity Full CRC of application
SetActiveApplication Mark firmware as bootable Switch to run application
EndBootloader Exit bootloader mode Resume normal operation

BLDC Bootloader Return Codes (from firmware strings):

Code Error Severity
(unspecified) Completed successfully OK
0xXX Key does not match Security failure
0xXX Verification of flash failed Flash integrity
0xXX Data amount outside expected range Protocol error
0xXX Data not of proper form Format error
0xXX Command not recognized Unknown command
0xXX Device does not match Wrong target
0xXX Bootloader version not supported Old firmware
0xXX Checksum does not match Data corruption
0xXX Flash array not valid Hardware error
0xXX Flash row not valid Address error
0xXX Flash row protected Write protection
0xXX Application not valid Bad image
0xXX Application currently marked active Already running

BLDC_Host_Bootloader Return Messages:

  • Communication link failure (I2C timeout)
  • Bootloader version < 3.30 not supported
  • File access failure (bad .cyacd file)
  • Data bytes not in expected range
  • Motor firmware data not proper form
  • Device is not BLDC card
  • Checksum mismatch detected
  • Flash array invalid
  • Flash row invalid
  • Unknown/unhandled error
  • Operation aborted by user
  • Firmware file ended unexpectedly
  • Motor firmware could not be flashed (restore backup)
  • File is not BLDC firmware

Bootloader Detection:

  • After reset, PSOC enters bootloader if no valid application found
  • Application validity checked via CRC of entire flash image
  • User can force bootloader entry via GPIO or command

Mode Transitions:

Power-On Reset
↓
PSOC Bootloader (Cypress factory ROM)
↓
Check Flash Validity → CRC OK?
├─ YES: Jump to Application @ 0x0000
└─ NO: Wait for I2C bootload commands
Bootload Process:
1. Host sends StartBootloader
2. Device acknowledges, reports Silicon ID
3. Host sends firmware rows (CYACD data)
4. Device verifies each row's CRC
5. Host sends VerifyApplication (full image CRC)
6. Device validates entire flash
7. Host sends SetActiveApplication
8. Device marks app valid, enters AppStartupSequence
9. Host sends EndBootloader
10. Device jumps to 0x0000 (application start)

File Structure:

Line 0: [SiliconID][SiliconRev][ChksumType][Metadata]
Line 1+: :[ArrayID][RowNum_HI][RowNum_LO][Len_HI][Len_LO][Data bytes...][Chksum_HI][Chksum_LO]

Field Details:

  • SiliconID (2 chars): Hex identifier for MCU family

    • 1E = PSoC3 / PSoC5
  • SiliconRev (2 chars): Revision within family

  • ChksumType (2 chars): Checksum algorithm

    • 00 = Simple XOR or sum
    • 01 = CRC variant 1
    • 80 = Cypress proprietary (file carries metadata, not validated at parse)
  • ArrayID (2 chars): Flash array selection

    • 00 = Main flash
    • 01 = Auxiliary flash
    • Others = Special regions (config, etc.)
  • RowNum (4 chars): 16-bit row address

    • Physical address = RowNum × 64 bytes (for PSoC5)
  • Len (4 chars): 16-bit data length (usually 256 for main array rows)

  • Data: Raw bytes to flash (hex encoded, 2 chars per byte)

  • Checksum: Row-level checksum (format TBD, see notes below)

Bootloader CRC Validation:

The bootloader verifies downloaded firmware via:

  1. Row-level CRC: Each CYACD row has embedded checksum
  2. Image-level CRC: Full firmware image CRC before marking as valid
  3. Application CRC: Stored at fixed location in flash, verified on boot

CRC Type: Likely CRC-16 or CRC-32 (PSoC5 supports both)

  • Common: CRC-32 polynomial 0x04C11DB7 (Ethernet polynomial)
  • Or: CRC-16-CCITT 0x1021 (matching motor control protocol)

Location: Firmware CRC likely stored at:

  • End of flash (last 4 bytes)
  • Fixed address in config row
  • Or computed dynamically at startup

After bootloader marks firmware valid and jumps to 0x0000:

  1. Hardware Initialization (~10 ms):

    • Clock configuration (24 MHz or 48 MHz)
    • Power supply stabilization
    • GPIO configuration
  2. I2C Slave Setup (~1 ms):

    • Address = 0x08 (hardcoded in firmware)
    • Clock speed = 100 kHz (compatible with main I2C bus)
    • Enable interrupts
  3. Motor Driver Initialization (~5 ms):

    • PWM module setup (one per motor, 3 phases each)
    • Back-EMF sampling configuration
    • Current sense ADC channels
    • Timer for 10 kHz PID loop
  4. State Machine Reset:

    • Enter IDLE state
    • Clear error flags
    • Set default PID gains from EEPROM
  5. Ready for Commands:

    • Acknowledge via response to get_version
    • Start responding to motor commands
0x0000-0x7FFF: Flash (32-64 KB typical)
0x0000-0x0010: Interrupt vectors (8051 style)
0x0011-0x7F00: Application code (main bootloader instructions)
0x7F00-0x7FFF: Configuration / Constants
- PID gains (Kp, Ki, Kd per motor)
- Motor electrical parameters (Kv, etc.)
- CRC of application
- Hardware configuration flags
0xF900-0xFFFF: Special Function Registers (SFRs)
0xF900-0xF9FF: Port I/O
0xFA00-0xFAFF: Timer / Counter
0xFB00-0xFBFF: SPI / I2C
0xFC00-0xFCFF: ADC
0xFD00-0xFDFF: PWM
0xFE00-0xFEFF: PSOC API registers
0xFF00-0xFFFF: General-purpose SFRs

Appendix B: Motor Test Tool (BLDC_Test_Bench)

Section titled “Appendix B: Motor Test Tool (BLDC_Test_Bench)”

CORRECTED 2026-10-01 (safety). The option list that stood here was wrong on most lines. Examples: -C only clears the error flag (-H stops motors), -s builds a step/pulse profile (-R sets reference speeds), -l launches a prepared speed wave (it does not load a CSV; -c reads a CSV), -M plays sound (it does not set spin direction), -X sets the I2C timeout (it does not set a voltage), and -F computes the static feedforward polynomial with the BLDC in open loop (it is not a factory self-test). See the table in section 10.3 and docs/notes/firmware-4.7.1.md; for anything else, read the usage text with strings usr/bin/BLDC_Test_Bench and do not rely on this file.

BLDC_Factory_Tests.sh sequence:

  1. Alive Check:

    Terminal window
    i2c_cmd | grep "0x8" # Scan for device at 0x08
  2. Get Status:

    Terminal window
    BLDC_Test_Bench -n -O # as the factory script runs it; -O is --get_obs_speed (the script parses voltage, errno and fault fields from its output); version comes from -I
  3. Voltage Monitoring:

    • Nominal: 9.5V (95 decivolts)
    • Check tolerance: ±1 unit
  4. Error Code Check:

    • 0x00 = OK
    • 0x0A = Battery LVC (failure)
    • 0x0B = MOSFET short (failure)
  5. Motor Fault Detection:

    • Parse status response for faulted motor bitmask
  6. GPIO Reset Test:

    • Pull XRES (GPIO 199) low → PSOC resets
    • Verify device disappears from I2C bus
    • Release GPIO → device reappears
    • Verify with bootloader upload (BLDC_Host_Bootloader)

CSV Log Entry:

Message Vbat TicksSpeed RefSpeed ObsSpeed SatSpeed Feedforward IntegralPID PIDres PWM
[timestamp] [V] [Hz] [RPM] [RPM] [RPM] [0-255] [int] [int] [0-255]

Example:

0 95 2151 16000 15999 16000 204 32 15 171
1 95 2150 16000 15998 16000 203 33 16 172

In open-loop mode, the PSOC ignores observed speed and drives a fixed PWM:

  • Input: set_ref_speed() with PWM value (0-255)
  • Output: Direct PWM to motor phases
  • Use Case: Motor characterization (power vs. speed curve)
  • Max Value: 255 (100% PWM)

Test Indication:

if (firmware_compiled_with_test_mode) {
// Can set reference as PWM (0-255) instead of RPM
// Response includes OpenLoop flag
} else {
// Reference always interpreted as RPM (0-16000)
// Firmware reports: "WARNING: not compiled in test bench mode"
}

If firmware compiled with extended commands, can read/write motor calibration:

[0x0A] [Motor_ID] # Read motor settings
→ [Kp] [Ki] [Kd] [Max_Amps] [...]
[0x0B] [Motor_ID] [Param] [Value] # Write motor settings
→ [Status]

Settable Parameters:

  • PID gains (Kp, Ki, Kd)
  • Current limits per motor
  • Speed ramp rate
  • Back-EMF detection threshold
  • Commutation angle offset

Single Unified BLDC Controller:

  • 4 Motor Connectors: Each motor phase → ESC-style 3-phase output
  • Power Input: Main battery connector (11.1V nominal, 3S LiPo)
  • I2C Connector: To P7 SoC @ /dev/i2c-1
  • Reset Line: GPIO 199 (active-low XRES)
  • Status LEDs: Red (error), Green (heartbeat)
  • Bootloader Button: For manual firmware recovery

Motor Power:

  • 4× brushless motors, ~7W each = ~28W total at full throttle
  • Peak current: ~2.5A per motor = 10A total
  • Battery voltage: 11.1V (9.0V min, 12.6V max)

Logic Power:

  • PSOC5 @ 3.3V (LDO regulator from main battery)
  • Quiescent current: ~50 mA
  • Active current: ~200 mA (depends on switching frequency)
  • PSOC5 Sensor: Integrated die temperature sensor
  • Thermal Limit: 120°C (hard cutoff)
  • Throttling: Reduce PWM at 90°C
  • Dissipation: Mainly through H-bridge MOSFETs (PWM × I²R losses)
  • Mounting: Thermal contact to frame for passive cooling

Status: Bootloader analysis complete, firmware architecture mapped, I2C protocol specification ready for field validation.

Next: Obtain real I2C capture to verify CRC algorithm and exact command format.

Comments

Spotted a mistake, or tried this on your own Bebop? Leave a note. Comments are kept on this site's own server.