Lishui Controller Modification - Firmware Flash Project

Sparksandbangs

Pedelecer
Jan 16, 2025
144
43
I’ve had the urge to tinker with firmware for ages and have decided to take the plunge.

As I want to use the bike while I'm experimenting this necessitates purchasing another controller for testing purposes. Options are another KT sinewave controller and flash with OSEC firmware or a Lishui controller which arguably has better hardware than the KT and flashing with eBics. The settings will then be modified to mimic the standard KT controller but hopefully in a better package.

After reading through the procedures for both controllers the KT appears easier to set up than the Lishui. The Lishui also has the added problem (for me) that the forum discussing it is a German language forum. Google translate can only get you so far and it makes it difficult to search for specific terms in a monster length thread if you don't speak the language.

In the pioneering spirit I have of course gone for the more difficult option on the hope it will give me a better outcome.

There is a Wiki in English

First thing order a controller. This is one of them recommended in the Wiki for the project.

First issue. On opening it up it has been potted with some grey goo. Not quite the consistency of silicone sealant and not quite decorators calk but somewhere in between. After removing both end caps and the 3 screws holding the MOSFET rail a bit of light pressure on it reveals it to be stuck in the case. A bit of exploratory digging reveals the aluminium rail running through the controller with all the MOSFETs attached to it. With the case held in the vice and a small length of wood thinner than the case placed on the rail followed by couple of short, sharp taps with a lump hammer the circuit board pops out. Aluminium bar is pictured below on a photo borrowed from another forum. I have added a red circle to show the point to whack.

63730

Now needs a bit of digging to clean it up to reveal the board.

Next problem. There is no throttle connection. I hadn't noticed when I ordered it. A quick look at the chip drawing shows that a wire should be soldered from 'SP' on the board. A lead from the ground and another from the +5v rail adds the throttle function.
 
  • Like
Reactions: Jodel

Sparksandbangs

Pedelecer
Jan 16, 2025
144
43
And the next problem I can identify the programming port but terminals are not identified. An internet search suggests the configuration below:
63731

Testing with a multimeter confirms the +3.8v and ground. Soldered leads as below:

63732

Next problem. PAS is x 5 wire connection.

This is because the controller is designed to be used with a bottom bracket torque sensor. I just want to use a normal magnetic PAS. The voltage output is 15v, I doubt that will work well with my sensor so use the 5v and ground from the throttle. There are two pas wires. One is an inverse PAS signal. My guess is this is the one to use with a left hand sensor, the other two signal wires are for the PAS normal sensor and the torque sensor that I won’t be using.

With the first steps completed it is now time to connect to the bike and test what happens with stock firmware.

First test using stock firmware. Wheel off the ground using walk assist from the display - working.

Throttle - nothing. Maybe it isn't activated in the stock firmware. A quick check with a multimeter shows that voltages are as expected.

PAS - nothing. I could have this wired up incorrectly. I could try swapping it to the other PAS input wire.


Think I may just flash a basic version of eBics from the java tool and try the test again.
 

Sparksandbangs

Pedelecer
Jan 16, 2025
144
43
Followed the instructions from the Wiki. Connected ST-Link V2. Opened the Java tool. Set up the battery levels, switched off torque sensing. Set the speed limit and set to debug. Clicked on the enable autodetect in debug mode.

63733

Unlocked controller then flashed. Error 30 is now showing on the controller

Unplugged ST-Link V2. Switched off, wheel off the floor, switched back on again and autodetect cycle runs to completion. Bit of knocking and banging noises coming from the hub.

Plugged ST-Link V2 back in and reflashed. Now out of debug mode and back to using the EN06 display.

Powered up and throttle and PAS now work. The throttle must have been disabled in stock firmware.

First success.
 
  • Informative
Reactions: Jodel

Sparksandbangs

Pedelecer
Jan 16, 2025
144
43
I’ve tweaked the code in Eclipse. Fairly sure that I’ve set up all the parameters correctly. Changed the display to the LCD3.

Go to flash to the controller and it fails every time. Strangely if I try to flash from the Java tool it works. Unfortunately the Java tool doesn’t allow in depth changes.

Tried changing multiple settings to get it to flash from Eclipse but doesn’t make the blindest bit of difference. Then in a eureka moment realised that the Java tool flashes using the command line.

Complied the code in Eclipse then flashed from the command line. Worked perfectly. Not an ideal solution but I’ll go with it.

Mounted the controller on the bike ready for a test run.



PAS Level 1. Start pedalling and a longer delay than I’m used to and the thing sets off like a rocket. It appears that my attempts to recreate the KT assist levels have not gone to plan. Various other little niggles. Realise that I should have changed one thing at once and got it working instead of doing the whole lot in one.

Test the throttle and strangely works with the assist set at 0. The speed goes up to 6kmph and cuts off. Pedal and press the throttle and full power applied. Interestingly unlike the KT the throttle isn’t an on off switch it works like a throttle with a graduated application of power.


Now I’ll have to look at the coding. Undo all the changes that I’ve made and focus on one thing until I get it right and then move on to the next. First priority is sorting out the assist levels.


I now have to disassemble the controller housing every time that I want to flash the controller. I realise this is going to get tedious very soon. I’m going to have to solder on some sort of flying programming lead to address this.
 

Woosh

Trade Member
May 19, 2012
21,347
17,321
Southend on Sea
wooshbikes.co.uk
My programmer connects to the 5 pin LCD. Hardwarewise, it looks like an ST-Link V2.
 

AndyBike

Esteemed Pedelecer
Nov 8, 2020
1,710
732
Fiddling about with electrical systems.

Username checks out ... :D
 

Advertisers