Zur deutschen Version wechseln

Hoverboard Firmware Hack - How to

November 2017

Related Pages

Compiling and flashing the hacked firmware for the hoverboard-circuitboards isn’t obvious. So for me to remember what I have been doing and also maybe for those who want to try this too I wrote this short instruction which will describe what I did and what worked for me. Not saying its the only or even right way.

Also I’m not the creator of this hacked firmware and therefore I am not able to help with in-depth problems. Please also keep in mind that there is a probability that your board can be destroyed.

The current version of the Firmware can be found here: github.com/NiklasFauth/hoverboard-firmware-hack

Since Dezember 2019 I am using a fork by Emanuel Feru which supports FOC (Field Oriented Control): github.com/EmanuelFeru/hoverboard-firmware-hack-FOC

I’m assuming your using Linux, more specifically some kind of Ubuntu based Linux.

The programmer I am going to be using is a cheap ST-Link V2.

Compiling the firmware

In order to compile, gcc-arm is needed.

Your can get get it either by downloading the files yourself ( developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads ) and extracting the directory “gcc-arm-none-eabi-…” or the easy way:

sudo apt-get install gcc-arm-none-eabi

Edit: There could be problems with some versions. gcc-arm-none-eabi-7-2018-q2-update did the job for me.

After that you need to clone the firmware from Github:

git clone https://github.com/NiklasFauth/hoverboard-firmware-hack.git

or

git clone https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC.git

Then change to that directory and compile.

Most likely you’ll have to give the path to the downloaded gcc-arm toolchain in the “PREFIX” variable. I unpacked the directory from inside the gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2 file to my home directory. The corresponding line in the makefile then looks like this:

PREFIX = ~/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-

When thats done execute:

cd hoverboard-firmware-hack

make

If the file build/hover.bin exists compiling worked without problems.

Now you should make your own adjustments to the settings. This is mainly done by (un-)commenting things like control method in the Inc/config.h.

For example commenting out #define CONTROL_NUNCUCK: //#define CONTROL_NUNCUCK

and uncommenting the desired method like control speed and direction via potentiometer or a hallsensor: #define CONTROL_ADC

(Sometimes the endpoints have to be calculated and entered in the src/main.c file. Just search for #ifdef CONTROL_ADC.

Save and compile again:

make clean
make

STM32 Toolchain

sudo apt-get install openocd libusb-1.0-0-dev cmake build-essential
git clone https://github.com/texane/stlink
cd stlink

make release
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
cd Release
sudo make install
sudo ldconfig

Connecting the hoverboard:

st-info --probe

Unlocking the STM

On a fresh board the STM is locked an has to be unlocked in order to be able to write to it.

openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c init -c "stm32f1x unlock 0"

This is one line!

Flashing the firmware

st-flash write build/hover.bin 0x08000000

Testing

The board can now be powered up by pressing the power button. -> Funny beeping sounds.

Try increasing the throttle slowly. You can do this with only one motor connected.

I would recommend to use a bench power supply set to 40V and a current limit of 0.5A. If you’re using a power supply decrease the throttle slowly, currents from recuperation can kill your powersupply.

If the motor doesn’t turn even if a significant amount of current flows or the motor stutters you should first test all possible motor-controller wire configurations.

Good luck!