πŸ“’
OpenRobot, Inc
  • Welcome
  • Quick Guide
    • Getting Started
    • VESC-Tool
    • Motor Setting
    • Basic Run
    • Additional Guide
  • Tutorials
    • Firmware download
    • Control with VESC driver
    • Control with Python
    • Control with CAN
    • VESCular6
    • VESCuino Shield
    • Control using Odroid SBC
  • Applications
    • 3D-Printed Actuator Modules
    • 2-Link Planar Robot
    • Omni-directional Mobile Platform
    • 6-DOF Manipulator
Powered by GitBook
On this page
  • 1. Firmware download using ST-Link
  • 2. Firmware upgrade to multiple VESCular6 at once using VESC-Tool

Was this helpful?

  1. Tutorials

Firmware download

PreviousAdditional GuideNextControl with VESC driver

Last updated 3 years ago

Was this helpful?

1. Firmware download using ST-Link

Supported boards

Make sure you select your board in

In case of VESCular6 and VESCuino board, we pre-define the "HW_SOURCE" and "HW_HEADER" value using macro command (Board Select Here!!!) as below.

#ifndef CONF_GENERAL_H_
#define CONF_GENERAL_H_

// Firmware version
#define FW_VERSION_MAJOR			5
#define FW_VERSION_MINOR			02
// Set to 0 for building a release and iterate during beta test builds
#define FW_TEST_VERSION_NUMBER		0

#include "datatypes.h"

//cdi - Board Select Here!!!
#define HW60_IS_VESCULAR    // HW60_IS_VESCULAR, HW60_IS_VESCUINO
//#define HW60_IS_VESCUINO

#ifdef HW60_IS_VESCULAR
/////////////////////////// HW60_IS_VESCULAR /////////////////////////////////
#define HW_SOURCE "hw_60_openrobot_vescular.c"
#define HW_HEADER "hw_60_openrobot_vescular.h"
#include "hw.h"

// app setting custom precompilation
#include "openrobot/appconf_openrobot.h"
#define APP_CUSTOM_TO_USE            "openrobot/app_openrobot.c"

// motor setting custom precompilation
#include "openrobot/mc_header_custom/kitech_motor_ifdef_id_14.h"

//#define USE_CUSTOM_ABI_ENCODER_AT_SPI   // If it is enabled, Arduino SPI Communication impossible
////////////////////////////////////////////////////////////////////////////////
#elif defined(HW60_IS_VESCUINO)
#define HW_SOURCE "hw_60_openrobot_vescuino.c"
#define HW_HEADER "hw_60_openrobot_vescuino.h"
#include "hw.h"

// app setting custom precompilation
#include "openrobot/appconf_openrobot.h"
#define APP_CUSTOM_TO_USE            "openrobot/app_openrobot.c"

// motor setting custom precompilation
//#include "openrobot/mc_header_custom/kitech_motor_ifdef_id_14.h"

//#define USE_VESCUINO_UART2
#define USE_VESCUINO_ARDUINO_SPI
#define USE_I2C_FAST_400KHZ_MODE

// Custom ABI Encoder with HALL/ENC Hybrid commutation using HW SPI Port.
// Initial Commutation is done by Hall Sensor and change the commutation to encoder just after index found
// Use SPI_MISO(A5):ENC_A, SPI_MOSI(A6):ENC_B, SPI_nCS(A4):ENC_I (VESCUINO VER0.1)
// Use SPI_SCK(A5):ENC_A,  SPI_MISO(A6):ENC_B, SPI_nCS(A4):ENC_I (VESCUINO VER0.1A, VER0.2)
// USE VESC-Tool Setting: 
// General - Sensor Port Mode (Hall Sensors), General - ABI Encoder Counts (4μ±„λ°°λœ Pulse), 
// FOC - General - Sensor Mode (Auto Change from Hall to Encoder after index found), FOC - Encoder - Offset & ratio μ„ΈνŒ…λ˜μ–΄μžˆμ–΄μ•Όν•¨.
#define USE_CUSTOM_ABI_ENCODER_AT_SPI   // If it is enabled, Arduino SPI Communication impossible
//#define USE_ENC_CALCULATION_THREAD
#endif

// Settings and parameters to override
//#define VIN_R1						33000.0
//#define VIN_R1						39200.0
//#define VIN_R2						2200.0
//#define CURRENT_AMP_GAIN			10.0
//#define CURRENT_SHUNT_RES			0.005
//#define WS2811_ENABLE				1
//#define WS2811_TEST					1
//#define CURR1_DOUBLE_SAMPLE			0
//#define CURR2_DOUBLE_SAMPLE			0
//#define AS5047_USE_HW_SPI_PINS		1

// Disable hardware limits on configuration parameters
//#define DISABLE_HW_LIMITS

/*
 * Select only one hardware version, if it is not passed
 * as an argument.
 */
#if !defined(HW_SOURCE) && !defined(HW_HEADER)
//#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

// Benjamins first HW60 PCB with PB5 and PB6 swapped
//#define HW60_VEDDER_FIRST_PCB

// Mark3 version of HW60 with power switch and separate NRF UART.
//#define HW60_IS_MK3
//#define HW60_IS_MK4
#define HW60_IS_MK5

#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_luna_bbshd.c"
//#define HW_HEADER "hw_luna_bbshd.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"

// Benjamins first HW75_300 PCB with different LED pins and motor temp error
//#define HW75_300_VEDDER_FIRST_PCB

// Second revision with separate UART for NRF51
//#define HW75_300_REV_2
#define HW75_300_REV_3

//#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_omega.c"
//#define HW_HEADER "hw_uavc_omega.h"

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

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

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

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

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

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

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

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

//#define HW_DUAL_CONFIG_PARALLEL
//#define HW_SOURCE "hw_stormcore_100d.c"
//#define HW_HEADER "hw_stormcore_100d.h"

//#define HW_VER_IS_60D_PLUS
//#define HW_SOURCE "hw_stormcore_60d.c"
//#define HW_HEADER "hw_stormcore_60d.h"

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

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

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

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

//#define HW_SOURCE "hw_Little_FOCer.c"
//#define HW_HEADER "hw_Little_FOCer.h"
#endif

#ifndef HW_SOURCE
#error "No hardware source file set"
#endif

#ifndef HW_HEADER
#error "No hardware header file set"
#endif

#ifdef USER_MC_CONF
#include USER_MC_CONF
#endif

#ifdef USER_APP_CONF
#include USER_APP_CONF
#endif

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

Prerequisites

On Ubuntu

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

On MacOS

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

Flash it using an STLink SWD debugger

make upload

2. Firmware upgrade to multiple VESCular6 at once using VESC-Tool

Go to the and select the mac version, download it and extract it to your user directory.

Build and flash the first

conf_general.h
GNU ARM embedded toolchain downloads Website
bootloader
Firmware upgrade to multiple VESCular6 at once using VESC-Tool