Skip to content

About

Open-source 24-step vector-interpolated sinusoidal startup firmware for 8-bit Silicon Labs EFM8 (BLHeli_S) ESCs in pure 8051 assembly.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SineHeli-S (Sinusoidal Helicopter - Silabs) — EARLY BETA

⚠️ EARLY BETA SOFTWARE — FLASH AT YOUR OWN RISK

SineHeli-S is experimental, early-beta firmware. While tested on bench hardware (J-L-30), it has not been flight-tested across every ESC layout, motor KV, or battery voltage. Flashing custom firmware can damage or destroy your ESC, motor, or battery. Remove all propellers, use a smoke stopper or current-limited bench PSU, and flash strictly at your own risk.

Open-Source 24-Step Vector-Interpolated Sinusoidal Startup Firmware for 8-Bit Silicon Labs BLHeli_S ESCs

Status: Early Beta License: GPL v3 Architecture: 8051 / EFM8 Targets: A_L - Z_H


🌟 Overview

SineHeli-S (Sinusoidal Helicopter - Silabs) is an experimental early-beta fork of BLHeli_S REV16.7 that adds open-loop sinusoidal startup to 8-bit Silicon Labs EFM8 microcontrollers in 8051 assembly.

Instead of stepping abruptly between discrete 60° commutation states during initial spin-up, SineHeli-S divides each electrical revolution into 24 interpolated sub-angles using Bresenham state dithering, ramping commutation frequency from 0 RPM up to handoff speed before transitioning into standard BLHeli_S closed-loop back-EMF commutation.


🙏 Tribute & Credits

SineHeli-S is built directly on top of BLHeli_S by Steffen Skaug (4712).

All low-level MOSFET gate-driver abstractions, dead-time delays (FETON_DELAY), closed-loop back-EMF commutation, thermal/voltage protections, and configurator EEPROM structures remain intact from BLHeli_S REV16.7. This project is licensed under the GNU General Public License v3.0 (GPLv3) so the source code remains open and free for everyone.


✨ What Sinusoidal Startup Provides

  • Reduced Low-RPM Cogging & Stutter: Replaces abrupt 60° startup steps with 24 interpolated vector angles per electrical revolution, reducing low-speed rotor clicking and step jitter before back-EMF lock.
  • Controlled Initial Magnetic Lock: Applies a continuous rotating magnetic field from 0 RPM, helping the rotor align and accelerate smoothly through initial static friction without bouncing backward.
  • Predictable Open-Loop Acceleration: Ramps electrical commutation frequency deterministically over ~870 ms up to handoff speed (~7.5 ms/sector) before switching to sensorless trapezoidal drive.
  • Preserved BLHeli_S Safety & Hardware Layer:
    • Intact Dead-Time (FETON_DELAY): All phase switching uses stock .inc layout macros and hardware PCA interrupts (pca_int).
    • Hard Duty Ceiling (SINE_PWM_MAX = 24): Caps open-loop startup duty at ~9.4% (24 / 255) to limit standstill current across multirotors, RC crawlers, cars, and boats.
    • Throttle-Drop & Signal-Loss Cutoff (sine_abort): Polls New_Rcp and Rcp_Timeout_Cntd every time slot; dropping throttle to zero or losing RX signal immediately cuts all FETs.
    • 48-Sector Stall Watchdog (sine_timeout): Aborts startup, turns all FETs OFF, increments Stall_Cnt, and triggers fault beeps if the motor stalls or jams during the open-loop ramp.
  • Zero Extra RAM Usage: Uses existing scratchpad registers (Temp1–Temp8), keeping internal RAM at the stock data=177.0 bytes baseline.
  • Configurator Compatibility: Compatible with ESC Configurator, BLHeli Configurator, and BLHeliSuite (direction reversal, timing, demag compensation, beacon, and PWM/OneShot/Multishot/DShot protocols).

⚖️ Stock BLHeli_S vs. SineHeli-S (Early Beta)

Feature Stock BLHeli_S (REV16.7) SineHeli-S (v1.0 Early Beta)
Release Status Mature / Production Early Beta — Flash at your own risk
Startup Commutation Discrete 6-step trapezoidal 24-angle vector-interpolated sinusoidal
Low-RPM Behavior Discrete 60° rotor steps Reduced low-RPM cogging and step jitter
MOSFET Dead-Time (FETON_DELAY) Hardware-enforced via pca_int Preserved untouched
Stall Protection Stock startup timeout 48-sector watchdog + FET cutoff & fault beep
Configurator Settings Full support Compatible (identifies as REV16.7 layout)
Flash Size (J_L_30) 5,833 bytes 6,217 bytes (436 bytes below 0x19FD limit)

🔧 How It Works

Because EFM8 BLHeli_S hardware routes two crossbar PWM channels (CEX0 active power PWM and CEX1 complementary damped-light PWM) across one active phase at a time via P1SKIP, SineHeli-S synthesizes sinusoidal rotation without requiring three simultaneous hardware PWM channels:

[Arm & Throttle > 0]
        │
        ▼
┌───────────────────────────────┐
│ 1. Zero-State Entry           │ ──► All FETs OFF, PWM latched to 0%, Pwm_Limit_Beg clamped <= 24
└───────────────────────────────┘
        │
        ▼
┌───────────────────────────────┐
│ 2. 24-Angle Vector Ramp       │ ──► 16 slots/sector × Bresenham state dithering (0/4..3/4)
│    (sine_sector / sine_slot)  │     Duty ramps 6 → 12 → 18 → 24 (~9.4% cap)
│                               │     Polls throttle & 48-sector stall watchdog every slot
└───────────────────────────────┘
        │ (Reached SINE_D_END at State 6 boundary)
        ▼
┌───────────────────────────────┐
│ 3. Angle-Locked Handoff       │ ──► Pure State 6 dwell → comm6comm1 → Seed Comm_Period4x_H = 0EAh
│    (sine_handoff)             │     Jumps stack-neutral directly into closed-loop run1
└───────────────────────────────┘

📦 Supported ESC Targets (HexFiles/) — Early Beta

Pre-compiled .HEX files for 528 L and H layouts (A_L_0 through Z_H_90) are included in HexFiles/ for beta testing (flash at your own risk):

  • L Layouts (MCU_48MHZ=0): Silicon Labs EFM8BB10 (24 MHz) — e.g., J_L_30_SineHeli-S_v1.0.HEX, H_L_30_SineHeli-S_v1.0.HEX, G_L_30_SineHeli-S_v1.0.HEX.
  • H Layouts (MCU_48MHZ=1): Silicon Labs EFM8BB21 (48 MHz) — e.g., H_H_40_SineHeli-S_v1.0.HEX, J_H_30_SineHeli-S_v1.0.HEX, C_H_30_SineHeli-S_v1.0.HEX.
  • X Layouts (A_X – E_X) Excluded: EFM8BB51/BB52 (MCU_48MHZ=2) targets are excluded from this beta release because 12-bit zero-duty scaling is not yet verified on hardware.

🚀 Flashing Instructions (Flash at Your Own Risk)

  1. Read Your Current ESC Layout: Connect your ESC to ESC Configurator, BLHeli Configurator, or BLHeliSuite and verify your exact target code (e.g., J-L-30 or H-H-40). Never flash a mismatched layout or H/L variant.
  2. Select the Matching .HEX File: from releases.
  3. Flash Local File:
    • Choose Flash Firmware -> Select File Locally in your configurator (or flash via an Arduino 4WAY-IF / C2 programmer).
    • Note: Because SineHeli-S keeps the REV16.7 EEPROM map intact for configurator compatibility, your configurator will still display version 16.7 after flashing.

⚠️ Mandatory Safety Precautions

  • EARLY BETA DISCLAIMER: This firmware is provided "AS IS" without warranty of any kind. You assume all risk of hardware damage, fire, or injury when flashing or running this software.
  • Always remove propellers before flashing or bench testing.
  • Always use a smoke stopper or current-limited bench power supply for your initial power-up and throttle tests.
  • Open-loop sinusoidal drive applies continuous low-duty current (~9.4% at SINE_PWM_MAX = 24) during the ~870 ms startup ramp. Monitor motor and ESC temperatures carefully, especially on low-resistance motors or high-cell-count batteries.

🛠️ Building from Source

  1. Install Silicon Labs Simplicity Studio v5 with the 8-bit / 8051 MCU (Keil C51/AX51) toolchain and activate the free Silicon Labs Keil 8051 license.
  2. Verify KeilPath in the batch build script points to your keil_8051\9.60\BIN directory.
  3. Configurable constants near line 331 of BLHeli_S.asm:
    SINE_ENABLE         EQU  1    ; 1 = SineHeli-S sinusoidal startup, 0 = Stock 6-step
    SINE_PWM_MAX        EQU  24   ; Peak startup duty limit (0-255 scale; 24 = ~9.4%)
    SINE_D_START        EQU  160  ; Initial slot dwell time (higher = slower initial spin)
    SINE_D_END          EQU  11   ; Handoff dwell time (~7.5 ms/sector)
    SINE_MAX_SECTORS    EQU  48   ; Stall watchdog sector limit
  4. Run the .bat build script to assemble all 528 L and H targets with 0 ERROR(S) into HexFiles/.

📄 License

Licensed under the GNU General Public License v3.0 (GPLv3). See the LICENSE file for full terms.

About

Open-source 24-step vector-interpolated sinusoidal startup firmware for 8-bit Silicon Labs EFM8 (BLHeli_S) ESCs in pure 8051 assembly.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages