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/
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
Install the gcc-arm-embedded toolchain
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt update
sudo apt install gcc-arm-embedded
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
Install arm gnu gcc 7. Note that version 7 must be used, otherwise timing errors can occur.
./scripts/setup.sh
Then add the newly installed toolchain to your path:
export PATH=$(pwd)/toolchain/bin:${PATH}
Install stlink and openocd
brew install stlink
brew install openocd
The bootloader is included in the main firmware, so no need to flash it separately.
Clone and build the firmware
git clone https://github.com/nathantsoi/bldc.git vesc_firmware
cd vesc_firmware
make
Make and flash the firmware using an STLink SWD debugger
export PATH=$(pwd)/toolchain/bin:${PATH}
make upload
Install Eclipse Embedded and import the project as a makefile project
Create a new OpenOCD Debugging profile and include the same options as specified in the Makefile's make upload
target
Head to the forums to get involved and improve this project.
The software is released under the GNU General Public License version 3.0