mirror of https://github.com/rusefi/bldc.git
4a94d0ec4c
This commit adds a motor model running within the vesc firmware,and from the vesc terminal a user or a test script can set the mechanical load torque, inertia, phase resistance, Lq and Ld phase inductances (this generic model includes IPM motors), flux linkage and battery voltage. Virtual motor parameters set at the command line should match with vesc configuration, for example phase resistance, inductance and flux linkage should match and have the correct observer gain. Observer works with the virtual motor, with some hiccups during startup For solid results its better to use sensored mode. If vesc is configured to use an SPI encoder the virtual motor phase angle will be injected as an encoder angle readout. For safety PWM outputs are disabled during simulation. Signed-off-by: Maximiliano Cordoba <mcordoba@powerdesigns.ca> |
||
---|---|---|
ChibiOS_3.0.2 | ||
appconf | ||
applications | ||
blackmagic | ||
build_all | ||
hwconf | ||
imu | ||
libcanard | ||
mcconf | ||
nrf | ||
tests/packet_recovery | ||
.gitignore | ||
.travis.yml | ||
CHANGELOG | ||
CONTRIBUTING | ||
Makefile | ||
README.md | ||
board.c | ||
board.h | ||
buffer.c | ||
buffer.h | ||
chconf.h | ||
comm_can.c | ||
comm_can.h | ||
comm_usb.c | ||
comm_usb.h | ||
comm_usb_serial.c | ||
comm_usb_serial.h | ||
commands.c | ||
commands.h | ||
conf_general.c | ||
conf_general.h | ||
conf_mc_app_default.h | ||
confgenerator.c | ||
confgenerator.h | ||
crc.c | ||
crc.h | ||
datatypes.h | ||
digital_filter.c | ||
digital_filter.h | ||
eeprom.c | ||
eeprom.h | ||
encoder.c | ||
encoder.h | ||
flash_helper.c | ||
flash_helper.h | ||
gpdrive.c | ||
gpdrive.h | ||
halconf.h | ||
i2c_bb.c | ||
i2c_bb.h | ||
irq_handlers.c | ||
isr_vector_table.h | ||
ld_eeprom_emu.ld | ||
led_external.c | ||
led_external.h | ||
ledpwm.c | ||
ledpwm.h | ||
main.c | ||
mc_interface.c | ||
mc_interface.h | ||
mcpwm.c | ||
mcpwm.h | ||
mcpwm_foc.c | ||
mcpwm_foc.h | ||
mcuconf.h | ||
packet.c | ||
packet.h | ||
pi_stm32.cfg | ||
servo_dec.c | ||
servo_dec.h | ||
servo_simple.c | ||
servo_simple.h | ||
stm32-bv_openocd.cfg | ||
stm32f4xx_conf.h | ||
terminal.c | ||
terminal.h | ||
timeout.c | ||
timeout.h | ||
timer.c | ||
timer.h | ||
utils.c | ||
utils.h | ||
virtual_motor.c | ||
virtual_motor.h | ||
ws2811.c | ||
ws2811.h |
README.md
VESC firmware
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_palta.c"
//#define HW_HEADER "hw_palta.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 an Ubuntu machine, 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
Build and flash the bootloader
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
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