lucysrausch / hoverboard-firmware-hack

New Hoverboard Firmware Hack. Now written from scratch and generally much better.
GNU General Public License v3.0
695 stars 405 forks source link

Beginner question. #11

Closed rokrodic closed 6 years ago

rokrodic commented 6 years ago

Hi. I am new to STM32. Which toolchain will work with your code (update: I found in one of the files it was created with System Workbench for STM32...)? https://gnu-mcu-eclipse.github.io/ ? (Any small toolchain? - don't want to put too much garbage on my Windows just for this project). Another question is how to backup original firmware (command for st-link)? Tnx Rok

ghost commented 6 years ago

The best way is probably a linux-vm (ubuntu/debian) or a raspberrypi with the following packages: build-essential gcc-arm-none-eabi openocd. st-flash is not really needed because you could do this also with openocd... (i used a raspberrypi as programmer via GPIO)

A backup of the original firmware isn't possible because you have to unlock the chip, which will clear the flash's content.

kloppertje commented 6 years ago

Why a linux-vm, as Windows tooling is available? I've installed it myself, but don't remember exactly all the steps I took :(. Two things you need for sure: http://gnuwin32.sourceforge.net/packages/make.htm and https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads Also, add paths of executables (if not already done by installer) to the Windows path environment variable.

rokrodic commented 6 years ago

Hi. Thank you for both answers. I decided for second option. I installed both programs. Then I made a setvar.bat file containing: ` @echo off

set TL_PATH=d:\Program Filex (x86)\GNU Tools ARM Embedded\7 2017-q4-major\bin

set PATH=%TL_PATH%;%PATH%;d:\Program Files (x86)\GnuWin32\bin; ` Now I run a command prompt and firstly run my setvar.bat and then "make". It compiles but the file length is different as precompiled version (mine 69869, githubs' 70057). Hopefully it works. Now I am waiting for my Stlink... While compiling I get some warnings about multiline comments and few "xxx discards 'volatile' qualifier"...

I have another question, maybe for another thread. Is there a way to disable a motor power to either side? Why - I made a trike bike (steering wheel + 2 back brushless motors). It is hard to turn when both motors are spinning equally. If I cut the power to one programmatically, it will turn freely in either direction with no tyre skipping. With just the other active motor turning it would be easier to turn...

Thanks, Rok

lucysrausch commented 6 years ago

https://github.com/NiklasFauth/hoverboard-firmware-hack/blob/9ef7e0b93655cf4690c53ca04196782c3e7e32e8/Src/bldc.c#L181-L187

https://github.com/NiklasFauth/hoverboard-firmware-hack/blob/9ef7e0b93655cf4690c53ca04196782c3e7e32e8/Src/bldc.c#L189-L193

This can be used to disable either the right or the left motor

LeoDJ commented 6 years ago

Maybe even better: connect a potentiometer to the steering wheel and let the mainboard handle the slowing of the motors (be sure to use the steering config parameters in the firmware to tune it to your steering wheel travel). That way you won't lose speed/power during turning.

rokrodic commented 6 years ago

Great! Thanks for ideas and code. I found "enable"s. Will close the issue now. Thanks again!