From a6242cc3d61b078eb20ec63242b6ca143da0f8d4 Mon Sep 17 00:00:00 2001 From: Kai Hauser Date: Wed, 26 Feb 2020 21:03:52 +0100 Subject: [PATCH 1/2] Added Flashing Method 4: MacOS and moved Variants above Flashing since you have to define a Variant before flashing --- README.md | 53 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 33cfaff..c1cdad8 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,21 @@ The error codes above are reported for each motor in the variables **errCode_Lef [►Video: HOVERCAR demo](https://drive.google.com/open?id=18IvRJVdQSsjTg1I0Wedlg19e0FuDjfdS) +--- +## Example Variants + +This firmware offers currently these variants (selectable in [platformio.ini](/platformio.ini) or [config.h](/Inc/config.h)): +- **VARIANT_ADC**: In this variant the motors are controlled by two potentiometers connected to the Left sensor cable (long wired) +- **VARIANT_USART**: In this variant the motors are controlled via serial protocol (e.g. on USART3 right sensor cable, the short wired cable). The commands can be sent from an Arduino. Check out the [hoverserial.ino](/02_Arduino/hoverserial) as an example sketch. +- **VARIANT_NUNCHUK**: Wii Nunchuk offers one hand control for throttle, braking and steering. This was one of the first input device used for electric armchairs or bottle crates. +- **VARIANT_PPM**: This is when you want to use a RC remote control with PPM Sum signal +- **VARIANT_IBUS**: This is when you want to use a RC remote control with Flysky IBUS protocol connected to the Left sensor cable. +- **VARIANT_HOVERCAR**: In this variant the motors are controlled by two pedals brake and throttle. Reverse is engaged by double tapping on the brake pedal at standstill. +- **VARIANT_TRANSPOTTER**: This build is for transpotter which is a hoverboard based transportation system. For more details on how to build it check [here](https://github.com/NiklasFauth/hoverboard-firmware-hack/wiki/Build-Instruction:-TranspOtter) and [here](https://hackaday.io/project/161891-transpotter-ng). + +Of course the firmware can be further customized for other needs or projects. + + --- ## Flashing @@ -138,6 +153,29 @@ make flash openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c flash "write_image erase build/hover.bin 0x8000000" ``` +### Method 4: MacOS +- prerequisites: first get brew https://brew.sh +- then install stlink ST-Flash utility +``` +brew install stlink +``` +- open a terminal in the repo check-out folder and type: +``` +make +``` +If compiling fails because something is missing just install it with brew AND leave a comment to improve this howto or pull request ;-) + +- flash the firmware by typing: +``` +make flash +``` +- if unlock is needed +``` +make unlock +``` + + + --- ## Troubleshooting First, check that power is connected and voltage is >36V while flashing. @@ -154,21 +192,6 @@ Recommendation: Nunchuk Breakout Board https://github.com/Jan--Henrik/hoverboard Most robust way for input is to use the ADC and potis. It works well even on 1m unshielded cable. Solder ~100k Ohm resistors between ADC-inputs and gnd directly on the mainboard. Use potis as pullups to 3.3V. ---- -## Example Variants - -This firmware offers currently these variants (selectable in [platformio.ini](/platformio.ini) or [config.h](/Inc/config.h)): -- **VARIANT_ADC**: In this variant the motors are controlled by two potentiometers connected to the Left sensor cable (long wired) -- **VARIANT_USART**: In this variant the motors are controlled via serial protocol (e.g. on USART3 right sensor cable, the short wired cable). The commands can be sent from an Arduino. Check out the [hoverserial.ino](/02_Arduino/hoverserial) as an example sketch. -- **VARIANT_NUNCHUK**: Wii Nunchuk offers one hand control for throttle, braking and steering. This was one of the first input device used for electric armchairs or bottle crates. -- **VARIANT_PPM**: This is when you want to use a RC remote control with PPM Sum signal -- **VARIANT_IBUS**: This is when you want to use a RC remote control with Flysky IBUS protocol connected to the Left sensor cable. -- **VARIANT_HOVERCAR**: In this variant the motors are controlled by two pedals brake and throttle. Reverse is engaged by double tapping on the brake pedal at standstill. -- **VARIANT_TRANSPOTTER**: This build is for transpotter which is a hoverboard based transportation system. For more details on how to build it check [here](https://github.com/NiklasFauth/hoverboard-firmware-hack/wiki/Build-Instruction:-TranspOtter) and [here](https://hackaday.io/project/161891-transpotter-ng). - -Of course the firmware can be further customized for other needs or projects. - - --- ## Acknowledgements From e70b3aa38cb514e20d1ec5b0f7b0bd22979c834c Mon Sep 17 00:00:00 2001 From: Kai Hauser Date: Thu, 27 Feb 2020 12:07:49 +0100 Subject: [PATCH 2/2] more CLI --- README.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c1cdad8..aee33ba 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ Make sure you hold the powerbutton or connect a jumper to the power button pins To build and flash choose one of the following methods: -### Method 1: Using Platformio +### Method 1: Using Platformio IDE - open the folder in the IDE of choice (vscode or Atom) - press the 'PlatformIO:Build' or the 'PlatformIO:Upload' button (bottom left in vscode). @@ -137,13 +137,17 @@ To build and flash choose one of the following methods: - click Build Target (or press F7) to build the firmware - click Load Code (or press F8) to flash the firmware. -### Method 3: Using Ubuntu +### Method 3: Using Linux CLI - prerequisites: install [ST-Flash utility](https://github.com/texane/stlink). -- open a terminal in the repo check-out folder and type: +- open a terminal in the repo check-out folder and if you have definded the variant in [config.h](/Inc/config.h) type: ``` make ``` +or you can set the variant like this +``` +make -e VARIANT=VARIANT_NUNCHUK +``` - flash the firmware by typing: ``` make flash @@ -153,16 +157,22 @@ make flash openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c flash "write_image erase build/hover.bin 0x8000000" ``` -### Method 4: MacOS +### Method 4: MacOS CLI - prerequisites: first get brew https://brew.sh - then install stlink ST-Flash utility + +#### Using Make ``` brew install stlink ``` -- open a terminal in the repo check-out folder and type: +- open a terminal in the repo check-out folder and if you have definded the variant in [config.h](/Inc/config.h) type: ``` make ``` +or you can set the variant like this +``` +make -e VARIANT=VARIANT_#### +``` If compiling fails because something is missing just install it with brew AND leave a comment to improve this howto or pull request ;-) - flash the firmware by typing: @@ -174,7 +184,14 @@ make flash make unlock ``` +#### Using platformio CLI +``` +brew install platformio +platformio run -e VARIANT_#### +platformio run –target upload -e VARIANT_#### +``` +If you have set default_envs in [platformio.ini](/platformio.ini) you can ommit -e parameter --- ## Troubleshooting