bldc/README.md

149 lines
5.5 KiB
Markdown
Raw Normal View History

# VESC firmware
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
2019-02-19 14:14:54 -08:00
[![Travis CI Status](https://travis-ci.com/vedderb/bldc.svg?branch=master)](https://travis-ci.com/vedderb/bldc)
2019-02-19 12:35:03 -08:00
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/75e90ffbd46841a3a7be2a9f7a94c242)](https://www.codacy.com/app/vedderb/bldc?utm_source=github.com&utm_medium=referral&utm_content=vedderb/bldc&utm_campaign=Badge_Grade)
[![Contributors](https://img.shields.io/github/contributors/vedderb/bldc.svg)](https://github.com/vedderb/bldc/graphs/contributors)
[![Watchers](https://img.shields.io/github/watchers/vedderb/bldc.svg)](https://github.com/vedderb/bldc/watchers)
[![Stars](https://img.shields.io/github/stars/vedderb/bldc.svg)](https://github.com/vedderb/bldc/stargazers)
[![Forks](https://img.shields.io/github/forks/vedderb/bldc.svg)](https://github.com/vedderb/bldc/network/members)
An open source motor controller firmware.
This is the source code for the VESC DC/BLDC/FOC controller. Read more at
2019-02-19 09:55:18 -08:00
[https://vesc-project.com/](https://vesc-project.com/)
## Supported boards
2022-03-07 07:24:54 -08:00
All of them!
2022-03-06 07:32:02 -08:00
Check the supported boards by typing `make`
```
2022-03-06 07:32:02 -08:00
[Firmware]
fw - Build firmware for default target
supported boards are: 100_250 100_250_no_limits 100_500...
```
2022-03-06 07:32:02 -08:00
There are also many other options that can be changed in [conf_general.h](conf_general.h).
2022-03-06 07:32:02 -08:00
## Prerequisites
2021-04-11 21:01:30 -07:00
2022-03-06 07:32:02 -08:00
### On Ubuntu (Linux)/macOS
2022-03-07 07:24:54 -08:00
- Tools: `git`, `wget`, and `make`
2022-03-06 07:32:02 -08:00
- Additional Linux requirements: `libgl-dev` and `libxcb-xinerama0`
2022-03-07 07:24:54 -08:00
- Helpful Ubuntu commands:
```bash
sudo apt install git build-essential libgl-dev libxcb-xinerama0 wget git-gui
```
2022-03-06 07:32:02 -08:00
- Helpful macOS tools:
2021-04-11 21:01:30 -07:00
```bash
2022-03-06 07:32:02 -08:00
brew install stlink
brew install openocd
```
2022-03-06 07:32:02 -08:00
### On Windows
- Chocolately: https://chocolatey.org/install
- Git: https://git-scm.com/download/win. Make sure to click any boxes to add Git to your Environment (aka PATH)
2022-03-06 07:32:02 -08:00
## Install Dev environment and build
2022-03-06 07:32:02 -08:00
### On Ubuntu (Linux)/MacOS
Open up a terminal
2022-03-07 07:45:30 -08:00
1. `git clone http://github.com/vedderb/bldc.git`
2. `cd bldc`
3. Continue with [On all platforms](#on-all-platforms)
2022-03-06 07:32:02 -08:00
### On Windows
2022-03-14 04:34:03 -07:00
1. Open up a Windows Powershell terminal (Resist the urge to run Powershell as administrator, that will break things)
2022-03-07 07:45:30 -08:00
2. Type `choco install make`
3. `git clone http://github.com/vedderb/bldc`
2022-03-07 07:45:30 -08:00
4. `cd bldc`
5. Continue with [On all platforms](#on-all-platforms)
2022-03-06 07:32:02 -08:00
### On all platforms
2022-03-07 07:45:30 -08:00
1. `git checkout origin/master`
2. `make arm_sdk_install`
3. `make` <-- Pick out the name of your target device from the supported boards list. For instance, I have a Trampa **VESC 100/250**, so my target is `100_250`
2022-03-07 07:40:39 -08:00
4. `make 100_250` <-- This will build the **VESC 100/250** firmware and place it into the `bldc/builds/100_250/` directory
2022-03-06 07:32:02 -08:00
## Other tools
2022-03-06 07:32:02 -08:00
**Linux Optional - Add udev rules to use the stlink v2 programmer without being root**
```bash
2022-03-06 07:32:02 -08:00
wget vedder.se/Temp/49-stlinkv2.rules
sudo mv 49-stlinkv2.rules /etc/udev/rules.d/
sudo udevadm trigger
```
## IDE
### Prerequisites
#### On macOS/Linux
- `python3`, and `pip`
#### On Windows
- Python 3: https://www.python.org/downloads/. Make sure to click the box to add Python3 to your Environment.
### All platforms
2022-03-07 07:45:30 -08:00
1. `pip install aqtinstall`
2. `make qt_install`
3. Open Qt Creator IDE installed in `tools/Qt/Tools/QtCreator/bin/qtcreator`
4. With Qt Creator, open the vesc firmware Qt Creator project, named vesc.pro. You will find it in `Project/Qt Creator/vesc.pro`
5. The IDE is configured by default to build 100_250 firmware, this can be changed in the bottom of the left panel, there you will find all hardware variants supported by VESC
2020-06-03 10:44:12 -07:00
## Upload to VESC
### Method 1 - Flash it using an STLink SWD debugger
2022-03-07 07:45:30 -08:00
1. Build and flash the [bootloader](https://github.com/vedderb/bldc-bootloader) first
2. Then `_flash` to the target of your choice. So for instance, for the VESC 100/250:
```bash
2022-03-06 07:32:02 -08:00
make 100_250_flash
```
2020-06-03 10:44:12 -07:00
2022-03-06 07:32:02 -08:00
### Method 2 - Upload Firmware via VESC tool through USB
2020-06-03 10:44:12 -07:00
2022-03-07 07:45:30 -08:00
1. Clone and build the firmware in **.bin** format as in the above Build instructions
2020-06-03 10:44:12 -07:00
In VESC tool
2022-03-07 07:45:30 -08:00
2. Connect to the VESC
3. Navigate to the Firmware tab on the left side menu
4. Click on Custom file tab
5. Click on the folder icon to select the built firmware in .bin format (e.g. `build/100_250/100_250.bin`)
2020-06-03 10:44:12 -07:00
##### [ 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" ]**
2022-03-07 07:45:30 -08:00
6. Press the upload firmware button (downward arrow) on the bottom right to start upload the selected firmware.
7. Wait for **10s** after the loading bar completed (Warning: unplug sooner will risk bricking your VESC)
8. The VESC will disconnect itself after new firmware is uploaded.
2020-06-03 10:44:12 -07:00
## 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](https://vesc-project.com/forum) to get involved and improve this project.
2022-03-06 07:32:02 -08:00
Join the [Discord](https://discord.gg/JgvV5NwYts) for real-time support and chat
2022-12-28 03:57:45 -08:00
## Tags
Every firmware release has a tag. They are created as follows:
```bash
git tag -a [version] [commit] -m "VESC Firmware Version [version]"
git push --tags
```
## License
The software is released under the GNU General Public License version 3.0