Lishui "Open Source Firmware" project / KingMeter 5S

AndZab

100 mW
Joined
May 27, 2020
Messages
40
Hello, I'm interested to this Lishui Project:

https://github.com/stancecoke/LishuiFOC

I'm searching description of KingMeter 5S protocol, the standard for 850C display coupled with Lishui.
Inside this project I found useful sources: display_kingmeter.c and display_kingmeter.h

But I'd like to know if somewhere exists text documentation for this 5S protocol.
I found also the project discussion on pedelecforum.de but it is in german and I know only english and italian.

Maybe exists here an english thread for this project ?
Also do you know other display projects using 5S ?

Thanks

(Note: I found 5S traces also inside Kunteng Open Project, but not sure about difference between KM5s, EBS-LCD2, J-LCD, SW-LCD)
 

stancecoke

100 kW
Joined
Aug 2, 2017
Messages
1,697
AndZab said:
Hello, I'm interested to this Lishui Project:

https://github.com/stancecoke/LishuiFOC

But I'd like to know if somewhere exists text documentation for this 5S protocol.

I took the basics from the "Forumscontroller", but the KM5S protocol is quite tricky, as it needs an encrypted handshake at startup. The lookup table from the Forumscontroller code didn't work for me, so I had to "spy" the right answers from the original Lishui firmware. The most recent code is in the sensorless branch, I added the "Fischer" display there
https://github.com/stancecoke/LishuiFOC/blob/Sensorless_VESC/Src/display_kingmeter.c

I don't know a text documentation, only the comments on the code of the Forumscontroller.
The J-LCD protocol is much easier, but it's hard to get a display, that uses this protocol.

regards
stancecoke
 

AndZab

100 mW
Joined
May 27, 2020
Messages
40
stancecoke said:
AndZab said:
Hello, I'm interested to this Lishui Project:

https://github.com/stancecoke/LishuiFOC

But I'd like to know if somewhere exists text documentation for this 5S protocol.

I took the basics from the "Forumscontroller", but the KM5S protocol is quite tricky, as it needs an encrypted handshake at startup. The lookup table from the Forumscontroller code didn't work for me, so I had to "spy" the right answers from the original Lishui firmware. The most recent code is in the sensorless branch, I added the "Fischer" display there
https://github.com/stancecoke/LishuiFOC/blob/Sensorless_VESC/Src/display_kingmeter.c

I don't know a text documentation, only the comments on the code of the Forumscontroller.
The J-LCD protocol is much easier, but it's hard to get a display, that uses this protocol.

regards
stancecoke

Hello stancecoke, thank you very much for your remarks.
I really like Lishui controllers, much more then Kunteng.
I'd like to test this Lishui Open Firmware, and I think I will begin from the beginning...

First thing to do is to setup the new development enviroement, and test fw "as is" now.
Then I will eventually think about new features...
It's arriving to me a new Lishui controller 12 MOSFETs, with 860C display.
It seems board will be LSW12G... something.
Bafang hub motor for testing is G060.750.DC

I'd like to test the open fw by uploading on display connector.
This is because I don't like to open the sealed case (don't have ST-Link, too)
Just have USB-Serial TTL Higo adapter.

Sadly, all connectors are Higo/Julet waterproof, so rewiring not possible at all.
I have a few questions for you:

- Any risk to erase board bootloader, when updating by display port ?
- Any fw modifications needed to adapt the motor ? Is the Configurator enought, in your opinion ?
- Do you think it's a good idea to open here a new thread for the Lishui project ? I would appreciate if you can do it.
- And last but not least, any suggestions are welcome !!

Thank you very much for your help, hope to eventually do some contributions, if I will be able to learn enought...
Apart displays, I have some ideas about the throttle...

Regards
 

stancecoke

100 kW
Joined
Aug 2, 2017
Messages
1,697
AndZab said:
It's arriving to me a new Lishui controller 12 MOSFETs, with 860C display.

I hope it's a "F" in the product number. Otherwise the controller is not suited for the Firmware. Where did you buy the parts? Is it a bundle?
fetch.php


I've documented the project mainly in the german wiki:
https://www.pedelecforum.de/wiki/doku.php?id=elektrotechnik:eek:pen_source_firmware_fuer_lishui_-controller

I don't know how much resonance the project would get here in this forum. There is just a handful of users in the german forum.

regards
stancecoke
 

AndZab

100 mW
Joined
May 27, 2020
Messages
40
stancecoke said:
AndZab said:
It's arriving to me a new Lishui controller 12 MOSFETs, with 860C display.

I hope it's a "F" in the product number. Otherwise the controller is not suited for the Firmware. Where did you buy the parts? Is it a bundle?

Yes, I can find a "-F-" in the product code. It's a new model powerful controller, bundled with 860C. Don't ask more :mrgreen:

stancecoke said:
I've documented the project mainly in the german wiki:
https://www.pedelecforum.de/wiki/doku.php?id=elektrotechnik:eek:pen_source_firmware_fuer_lishui_-controller

I don't know how much resonance the project would get here in this forum. There is just a handful of users in the german forum.

Sadly, I don't know german language :confused:
Without interaction with other people, it's difficult to bring ahead anything.

Lishui controllers are much better then Kunteng, in my opinion. They have bootloader.
They are powerful, STM32 and not STM8. Also they are smaller, to fit in my frame.

I have big problems to find a small waterproof Kunteng, 48V sinewave, 25A, Octagonal plug for Bafang 750W, 1T4 or 1T5 harness.
Can you suggest some source ? It's 1 month I do queries on Alibaba, with few results.
Thanks a lot, Regards.
 

stancecoke

100 kW
Joined
Aug 2, 2017
Messages
1,697
AndZab said:
Yes, I can find a "-F-" in the product code. It's a new model powerful controller, bundled with 860C. Don't ask more :mrgreen:

:thumb: Can you tell me the source? Per PM, if don't want to make it public...

AndZab said:
Sadly, I don't know german language :confused:

That is no problem in times of google translate or deepl :wink:
https://translate.google.com/translate?sl=auto&tl=en&u=https%3A%2F%2Fwww.pedelecforum.de%2Fwiki%2Fdoku.php%3Fid%3Delektrotechnik%3Aopen_source_firmware_fuer_lishui_-controller

AndZab said:
Lishui controllers are much better then Kunteng, in my opinion. They have bootloader.
Only the ones with Bafang-Display have a bootloader as far as I know. Often the controllers have the programmer-connector for the ST-Link.
s-l1600.jpg


But you can flash the bootloader once per STLink and then use the Display-Connector for flashing. And yes, the Lishuis are much better than the Kuntengs, you can do real FOC, even sensorless, with them 8)

regards
stancecoke
 

AndZab

100 mW
Joined
May 27, 2020
Messages
40
stancecoke said:
AndZab said:
Yes, I can find a "-F-" in the product code. It's a new model powerful controller, bundled with 860C. Don't ask more :mrgreen:

:thumb: Can you tell me the source? Per PM, if don't want to make it public...

I sent you a PM, hope you can read it!

stancecoke said:
AndZab said:
Sadly, I don't know german language :confused:

That is no problem in times of google translate or deepl :wink:
https://translate.google.com/translate?sl=auto&tl=en&u=https%3A%2F%2Fwww.pedelecforum.de%2Fwiki%2Fdoku.php%3Fid%3Delektrotechnik%3Aopen_source_firmware_fuer_lishui_-controller

But may I write in english on this german forum ?

stancecoke said:
AndZab said:
Lishui controllers are much better then Kunteng, in my opinion. They have bootloader.
Only the ones with Bafang-Display have a bootloader as far as I know. Often the controllers have the programmer-connector for the ST-Link.
But you can flash the bootloader once per STLink and then use the Display-Connector for flashing. And yes, the Lishuis are much better than the Kuntengs, you can do real FOC, even sensorless, with them 8)

regards
stancecoke

All modern Lishuis have bootloader, so you can send new fw by display connector. When you flash by display port, you can adjust a couple of parameters: (current limit and cutoff voltage)

Mate_x_lishui_foc_controller_firmware_update.png

Is the Open Software bootloader compatible with original Lishui one?
Can Open Software generate a compatible .LSH file, so I do not need the ST-Link ?

Thanks a lot - Regards
 

stancecoke

100 kW
Joined
Aug 2, 2017
Messages
1,697
AndZab said:
Is the Open Software bootloader compatible with original Lishui one?
Can Open Software generate a compatible .LSH file, so I do not need the ST-Link ?

Yes, we use the Lishui bootloader and the .LSH files for flashing.


regards
stancecoke
 

AndZab

100 mW
Joined
May 27, 2020
Messages
40
stancecoke said:
AndZab said:
Is the Open Software bootloader compatible with original Lishui one?
Can Open Software generate a compatible .LSH file, so I do not need the ST-Link ?
Yes, we use the Lishui bootloader and the .LSH files for flashing.
regards
stancecoke

Thanks a lot. Externally reflash without to open controller, it's a dream, because you can update on the fly.
This means to do more tests, quickly.
(and no need for "alien" ST-Link)
Regards

ConnettoreDisplayMio.jpg
 

Tenner

1 µW
Joined
Jul 16, 2020
Messages
1
[*]
Code:
stancecoke said:
AndZab said:
Yes, I can find a "-F-" in the product code. It's a new model powerful controller, bundled with 860C. Don't ask more :mrgreen:

:thumb: Can you tell me the source? Per PM, if don't want to make it public...

AndZab said:
Sadly, I don't know german language :confused:

That is no problem in times of google translate or deepl :wink:
https://translate.google.com/translate?sl=auto&tl=en&u=https%3A%2F%2Fwww.pedelecforum.de%2Fwiki%2Fdoku.php%3Fid%3Delektrotechnik%3Aopen_source_firmware_fuer_lishui_-controller

AndZab said:
Lishui controllers are much better then Kunteng, in my opinion. They have bootloader.
Only the ones with Bafang-Display have a bootloader as far as I know. Often the controllers have the programmer-connector for the ST-Link.
s-l1600.jpg


But you can flash the bootloader once per STLink and then use the Display-Connector for flashing. And yes, the Lishuis are much better than the Kuntengs, you can do real FOC, even sensorless, with them 8)

regards
stancecoke

I am also interested in the project. Very interesting, but where can I get the Bootloader?
Regards
 

stancecoke

100 kW
Joined
Aug 2, 2017
Messages
1,697
Tenner said:
Very interesting, but where can I get the Bootloader?

The bootloader comes with the original FOC Controller Firmware Update Software from Lishui. There a hidden functions in this tool, you have to click one of the buttons several times to activate this extended functions.
But you don't need the bootloader, if it's preinstalled on the controller, or you can flash via STLink, too.

regards
stancecoke
 

Cory Zhang

1 mW
Joined
Sep 2, 2020
Messages
15
The J-LCD protocol is much easier, but it's hard to get a display, that uses this protocol.
Yes, you are right. J Protocol is much easier than 5S. And for us, display with both J & 5S protocol is available.
 

stancecoke

100 kW
Joined
Aug 2, 2017
Messages
1,697
Cory Zhang said:
And for us, display with both J & 5S protocol is available.
Are your displays buyable for anyone, or do you sell only to OEMs / dealers?
Can you post a link to an online-shop?

regards
stancecoke
 

Cory Zhang

1 mW
Joined
Sep 2, 2020
Messages
15
Are your displays buyable for anyone, or do you sell only to OEMs / dealers?
Can you post a link to an online-shop?
Yes, usually we provide directly to OEMs. But possible for after-sales service. Means if you are using our display and need some help, like a replacement, we'd like to help.

If you need for testing, please confirm the J or 5S protocol and pins definition for connectors, then I can also prepare samples.
 

stancecoke

100 kW
Joined
Aug 2, 2017
Messages
1,697
Actually I don't need a new display, but in the german forum are frequent requests from users, who want to replace the simple OEM LED-display (eg. "Fischer" or "Prophete"-Bikes) with LCD displays. Or want to replace the stylish but small LCD display (I don't know, if it's a KingMeter product) with a bigger one.
29-zoll-prophete-rex-graveler-e-9-6-e-bike-elektro-f711f5fb32.jpg


fischer-e-bike-mtb-montis-2-0-2019-perlweissy-matt-275-rh-48-cm-hinterradmotor-4-4-360x360.jpg


https://www.pedelecforum.de/forum/index.php?threads/fischer-montis-2-0-led-display-tauschen-zu-lcd.64078/post-1217280

https://www.pedelecforum.de/forum/index.php?threads/rex-graveler-e-9-6-vs-8-7-aeg-easy-display-vs-multifunkionsdisplay.63097/post-1194279

They will be happy to have a source for the alternative displays, I think!

regards
stancecoke
 

Cory Zhang

1 mW
Joined
Sep 2, 2020
Messages
15
Usually if the original display in ebikes is LCD(LED), then it's easier to change into LCD(LED). But if LED change into LCD, there would be more parameters shown on the display, means we need more testing. So we can not provide for personal. As for Fishcher & Prophete, it's all customized display. Sorry we can not change it per each rider's request.
 

ashot

1 µW
Joined
Jan 29, 2012
Messages
3
Hello! And have I understood right? - Do the original Lishui controller use 5S UART protocol?
I'm looking for a small display for my Lishui controller to exchange the huge SW900. KT-LCD4 is the best in size, but don't work with the "stock" Lishui. SW-102 from Wuxing (Star Union / Topology) is 2 times more expensive, but also don't work with Lishui "from-the-box". And it also haven't possibilty to set up parameters by display, like LCD4 with KT controllers or "big" SW-900 with Lishui. DZ30 and DZ40 from Wuxing (Star Union / Topology) is also candidates, but I guess, that they also will not match.
What protocol needed for matching and correct work with "stock" Lishui? 5S or J-?

stancecoke said:
AndZab said:
Hello, I'm interested to this Lishui Project:

https://github.com/stancecoke/LishuiFOC

But I'd like to know if somewhere exists text documentation for this 5S protocol.

I took the basics from the "Forumscontroller", but the KM5S protocol is quite tricky, as it needs an encrypted handshake at startup. The lookup table from the Forumscontroller code didn't work for me, so I had to "spy" the right answers from the original Lishui firmware. The most recent code is in the sensorless branch, I added the "Fischer" display there
https://github.com/stancecoke/LishuiFOC/blob/Sensorless_VESC/Src/display_kingmeter.c

I don't know a text documentation, only the comments on the code of the Forumscontroller.
The J-LCD protocol is much easier, but it's hard to get a display, that uses this protocol.

regards
stancecoke
 

stancecoke

100 kW
Joined
Aug 2, 2017
Messages
1,697
ashot said:
Do the original Lishui controller use 5S UART protocol?

There is no "the Lishui controller". Lishui supplies OEMs mainly and has many many firmware version with various display protocols.

But if you are using a SW900 actually this should use the KM5S protocol. If you want something small, you can use this tiny Key-Display
It's sold as EBS Nano in Germany.

This uses the KM5S protocol, too. But no guarantee, that the handshake works. You can set the parameters as used from the SW900

regards
stancecoke

index.php


EBS-Nano-Display_aelcdky-05_F01.jpg
 

cencen

10 µW
Joined
Jul 27, 2018
Messages
6
Hi Everyone,

I have an e-bike with a Lishui LSW772 sensorless controller. I wanted to flash this controller with the open source VESC firmware. I know that this branch is more experimental than the master branch. I took a little bit longer than expected because I'm not really familiar with this software. A lot of trial and error but fortunately I could build and flashed the controller. Now I have another problem. I use SW900 as display and I get an error code 10 (I believe it si a communication error). Attached are Eclipse console log and config.h. Any help will be appreciated.

Regards
Cencen
 

Attachments

  • configh.txt
    3.1 KB · Views: 73
  • Eclipse console.txt
    23.8 KB · Views: 58

stancecoke

100 kW
Joined
Aug 2, 2017
Messages
1,697
cencen said:
I get an error code 10

you have defined no display, as all relevant lines are commented out.

Delete the two slashes before #define DISPLAY_TYPE DISPLAY_TYPE_KINGMETER_FISCHER_1822

Perhaps you have to use an older commit, as my display changed the startup procedure one day for some reason.

regards
stancecoke
 

cencen

10 µW
Joined
Jul 27, 2018
Messages
6
stancecoke said:
Delete the two slashes before #define DISPLAY_TYPE DISPLAY_TYPE_KINGMETER_FISCHER_1822

Perhaps you have to use an older commit, as my display changed the startup procedure one day for some reason.

I added the missing display type line as:
#define DISPLAY_TYPE_KINGMETER_618U and also #define DISPLAY_TYPE_KINGMETER_901U
I tried both one by one, I got the display working but I still get the error 10 on SW900 display.

I checked your older commits but I don't know which one to use. Am I doing something wrong or
is this another problem rather than the software? What are other DISPLAY_TYPE DEBUG_SLOW_LOOP and FAST_LOOP?

Thanks and regards,
Cencen
 

Attachments

  • config.h
    3.1 KB · Views: 60
  • Eclipse console.txt
    23.8 KB · Views: 49

stancecoke

100 kW
Joined
Aug 2, 2017
Messages
1,697
cencen said:
I added the missing display type line as:
?! There is nothing missing.
Just do what I wrote! Delete the two slashes, whyever you set them...

https://github.com/EBiCS/EBiCS_Firmware/blob/44791d56be94863a55cac56525487a8996753f34/Inc/config.h#L13

If this doesn't work, copy the display_kingmeter.c from the old commit of 26 Oct 2019 to your workspace. (simply overwrite the recent one in your workspace)


If you don't want to use a torque sensor, you have to comment out this line:

https://github.com/EBiCS/EBiCS_Firmware/blob/44791d56be94863a55cac56525487a8996753f34/Inc/config.h#L23

regards
stancecoke
 

cencen

10 µW
Joined
Jul 27, 2018
Messages
6
stancecoke said:
?! There is nothing missing.
Just do what I wrote! Delete the two slashes, whyever you set them...

https://github.com/EBiCS/EBiCS_Firmware/blob/44791d56be94863a55cac56525487a8996753f34/Inc/config.h#L13

If this doesn't work, copy the display_kingmeter.c from the old commit of 26 Oct 2019 to your workspace. (simply overwrite the recent one in your workspace)


If you don't want to use a torque sensor, you have to comment out this line:

https://github.com/EBiCS/EBiCS_Firmware/blob/44791d56be94863a55cac56525487a8996753f34/Inc/config.h#L23

First of all, I think there is a misunderstandig related to the display type. I was surprised and a little bit dissapointed with your unexpected reaction. I don't understand your frustration but I believe there was no need for that. As I told you I have a SW900 display which I thought is compatible with (KM5s, EBS-LCD2, J-LCD, SW-LCD) an that is why I tried DISPLAY_TYPE_KINGMETER_618U and DISPLAY_TYPE_KINGMETER_901U not the DISPLAY_TYPE_KINGMETER_FISCHER_1822. I did'nt realize you specifically ment to use it.

Anyhow I did everything you have written but unfortunatelly the result did not change. I am starting to believe this is a hardware problem (most probably the controller is faulty!). I had checked all cables, connectors but check it again thoroughly.

Lets leave this here. Thank you very much for all your help.

Regards
Cencen
 

stancecoke

100 kW
Joined
Aug 2, 2017
Messages
1,697
cencen said:
I think there is a misunderstandig related to the display type.
No problem.
I never had a SW900 display, so I don't know which protocol it uses. The Fischer bike uses a SW LCD.
http://www.king-meter.com/#/product/10

If you have an USB-UART converter you can try to flash with
#define DISPLAY_TYPE DEBUG_SLOW_LOOP
Then TX of the controller sends constantly @9600 BAUD

If this works, you can try the display_kingmeter.c from the master branch. There the handshake procedure is optimized. If this still doesn't work, your display may use a different encrypted handshake, or a completely different protocol...

regards
stancecoke
 
Top