diff --git a/Firmware/README.md b/Firmware/README.md index 1a3d1a92..18feb9cd 100644 --- a/Firmware/README.md +++ b/Firmware/README.md @@ -29,9 +29,7 @@ In this section we will set the compile-time parameters, later we will also set To customize the compile time parameters, copy or rename the file `tup.config.default` to `tup.config` and edit the parameters in that file: -__CONFIG_BOARD_VERSION__: The board version you're using. Can be `v3.1`, `v3.2`, `v3.3` or `v3.4`. - -__CONFIG_48V__: Set to `y` if you're using a 48V version of the ODrive. Otherwise set to `n`. All ODrives v3.3 or older are 24V. All ODrives v3.4 or newer have a label that says 24V or 48V. +__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. __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. diff --git a/Firmware/Tupfile.lua b/Firmware/Tupfile.lua index c6423482..e9500aba 100644 --- a/Firmware/Tupfile.lua +++ b/Firmware/Tupfile.lua @@ -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.3' -- 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.3' FLAGS += "-DHW_VERSION_MAJOR=3 -DHW_VERSION_MINOR=2" + FLAGS += "-DHW_VERSION_HIGH_VOLTAGE=false" elseif boardversion == "v3.3" then boarddir = 'Board/v3.3' 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.3' FLAGS += "-DHW_VERSION_MAJOR=3 -DHW_VERSION_MINOR=4" + FLAGS += "-DHW_VERSION_HIGH_VOLTAGE=false" +elseif boardversion == "v3.4-48V" then + boarddir = 'Board/v3.3' + 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" diff --git a/tup.config.default b/tup.config.default index 5795105e..831e3b67 100644 --- a/tup.config.default +++ b/tup.config.default @@ -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