mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-22 16:14:37 +08:00
Merge branch 'sam_cubemx_cleanup' of github.com:madcowswe/ODrive into sam_cubemx_cleanup
This commit is contained in:
+5
-5
@@ -23,14 +23,14 @@ install:
|
||||
- export GCC_URL=https://launchpad.net/gcc-arm-embedded/5.0/5-2015-q4-major/+download/gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2
|
||||
- if [ ! -e $GCC_DIR/bin/arm-none-eabi-gcc ]; then wget $GCC_URL -O $GCC_ARCHIVE; tar xfj $GCC_ARCHIVE -C $HOME/dl; fi
|
||||
- export PATH=$PATH:$GCC_DIR/bin
|
||||
- export TUP_DIR=$HOME/dl/tup_0.7.2.12+ga582fee_amd64
|
||||
- export TUP_ARCHIVE=$HOME/dl/tup_0.7.2.12+ga582fee_amd64.deb
|
||||
- export TUP_URL=http://ppa.launchpad.net/anatol/tup/ubuntu/pool/main/t/tup/tup_0.7.2.12+ga582fee_amd64.deb
|
||||
- export TUP_DIR=$HOME/dl/tup_0.7.5-0~16.04.york0_amd64
|
||||
- export TUP_ARCHIVE=$HOME/dl/tup_0.7.5-0~16.04.york0_amd64.deb
|
||||
- export TUP_URL=http://ppa.launchpad.net/jonathonf/tup/ubuntu/pool/main/t/tup/tup_0.7.5-0~16.04.york0_amd64.deb
|
||||
- if [ ! -e $TUP_DIR/bin/tup ]; then wget $TUP_URL -O $TUP_ARCHIVE; dpkg-deb -R $TUP_ARCHIVE $TUP_DIR; fi
|
||||
- export PATH=$PATH:$TUP_DIR/usr/bin
|
||||
|
||||
script:
|
||||
- cd Firmware
|
||||
- mkdir -p build
|
||||
- mkdir -p Firmware/build
|
||||
- echo "CONFIG_BOARD_VERSION=v3.4-24V" > tup.config # TODO: build more configuration combinations
|
||||
- tup generate ./build.sh
|
||||
- bash -xe ./build.sh
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
# Unreleased Features
|
||||
Please add a note of your changes below this heading if you make a Pull Request.
|
||||
|
||||
### Added
|
||||
* **Storing of configuration parameters to Non Volatile Memory**
|
||||
|
||||
## Changed
|
||||
### Changed
|
||||
* The build is now configured using the `tup.config` file instead of editing source files. Make sure you set your board version correctly. See [here](README.md#configuring-the-build) for details.
|
||||
* Update CubeMX generated STM platform code to version 1.19.0
|
||||
|
||||
# Releases
|
||||
|
||||
@@ -222,6 +222,11 @@ void init_configuration(void) {
|
||||
// motor_config[0] = MotorConfig_t();
|
||||
// motor_config[1] = MotorConfig_t();
|
||||
|
||||
// TODO: temporary hack, this is gonna change after refactoring
|
||||
axis_configs[0] = AxisConfig();
|
||||
axis_configs[1] = AxisConfig();
|
||||
brake_resistance = 0.47f;
|
||||
|
||||
// Default config coming from flashed Motor_t
|
||||
return;
|
||||
} else {
|
||||
|
||||
+13
-31
@@ -27,41 +27,23 @@ The project is under active development, so make sure to check the [Changelog](C
|
||||
To correctly operate the ODrive, you need to supply some parameters. Some are mandatory, and if supplied incorrectly will cause the drive to malfunction.
|
||||
In this section we will set the compile-time parameters, later we will also set the [run time parameters](#configuring-parameters).
|
||||
|
||||
The first thing to set is your board hardware version, located at the top of [Inc/main.h](Inc/main.h). If, for example, you are using the hardware: ODrive v3.2, then you should set it like this:
|
||||
```C
|
||||
#define HW_VERSION_MAJOR 3
|
||||
#define HW_VERSION_MINOR 2
|
||||
```
|
||||
If you are using the 48V version of ODrive, you should also uncomment this line
|
||||
```C
|
||||
#define HW_VERSION_HIGH_VOLTAGE true
|
||||
```
|
||||
To customize the compile time parameters, copy or rename the file `tup.config.default` to `tup.config` and edit the parameters in that file:
|
||||
|
||||
### Communication configuration
|
||||
If want to use the example python scripts and connect the ODrive via USB, the defaults are fine for you and you can skip this step.
|
||||
__CONFIG_BOARD_VERSION__: The board version you're using. Can be `v3.1`, `v3.2`, `v3.3`, `v3.4-24V` or `v3.4-48V`. Check for a label on the upper side of the ODrive to find out which version you have.
|
||||
|
||||
You can select what interface you want to run on USB and GPIO pins. See [Communicating over USB or UART](#communicating-over-usb-or-uart) for more information.
|
||||
The following options are available in [MotorControl/commands.h](MotorControl/commands.h):
|
||||
__CONFIG_USB_PROTOCOL__: Defines which protocol the ODrive should use on the USB interface.
|
||||
* `native`: The native ODrive protocol. Use this if you want to use the python tools in this repo.
|
||||
* `native-stream`: Like the native ODrive protocol, but the ODrive will treat the USB connection exactly as if it was a UART connection. __Use this if you're on macOS__. This is necessary because macOS doesn't grant our python tools sufficient low-level access to treat the device as the USB device that it is.
|
||||
* `ascii`: The ASCII protocol. This allows sending simple commands like position setpoints directly from the terminal to the ODrive without the use of intermediate utilities.
|
||||
* `none`: Disable USB. The device will still show up when plugged in but it will ignore any commands.
|
||||
|
||||
__USB__:
|
||||
- `USB_PROTOCOL_NATIVE`: Use the native protocol (recommended for new applications).
|
||||
The python library only understands the native protocol, so this is the way to go
|
||||
if you use that.
|
||||
- `USB_PROTOCOL_NATIVE_STREAM_BASED`: Use the native stream based protocol.
|
||||
On most platforms the device shows up as a serial port when connected over USB.
|
||||
So instead of using the python tool's direct USB access, you can use this option and then pretend you connected the device over serial.
|
||||
__On some platforms (specifically macOS), this is required__ because the kernel doesn't allow direct USB access.
|
||||
- `USB_PROTOCOL_LEGACY`: Use the human-readable legacy protocol
|
||||
Select this option if you already have an existing application. This option will be removed in the future.
|
||||
- `USB_PROTOCOL_NONE`: Ignore USB communication
|
||||
__CONFIG_UART_PROTOCOL__: Defines which protocol the ODrive should use on the UART interface (GPIO1 and GPIO2). Note that UART is only supported on ODrive v3.3 and higher.
|
||||
* `native`: The native ODrive protocol. Use this if you're connecting the ODrive to a PC using UART and want to use the python tools to control and setup the ODrive.
|
||||
* `ascii`: The ASCII protocol. Use this option if you control the ODrive with an Arduino. The ODrive Arduino library is not yet updated to the native protocol.
|
||||
* `none`: Disable UART.
|
||||
|
||||
__CONFIG_STEP_DIR__: Set to `y` to use the GPIO1 and GPIO2 for step/direction input. Set to `n` otherwise. To use this, `CONFIG_UART_PROTOCOL` must be `none` because UART uses the same pins.
|
||||
|
||||
__GPIO 1,2 pins__:
|
||||
Note that UART is only supported on ODrive v3.3 and higher.
|
||||
- `UART_PROTOCOL_NATIVE`: Use the native protocol (see notes above).
|
||||
- `UART_PROTOCOL_LEGACY`: Use the human-readable legacy protocol
|
||||
Use this option if you control the ODrive with an Arduino. The ODrive Arduino library is not yet updated to the native protocol.
|
||||
- `UART_PROTOCOL_NONE`: Ignore UART communication
|
||||
- `USE_GPIO_MODE_STEP_DIR`: Step/direction control mode (use in conjunction with `UART_PROTOCOL_NONE`)
|
||||
|
||||
<br><br>
|
||||
## Compiling and downloading firmware
|
||||
|
||||
+13
-10
@@ -3,31 +3,33 @@ tup.include('build.lua')
|
||||
|
||||
-- Switch between board versions
|
||||
boardversion = tup.getconfig("BOARD_VERSION")
|
||||
if boardversion == "" then boardversion = "v3.4" end
|
||||
if boardversion == "v3.1" then
|
||||
boarddir = 'Board/v3' -- currently all platform code is in the same v3.3 directory
|
||||
FLAGS += "-DHW_VERSION_MAJOR=3 -DHW_VERSION_MINOR=1"
|
||||
FLAGS += "-DHW_VERSION_HIGH_VOLTAGE=false"
|
||||
elseif boardversion == "v3.2" then
|
||||
boarddir = 'Board/v3'
|
||||
FLAGS += "-DHW_VERSION_MAJOR=3 -DHW_VERSION_MINOR=2"
|
||||
FLAGS += "-DHW_VERSION_HIGH_VOLTAGE=false"
|
||||
elseif boardversion == "v3.3" then
|
||||
boarddir = 'Board/v3'
|
||||
FLAGS += "-DHW_VERSION_MAJOR=3 -DHW_VERSION_MINOR=3"
|
||||
elseif boardversion == "v3.4" then
|
||||
FLAGS += "-DHW_VERSION_HIGH_VOLTAGE=false"
|
||||
elseif boardversion == "v3.4-24V" then
|
||||
boarddir = 'Board/v3'
|
||||
FLAGS += "-DHW_VERSION_MAJOR=3 -DHW_VERSION_MINOR=4"
|
||||
FLAGS += "-DHW_VERSION_HIGH_VOLTAGE=false"
|
||||
elseif boardversion == "v3.4-48V" then
|
||||
boarddir = 'Board/v3'
|
||||
FLAGS += "-DHW_VERSION_MAJOR=3 -DHW_VERSION_MINOR=4"
|
||||
FLAGS += "-DHW_VERSION_HIGH_VOLTAGE=true"
|
||||
elseif boardversion == "" then
|
||||
error("board version not specified - take a look at tup.config.default")
|
||||
else
|
||||
error("unknown board version "..boardversion)
|
||||
end
|
||||
buildsuffix = boardversion
|
||||
|
||||
-- 48V voltage version
|
||||
if tup.getconfig("48V") == "y" then
|
||||
FLAGS += "-DHW_VERSION_HIGH_VOLTAGE=true"
|
||||
else
|
||||
FLAGS += "-DHW_VERSION_HIGH_VOLTAGE=false"
|
||||
end
|
||||
|
||||
-- USB I/O settings
|
||||
if tup.getconfig("USB_PROTOCOL") == "native" or tup.getconfig("USB_PROTOCOL") == "" then
|
||||
FLAGS += "-DUSB_PROTOCOL_NATIVE"
|
||||
@@ -54,7 +56,7 @@ end
|
||||
|
||||
-- GPIO settings
|
||||
if tup.getconfig("STEP_DIR") == "y" then
|
||||
if tup.getconfig("UART_PROTOCOL") != "none" then
|
||||
if tup.getconfig("UART_PROTOCOL") == "none" then
|
||||
FLAGS += "-DUSE_GPIO_MODE_STEP_DIR"
|
||||
else
|
||||
error("Step/dir mode conflicts with UART. Set CONFIG_UART_PROTOCOL to none.")
|
||||
@@ -74,6 +76,7 @@ FLAGS += '-mfpu=fpv4-sp-d16'
|
||||
FLAGS += '-mfloat-abi=hard'
|
||||
FLAGS += { '-Wall', '-fdata-sections', '-ffunction-sections'}
|
||||
|
||||
-- debug build
|
||||
FLAGS += '-g -gdwarf-2'
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
# Copy this file to tup.config and adapt it to your needs
|
||||
CONFIG_DEBUG=y
|
||||
CONFIG_BOARD_VERSION=v3.3
|
||||
CONFIG_BOARD_48V=n
|
||||
#CONFIG_BOARD_VERSION=v3.3 # make sure this fits your board
|
||||
CONFIG_USB_PROTOCOL=native
|
||||
CONFIG_UART_PROTOCOL=ascii
|
||||
CONFIG_STEP_DIR=n
|
||||
|
||||
Reference in New Issue
Block a user