Skip to content
stancecoke edited this page Jul 2, 2023 · 17 revisions

Welcome to the LishuiFOC wiki!

Necessary steps to flash the firmware to your controller.

  1. Make sure, that your controller uses the STM32FEB or STM32F103 or any compatible clone processor

  2. Make sure, the you can find the three shunts, three halfbridge-drivers and the OP on the PCB. Your PCB can look completely different, it's only important, that you can find the components.

Photo of PCB 3. Wire the STLink-V2 to the white connector, or directly to the PCB.

STLink-V2 white connector

  1. Download and install the Java Runtime Environment (if not already installed)

  2. Download and install the System Workbench for STM32. Start Eclipse once to extract the compiler. (in path C:\Ac6\SystemWorkbench\eclipse.exe by default)

  3. Download the repo from github and extract it.

  4. Download and install the ST-Link Utility Caution, there is an issue with some contributions of the utility.

  5. Doubleclick on JavaConfigurator.jar to open the configuration tool.

Screenshot GUI

  1. Power the controller with appropriate external power supply. Turn on the controller using controller display.

  2. click on "unlock controller" once, to disable the read/write protection. Caution, the original firmware is deleted and can't be undone!

  3. Adjust your settings for the parameters, then click on "compile & flash". Don't touch the parameters in the "advanced" tab, if you don't know what you are doing!

If you want to add new features to the firmware open the project in Eclipse:

  1. Import the repo in Eclipse by file --> import --> git --> Projects from git --> clone URL. Copy the adress https://github.com/stancecoke/LishuiFOC to the dialog window and choose an empty folder. In eclipse, you have to adjust the reset setting:

Screenshot eclipse debugger setting

  1. You have to disable the write protection of the controller once, this will delete the original firmware and can't be undone. You can use the ST-Link utility, see figure 19 of the manual

Main parameter to be adjusted to your individual motor

The firmware has an "autodetect" function. This function runs the motor in open loop and sets the right specific angle in the emulated EEPROM. You can use any hallsensor- and phase combination. To start the autodetect, make sure that the wheel can turn free without load, pull the brake lever and give full throtte while starting the system for 10 seconds. The wheels starts turning slowly. Release the throttle and brake lever After a few seconds it stops again and it'll perform the KV detection by spinning the motor at max speed. Then the procedure is finished. If the motor runs in the wrong direction, set the "Reverse" option in the GUI.

If you don't have a brake switch and a throttle on your system, you can start the autodetect routine by activating the autodetect and debug option in the GUI. The controller runs the autodetect at every start then. You have to run it only once, so you can disable the option again after one start.

Caution: all of this project is highly experimental and all you are doing is on your own risk!

https://www.youtube.com/embed/iYRHn77PX7U?wmode=opaque&start=0