VESC - Flipsky 75100 V2 with Bafang Display and T15/T17 BB-Torque Sensor

but I also get Err 30
Which display are you using exactly?

I'll take a deeper look at the weekend!
Hm, your display sends a lot of unknown commands. We would need an original Bafang controller, to see, what is answered on this commands to emulate the "right" answers.

I tried to find the unkown commands somewhere, but I found nothing helpful, just a funny statement, that I can confirm :)
Controller just replies in weird ways... no checksum as far as I can tell, but either just the same value twice or with 0x20 added :eek:)
The most complete list of commands seems to be in the Bafang firmware of Daniel Nilsson.
Of course, we could try to answer with two times the (unknown) command, as this seems to be the expected answer often, but I can't test it, so it makes no sense for me.

CommandNumber of messages sentMeaning of the command
0x08
10​
CMD_PEDAL_MOV
0x0A
8​
CMD_AMPS
0x0B
8​
CMD_PAS_LEVEL
0x11
8​
CMD_BATT_SOC
0x1A
4​
BF_CMD_LIGHT
0x1F
4​
BF_CMD_WHEELDIAM
0x20
9​
CMD_WHEEL_RPM
0x21
8​
unknown
0x22
8​
OPCODE_BAFANG_DISPLAY_READ_RANGE
0x30
8​
unknown
0x31
8​
CMD_MOVING
0x60
2​
unknown
0x62
2​
unknown
0x63
2​
unknown
0x64
2​
unknown
0x65
2​
unknown
0x66
2​
unknown
0x67
2​
unknown
0x90
2​
CMD_VERSION
 
Last edited:
It is save to flash by the STLink, the hex/bin files include the bootloader.
But make sure, that you make a "full chip erase" with the STM32 Utility (or other tools), to clean the pages, that are used as EEPROM. Otherwise the old setting will still be there.
Sorry for the delay: had to get a logic analyzer to be sure, and I found out what the problem was in case you are still interested: the series resistors on my spintend rx and tx line proved faulty, which made uart erratic. So nothing to do with your code :)
 
Hello, can I connect the display from Bafang with CAN protocol to the paddle. Thanks


Dp C244 display model
Not with this code, since it uses the luna uart file. You need to write your own vesc script for that. The good news is that vesc has native can support, and since luna also implementated a CAN version of bafang display, it shouldn't be too hard to transcribe into a lispBM script, or simply keep the C version and adapt Stancecoke's fork.
 
Last edited:
Not with this code, since it uses the luna uart file. You need to write your own vesc script for that. The good news is that vesc has native can support, and since luna also implementated a CAN version of bafang display, it shouldn't be too hard to transcribe into a lispBM script, or simply keep the C version and adapt Stancecoke's fork.
It's still difficult for me, but I found the firmware for the KT lcd, I'll put it in! Thank you!
 
Hello. I purchased this version and I have a suitable casing for it, but I'm wondering do I get any advance from flashing this firmware for my e-bike, since I'm planning on using the integrated bluetooth connection for PAS level settings and for nescessary info. I'm using 3-wire PAS, thumb throttle, no display, 14S battery, Shinquy direct drive rear motor. I would also like to hear if people have managed to make the .lisp -script shown in this YT video work? Thanks.

Flipsky 75100 Pro V2.0 Aluminum PCB:

Video:
 
but I'm wondering do I get any advance from flashing this firmware for my e-bike
What should be the advantage? If you neither want to use a Bafang UART display nor a torquesensor, then this project is not suited for you.
Using a LISP script successfully for a simple 3 wire PAS was reported many times already.


But who want's to ride with simple PAS assistance in these days?! ;)
 
Last edited:
The Flipsky 75100 is available at a very reasonable price and in a pedelec-compatible housing. However, the VESC is hardly suitable for e-bikes due to the lack of display and torque sensor support. This has challenged my tinkering instinct ;)
Luna Cycle has already implemented the Bafang protocol for its BBSHD controller, so I “only” had to port it to the Flipsky hardware.
For the torque sensor I put the PAS signal on the servo input and the torque signal on ADC2.
The VESC tool still works for setting up the motor, but the app setting must not be done with the VESC tool at the moment, as it does not (yet) know the new functions.
Currently it only runs on the test bench, the torque sensor signals are emulated by a blackpill board.
Next I have to install the controller in my tinker bike and do a real test ride :cool:
Commits · stancecoke/VESC_BLDC

Flipsky%20wiring.PNG

A little teaser on Youtube:

regards
stancecoke
built for bldc_sc>git clone GitHub - stancecoke/VESC_BLDC: The VESC motor control firmware
bldc_sc\VESC_BLDC>make arm_sdk_install
bldc_sc\VESC_BLDC>make 60_mk5
first was this error:
applications/app_adc.c:640:20: error: 'HW_BRAKE_SENSOR_PORT' undeclared (first use in this function); did you mean 'HW_I2C_SCL_PORT'?
from
if(!palReadPad(HW_BRAKE_SENSOR_PORT, HW_BRAKE_SENSOR_PIN))mc_interface_set_current_rel(0.0); //stop motor if brake lever is pulled
I commented that line since I am not using that function
The build succeeded:
Creating bldc_sc/VESC_BLDC/build/60_mk5/60_mk5.hex
Creating bldc_sc/VESC_BLDC/build/60_mk5/60_mk5.bin
But results in err 30 for the display (EDK01)
 
Last edited:
If you have a USB-UART converter, please listen to the tx data stream of the display (1200 BAUD) with your laptop first.
If the messages are valid, we can do further steps.

The tx stream (in hex representation) should look like this:
Code:
11 0A
11 11
16 1A F0 20
11 08
16 0B 00 21
11 0A
11 11
16 1A F0
11 20
11 08
16 1F 03 1B 53
11 0A

where the 0x11 is a request to the controller and the 0x16 is an information to the controller.
11 11 --> get battery soc
11 0A --> get amps
11 20 --> get speed
.....

16 1A F0 --> light off (not implemented in Luna code)
16 0B 00 21 --> PAS level 0
16 1F 03 1B 53 --> wheel diameter (not implemented in Luna code)
....

https://github.com/stancecoke/VESC_...bfde/hwconf/flipsky/luna_display_serial.c#L38

The library in the "Forumscontroller" project has more parameters implemented than the Luna Cycle, but in decimal representation:
https://github.com/jenkie/Arduino-P...r/Arduino_Pedelec_Controller/display_bafang.h


regards
stancecoke
16 1f 03 1b 53
16 0b 00 21
16 1f 03 1b 53
16 0b 00 21
16 1f 03 1b 53
16 0b 00 21 . . .
is all I get, no 11s
 
That's a matter of the display, not of the Luna UART implementation. I'm not an expert on Bafang UART, you would have to listen to the communication on a working Display-Controller combination to check if there is something new. I don't know exactly, but I think there was a report somewhere, that the communication runs on 9600 BAUD sometimes.....
 
That's a matter of the display, not of the Luna UART implementation. I'm not an expert on Bafang UART, you would have to listen to the communication on a working Display-Controller combination to check if there is something new. I don't know exactly, but I think there was a report somewhere, that the communication runs on 9600 BAUD sometimes.....
After many iterations with the tweaks and re-flash I got the following output (vs code serial monitor) from startup; works for a second, then err30, then err30 disappears briefly and then comes back.
I also get error in VESC tool: "Could not deserialize motor configuration. This probably means that something is wrong with your firmware, or this VESC Tool version" but that does not prevent flashing (I don't have a motor or torque sensor connected right now as I'm just trying to get the display to work).
Now getting 11s and the pas level changes but still err30

LUNA RX len=2: 11 90
LUNA TX len=17: 51 10 4C 55 4E 41 42 42 53 48 31 32 35 35 05 FA 7C
LUNA RX len=2: 11 90
LUNA TX len=17: 51 10 4C 55 4E 41 42 42 53 48 31 32 35 35 05 FA 7C
LUNA RX PAS_LEVEL len=4: 16 0B 00 21
PAS applied: level=0
LUNA TX len=2: 0B 18
LUNA TX PAS_ACK len=2: 0B 18
LUNA RX len=2: 11 11
LUNA TX len=3: 64 64 D9
LUNA RX len=2: 11 11
LUNA TX len=3: 64 64 D9
LUNA RX len=2: 11 31
LUNA TX len=3: 31 31 93
LUNA RX len=2: 11 31
LUNA TX len=3: 30 30 91
LUNA RX len=2: 11 20
LUNA TX len=3: 00 00 20
LUNA RX len=2: 11 20
LUNA TX len=3: 00 00 20
LUNA RX len=2: 11 08
LUNA TX len=1: 01
LUNA RX len=2: 11 08
LUNA TX len=1: 01
LUNA RX len=2: 11 0A
LUNA TX len=3: 00 00 0A
LUNA RX len=2: 11 0A
LUNA TX len=3: 00 00 0A
LUNA RX PAS_LEVEL len=4: 16 0B 00 21
PAS applied: level=0
LUNA TX len=2: 0B 18
LUNA TX PAS_ACK len=2: 0B 18
LUNA RX len=2: 11 31
LUNA TX len=3: 31 31 93
LUNA RX len=2: 11 31
LUNA TX len=3: 30 30 91
LUNA RX len=2: 11 20
LUNA TX len=3: 00 00 20
LUNA RX len=2: 11 20
LUNA TX len=3: 00 00 20
LUNA RX len=2: 11 11
LUNA TX len=3: 64 64 D9
LUNA RX len=2: 11 11
LUNA TX len=3: 64 64 D9
LUNA RX len=2: 11 08
LUNA TX len=1: 01
LUNA RX len=2: 11 08
LUNA TX len=1: 01
LUNA RX len=2: 11 0A
LUNA TX len=3: 00 00 0A
LUNA RX len=2: 11 0A
LUNA TX len=3: 00 00 0A
LUNA RX PAS_LEVEL len=4: 16 0B 0B 2C
PAS applied: level=11
LUNA TX len=2: 0B 18
LUNA TX PAS_ACK len=2: 0B 18
LUNA RX len=2: 11 31
LUNA TX len=3: 30 30 91
LUNA RX len=2: 11 31
LUNA TX len=3: 31 31 93
LUNA RX len=2: 11 20
LUNA TX len=3: 00 00 20
LUNA RX len=2: 11 20
LUNA TX len=3: 00 00 20
---- Closed the serial port COM12 ----
 
See #59
I have no idea, what you are doing...
Are you trying to port the Luna Cycle UART implementation to another hardware?!
I started by trying to get your VESC branch from GitHub - stancecoke/VESC_BLDC: The VESC motor control firmware to work with EKD01 and Flipsky V6 MK5. Cloned branch; fixed build errors and built for flipsky_60_mk5, then started trying to understand why it didn't seem to work; thus the terminal output.

Not sure how the Luna Cycle UART (which I thought was Luna's implementation of Bafang UART protocol) is different from Bafang UART. Was thinking it wasn't based on #30:
". . . I just took it from the Luna Cycle files. If you don't want to use a Flipsky 75100, you would have to port the files to your hardware."

It seems like it almost works but I am missing some information. Was trying to get the display to work without having the motor and torque sensor connected first but maybe that is not possible (it does work in the sense that it shows battery voltage along with err30). Will connect the motor and your torque emulator today. Do you have any suggestion for correct path?
 
You will have to look for requests from the display, that are not answered by the luna implementation. The display shows E30 if it gets no answer. I remember some commands were commented out and maybe your display sends some additional requests, that are not implemented in the Luna code yet.
You can start a multithread debug session from the CubeIDE and set some breakpoints to see if the code is executed as planned:
https://endless-sphere.com/sphere/t...ering-and-firmware-making.127833/post-1876244
It's crazy, how many threads are running in parallel on the VESC o_O

1765387325414-png.381965
 
You will have to look for requests from the display, that are not answered by the luna implementation. The display shows E30 if it gets no answer. I remember some commands were commented out and maybe your display sends some additional requests, that are not implemented in the Luna code yet.
You can start a multithread debug session from the CubeIDE and set some breakpoints to see if the code is executed as planned:
https://endless-sphere.com/sphere/t...ering-and-firmware-making.127833/post-1876244
It's crazy, how many threads are running in parallel on the VESC o_O

1765387325414-png.381965
thanks for the info; I did setup the openOCD debugger in VS Code and successfully hit some breakpoints a while back but didn't know exactly what to look for. Will look for unanswered requests. Also will work on setting it up in CubeIde to compare debugging capabilities.
Currently modifying your emulator to output Thun (https://ebikes.ca/amfile/file/download/file/175/product/23/) signals, which is the sensor I have, in order to have the complete system setup.
Working with the idea that the EKD01 requires torque or pas sensor and/or motor to be connected for the controller to send response or maybe it will throw err30?
 
Will you commit your code to GitHub? Would be great to see what went wrong and how you fixed it!
yes but first testing the rest of it and doing some cleanup

issues I am currently dealing with for some hours: build produces "Could not deserialize motor configuration. This probably means that something is wrong with your firmware, or this VESC Tool version." so, although the display works without err30, I can't use the VESC tool to configure the motor.

I am looking at merging the changes from my EKD01 build into the master branch, which does not produce that error didn't but now does after some merging. I thought I saw somewhere some required settings in VESC tool for this to work with VESC tool, but now I can't find that.
Recommendations?
 
Last edited:
yes but first testing the rest of it and doing some cleanup

issues I am currently dealing with for some hours: build produces "Could not deserialize motor configuration. This probably means that something is wrong with your firmware, or this VESC Tool version." so, although the display works without err30, I can't use the VESC tool to configure the motor.

I am looking at merging the changes from my EKD01 build into the master branch, which does not produce that error didn't but now does after some merging. I thought I saw somewhere some required settings in VESC tool for this to work with VESC tool, but now I can't find that.
Recommendations?
I have most of changes from master branch locally merged with the stancecoke branch and
#define MCCONF_SIGNATURE 788332866
which works with the latest vesc tool I downloaded

resulting fw_flipsky_60_mk5 hex file works to detect motor and spin with experiment settings with no err30 on the EKD01

problem arises when I connect the torque sensor emulator; motor does not spin and display produces err30 so, trouble shooting that

while doing that I found that the RX pin on the EKD01 has voltage that fluctuates between 4.2 volts and 5.4 volts which doesn't seem right; I thought it was supposed to be 3.3?

any insight on that? is the flipsky 5v tolerant on the RX pin? (I can't find the exact MCU number because on the board it is hidden under a non-removeable sticker)
 
Back
Top