Go to file
Benjamin Vedder ec4d84ef83 Merge commit '346f321b9f304400b46e050fcbf75a27b391bae3' 2022-03-02 09:57:01 +01:00
ChibiOS_3.0.5 Updated ChibiOS to 3.0.5 2020-03-21 20:14:20 +01:00
appconf Moved luna appconf 2022-01-02 22:53:19 +01:00
applications Merge remote-tracking branch 'origin/master' 2022-01-27 10:28:16 +01:00
blackmagic Fix blackmagic.mk line termination 2022-02-19 11:55:11 +07:00
build_all Added hw75_600 and hw_60_75 2022-02-05 19:00:49 +01:00
encoder As5047 encoder fixes 2022-02-28 14:30:48 +01:00
hwconf hw40 build fix 2022-02-28 19:00:29 +01:00
imu Lisp updates, imu refactoring and rate check 2022-02-28 14:29:59 +01:00
libcanard Decreased stack sizes to save ram 2022-01-16 21:57:12 +01:00
lispBM Merge commit '346f321b9f304400b46e050fcbf75a27b391bae3' 2022-03-02 09:57:01 +01:00
lora Decreased stack sizes to save ram 2022-01-16 21:57:12 +01:00
lzo Renamed compression to lzo, added observer offset parameter 2022-01-12 12:27:45 +01:00
mcconf Added support for custom NTC and PTC motor temperature sensors 2022-01-24 00:36:53 +01:00
nrf Decreased stack sizes to save ram 2022-01-16 21:57:12 +01:00
qmlui Collected luna-files in one place, removed some old files 2021-12-31 12:27:36 +01:00
tests Squashed 'lispBM/lispBM/' changes from ffbedbdf..ced143b0 2022-03-01 19:10:34 +01:00
.gdbinit gdb: Added command to dump entire stm32 flash to bin file. 2022-02-10 14:38:32 +01:00
.gitignore Squashed 'lispBM/lispBM/' content from commit 748477b9 2022-01-29 17:26:45 +01:00
.travis.yml Squashed 'lispBM/lispBM/' content from commit 748477b9 2022-01-29 17:26:45 +01:00
CHANGELOG Adapt flash operations to MCU voltage 2022-03-01 11:54:25 +01:00
CONTRIBUTING Correct spelling, broken links, and missing parameters in documentation 2021-05-07 15:27:50 -07:00
Makefile Squashed 'lispBM/lispBM/' changes from 6a219e20..7930b985 2022-02-21 12:02:15 +01:00
README.md Squashed 'lispBM/lispBM/' changes from 6a219e20..7930b985 2022-02-21 12:02:15 +01:00
bms.c Added new BMS counters 2021-04-08 22:34:01 +02:00
bms.h Added BMS module 2020-10-22 08:32:51 +02:00
board.c FW3.28: dual throttle curves, ntc beta factor config, board file added 2017-09-06 21:13:28 +02:00
board.h FW3.28: dual throttle curves, ntc beta factor config, board file added 2017-09-06 21:13:28 +02:00
buffer.c Handle subnormal numbers in float serialization 2021-06-09 19:20:48 +02:00
buffer.h FW 3.7 2016-11-04 15:18:34 +01:00
chconf.h Added stack checks 2022-01-17 22:15:48 +01:00
comm_can.c Moved state out of ts5700n8501 and moved all encoder state to own file 2022-02-20 13:44:01 +01:00
comm_can.h Added position PID offset support and KD_PROC term 2021-07-11 20:19:26 +02:00
comm_usb.c Decreased stack sizes to save ram 2022-01-16 21:57:12 +01:00
comm_usb.h FW 3.66: Many changes, see changelog 2020-01-12 21:25:21 +01:00
comm_usb_serial.c FW 3.66: Many changes, see changelog 2020-01-12 21:25:21 +01:00
comm_usb_serial.h FW 3.66: Many changes, see changelog 2020-01-12 21:25:21 +01:00
commands.c Added lisp repl 2022-03-01 12:07:27 +01:00
commands.h Lisp updates, imu refactoring and rate check 2022-02-28 14:29:59 +01:00
conf_general.c Merge branch 'master' into dev_fw_5_03 2022-01-21 15:07:44 +01:00
conf_general.h Start lispBM even without code on repl commands 2022-03-01 13:08:25 +01:00
confgenerator.c Added support for custom NTC and PTC motor temperature sensors 2022-01-24 00:36:53 +01:00
confgenerator.h Added support for custom NTC and PTC motor temperature sensors 2022-01-24 00:36:53 +01:00
crc.c merge 2021-01-13 08:57:36 -08:00
crc.h Remove ST CRC library but keep using hardware-accelerated CRC32. 2019-04-16 19:13:01 -03:00
datatypes.h Added lisp repl 2022-03-01 12:07:27 +01:00
digital_filter.c FW 3.7 2016-11-04 15:18:34 +01:00
digital_filter.h FW 3.7 2016-11-04 15:18:34 +01:00
eeprom.c Adapt flash operations to MCU voltage 2022-03-01 11:54:25 +01:00
eeprom.h Adapt flash operations to MCU voltage 2022-03-01 11:54:25 +01:00
events.c Added event logging 2021-06-15 12:56:38 +02:00
events.h Added event logging 2021-06-15 12:56:38 +02:00
flash_helper.c Adapt flash operations to MCU voltage 2022-03-01 11:54:25 +01:00
flash_helper.h Updated linker script and flash helpers to get 128k extra code space. Note that this requires the updated bootloader with compression support. 2022-01-18 20:31:24 +01:00
gpdrive.c Decreased stack sizes to save ram 2022-01-16 21:57:12 +01:00
gpdrive.h Major 2019 update 2019-02-18 19:30:19 +01:00
halconf.h FW 3.66: Many changes, see changelog 2020-01-12 21:25:21 +01:00
i2c_bb.c Fixed current offset fault bug, added support for multiple IMUs and ICM-20948 2019-05-03 19:55:36 +02:00
i2c_bb.h Lisp I2C driver 2022-02-24 01:19:09 +01:00
irq_handlers.c First round of cleanup 2022-02-19 18:51:34 +01:00
isr_vector_table.h Ported to ChibiOS 3, refactoring, cleanup, added safe start delay after fault for PPM app, removed unused ST libraries 2015-10-08 23:09:39 +02:00
ld_eeprom_emu.ld Updated linker script and flash helpers to get 128k extra code space. Note that this requires the updated bootloader with compression support. 2022-01-18 20:31:24 +01:00
ledpwm.c Major restructuring for dual motor support, and added unity hw files 2020-03-16 18:32:39 +01:00
ledpwm.h added custom HW file, support for ID pins, and fixed circular include 2020-07-21 10:54:04 +02:00
main.c Update main.c 2022-02-21 17:12:20 +09:00
main.h Dual motor shutdown fix 2021-08-20 14:59:36 +02:00
mc_interface.c Update mc_interface.c 2022-02-21 17:17:16 +09:00
mc_interface.h Updated lispbm, fixed dual motor flash motor stop 2022-02-13 15:18:22 +01:00
mcpwm.c Merge branch 'master' into dev_fw_5_03 2022-01-21 15:07:44 +01:00
mcpwm.h Release motor fix when cc_min_current is 0 2022-01-19 18:52:45 +01:00
mcpwm_foc.c Update mcpwm_foc.c 2022-02-21 17:25:46 +09:00
mcpwm_foc.h Added raw and imu lisp commands 2022-02-06 23:12:05 +01:00
mcuconf.h Adapt flash operations to MCU voltage 2022-03-01 11:54:25 +01:00
mempools.c Fix warning: missing braces around initializer 2020-05-09 11:56:52 +08:00
mempools.h Major restructuring for dual motor support, and added unity hw files 2020-03-16 18:32:39 +01:00
packet.c Fixed typo (that had no effect, as that large packets are not used). Fixes #261 2021-02-28 20:34:05 +01:00
packet.h Cleanup 2021-01-13 21:51:55 +01:00
pi_stm32.cfg Removed software servo driver, fixed hw servo driver to work with all hardwares 2018-02-28 10:22:25 +01:00
servo_dec.c Detect FOC fix, adc brake multi fix, make ppm pulses invalid above 150 percent 2019-07-01 17:17:49 +02:00
servo_dec.h FW 3.7 2016-11-04 15:18:34 +01:00
servo_simple.c Made servo output a config option 2021-03-31 16:28:46 +02:00
servo_simple.h Made servo output a config option 2021-03-31 16:28:46 +02:00
shutdown.c Made odometer persist after firmware updates, added hw runtime counter 2021-04-11 19:36:11 +02:00
shutdown.h Added support for HW60_MK3 and disable shutdown when watchdog runs slowly 2019-12-09 10:57:33 +01:00
spi_bb.c Shorter 16-bit spi_bb delay. NOTE: This is a temporary fix, the spi_bb driver needs a rewrite at some point to support different polarities, phases, speeds etc. 2022-02-20 23:38:01 +01:00
spi_bb.h Shorter 16-bit spi_bb delay. NOTE: This is a temporary fix, the spi_bb driver needs a rewrite at some point to support different polarities, phases, speeds etc. 2022-02-20 23:38:01 +01:00
stm32-bv_openocd.cfg first commit 2014-01-09 15:20:26 +01:00
stm32f4xx_conf.h Restore capability of enabling parameter assertion of peripheral libraries 2019-01-28 16:47:10 -03:00
terminal.c Threads command resets counters between calls now 2022-02-28 14:24:53 +01:00
terminal.h First lisp integration with vesc tool and enabled lisp by default 2022-01-29 03:36:34 +01:00
timeout.c Decreased stack sizes to save ram 2022-01-16 21:57:12 +01:00
timeout.h Added kill switch support 2021-06-13 13:46:27 +02:00
timer.c IMU improvements 2021-08-22 11:51:03 +02:00
timer.h 75/300 R2 support, terminal sync cmd, IMU support, option to disable permanent UART, collected timer functions in one place 2019-03-10 14:57:42 +01:00
utils.c Lisp updates, imu refactoring and rate check 2022-02-28 14:29:59 +01:00
utils.h Lisp updates, imu refactoring and rate check 2022-02-28 14:29:59 +01:00
virtual_motor.c First round of cleanup 2022-02-19 18:51:34 +01:00
virtual_motor.h Fix virtual motor to work with latest Vesc v5. 2020-06-20 13:36:56 -03:00
worker.c Major restructuring for dual motor support, and added unity hw files 2020-03-16 18:32:39 +01:00
worker.h Major restructuring for dual motor support, and added unity hw files 2020-03-16 18:32:39 +01:00

README.md

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

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