Skip to content
/ bldc Public
forked from vedderb/bldc

The code for my custom BLDC controller.

Notifications You must be signed in to change notification settings

Oh-oo/bldc

This branch is 2449 commits behind vedderb/bldc:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

be439a2 · May 29, 2021
Mar 21, 2020
Dec 7, 2020
Dec 7, 2020
Dec 30, 2020
May 29, 2021
Oct 25, 2019
May 29, 2021
Aug 26, 2020
Dec 4, 2020
Dec 6, 2020
Jul 21, 2020
Feb 18, 2019
Mar 16, 2020
Jan 31, 2019
Jan 11, 2021
May 7, 2021
Jan 11, 2021
Apr 12, 2021
Oct 22, 2020
Oct 22, 2020
Sep 6, 2017
Sep 6, 2017
Jan 25, 2019
Nov 4, 2016
Mar 16, 2020
Dec 14, 2020
Nov 18, 2020
Mar 22, 2020
Jan 12, 2020
Jan 12, 2020
Jan 12, 2020
Dec 4, 2020
Nov 29, 2020
Oct 9, 2020
May 29, 2021
Dec 9, 2020
Dec 18, 2020
Apr 18, 2019
Apr 16, 2019
Dec 18, 2020
Nov 4, 2016
Nov 4, 2016
Mar 16, 2020
Mar 16, 2020
Nov 30, 2020
Nov 30, 2020
Sep 3, 2019
Sep 3, 2019
Apr 3, 2020
Feb 18, 2019
Jan 12, 2020
May 3, 2019
May 3, 2019
Apr 3, 2020
Oct 8, 2015
Apr 18, 2019
Jan 28, 2019
Nov 4, 2016
Mar 16, 2020
Jul 21, 2020
Apr 29, 2020
Dec 18, 2020
Oct 4, 2020
Apr 3, 2020
Dec 7, 2019
May 7, 2021
Apr 16, 2020
Nov 30, 2020
May 9, 2020
Mar 16, 2020
Feb 18, 2019
Feb 18, 2019
Feb 28, 2018
Jul 1, 2019
Nov 4, 2016
Jul 21, 2020
Nov 4, 2016
Oct 4, 2020
Dec 9, 2019
Jul 21, 2020
Jul 21, 2020
Jan 9, 2014
Jan 28, 2019
Nov 30, 2020
Sep 3, 2019
Mar 16, 2020
Jan 24, 2019
Mar 10, 2019
Mar 10, 2019
Oct 22, 2020
Oct 9, 2020
Jun 20, 2020
Jun 20, 2020
Mar 16, 2020
Mar 16, 2020
Jan 28, 2019
Nov 4, 2016

Repository files navigation

VESC firmware

License: GPL v3 Travis CI Status Codacy Badge Contributors Watchers Stars Forks

An open source motor controller firmware.

This is the source code for the VESC DC/BLDC/FOC controller. Read more at https://vesc-project.com/

Supported boards

All of them!

Make sure you select your board in conf_general.h

//#define HW_SOURCE "hw_40.c"
//#define HW_HEADER "hw_40.h"

//#define HW_SOURCE "hw_45.c"
//#define HW_HEADER "hw_45.h"

//#define HW_SOURCE "hw_46.c" // Also for 4.7
//#define HW_HEADER "hw_46.h" // Also for 4.7

//#define HW_SOURCE "hw_48.c"
//#define HW_HEADER "hw_48.h"

//#define HW_SOURCE "hw_49.c"
//#define HW_HEADER "hw_49.h"

//#define HW_SOURCE "hw_410.c" // Also for 4.11 and 4.12
//#define HW_HEADER "hw_410.h" // Also for 4.11 and 4.12

#define HW_SOURCE "hw_60.c"
#define HW_HEADER "hw_60.h"

//#define HW_SOURCE "hw_r2.c"
//#define HW_HEADER "hw_r2.h"

//#define HW_SOURCE "hw_victor_r1a.c"
//#define HW_HEADER "hw_victor_r1a.h"

//#define HW_SOURCE "hw_das_rs.c"
//#define HW_HEADER "hw_das_rs.h"

//#define HW_SOURCE "hw_axiom.c"
//#define HW_HEADER "hw_axiom.h"

//#define HW_SOURCE "hw_rh.c"
//#define HW_HEADER "hw_rh.h"

//#define HW_SOURCE "hw_tp.c"
//#define HW_HEADER "hw_tp.h"

//#define HW_SOURCE "hw_75_300.c"
//#define HW_HEADER "hw_75_300.h"

//#define HW_SOURCE "hw_mini4.c"
//#define HW_HEADER "hw_mini4.h"

//#define HW_SOURCE "hw_das_mini.c"
//#define HW_HEADER "hw_das_mini.h"

//#define HW_SOURCE "hw_uavc_qcube.c"
//#define HW_HEADER "hw_uavc_qcube.h"

//#define HW_SOURCE "hw_uavc_basic.c"
//#define HW_HEADER "hw_uavc_basic.h"

There are also many other options that can be changed in conf_general.h

Prerequisites

On Ubuntu

Install the gcc-arm-embedded toolchain. Recommended version gcc-arm-none-eabi-7-2018-q2

Method 1 - Through Official GNU Arm Embedded Toolchain Downloads

  1. Go to GNU Arm Embedded Toolchain Downloads
  2. Locate and Download version gcc-arm-none-eabi-7-2018-q2 for your machine
    GNU Arm Embedded Toolchain: 7-2018-q2-update June 27, 2018
    Linux 64-bit version can be downloaded from here
  3. Unpack the archive in the file manager by right-clicking on it and select "extract here"
  4. Change directory to the unpacked folder, unpack it in /usr/local by execute the following command
    cd gcc-arm-none-eabi-7-2018-q2-update-linux  
    sudo cp -RT gcc-arm-none-eabi-7-2018-q2-update/ /usr/local  
    

Method 2 - Through apt install

sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt update
sudo apt install gcc-arm-embedded

Optional - Add udev rules to use the stlink v2 programmer without being root

wget vedder.se/Temp/49-stlinkv2.rules
sudo mv 49-stlinkv2.rules /etc/udev/rules.d/
sudo udevadm trigger

On MacOS

Go to the GNU ARM embedded toolchain downloads Website and select the mac version, download it and extract it to your user directory.

Append the bin directory to your $PATH. For example:

export PATH="$PATH:/Users/your-name/gcc-arm-none-eabi-8-2019-q3-update/bin/"

Install stlink and openocd

brew install stlink
brew install openocd

Build

Clone and build the firmware

git clone https://github.com/vedderb/bldc.git vesc_firmware
cd vesc_firmware
make

Upload to VESC

Method 1 - Flash it using an STLink SWD debugger

Build and flash the bootloader first

make upload

Method 2 - Upload Firmware via VESC tool through USB

  1. Clone and build the firmware in .bin format

Reminder : Remember to select your board in [conf_general.h]

git clone https://github.com/vedderb/bldc.git vesc_firmware
cd vesc_firmware
#make build/your_firmware_name_here.bin
make build/VESC_fw.bin 

In VESC tool

  1. Connect to the VESC
  2. Navigate to the Firmware tab on the left side menu
  3. Click on Custom file tab
  4. Click on the folder icon to select the built firmware in .bin format (e.g. VESC_fw.bin)
[ Reminder : It is normal to see VESC disconnects during the firmware upload process ]
[ Warning : DO NOT DISCONNECT POWER/USB to VESC during the upload process, or you will risk bricking your VESC ]
[ Warning : ONLY DISCONNECT your VESC 10s after the upload loading bar completed and "FW Upload DONE" ]
  1. Press the upload firmware button (downward arrow) on the bottom right to start upload the selected firmware.
  2. Wait for 10s after the loading bar completed (Warning: unplug sooner will risk bricking your VESC)
  3. The VESC will disconnect itself after new firmware is uploaded.

In case you bricked your VESC

you will need to upload a new working firmware to the VESC.
However, to upload a firmware to a bricked VESC, you have to use a SWD Debugger.

Contribute

Head to the forums to get involved and improve this project.

License

The software is released under the GNU General Public License version 3.0

About

The code for my custom BLDC controller.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 77.3%
  • C++ 16.8%
  • Assembly 3.0%
  • Objective-C 1.9%
  • Other 1.0%