TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

buba said:
jbalat said:
dameri, could it be your flash cable is too long ?

buba, well done !!!.. How do you reset the trip meter, I think we had problems trying to come up with a button combination that hasnt been used yet.

Thank you so much!!! (And thanks for all the videos!)

When you are choosing to display the trip distance in the odometer field you can simply SHORT CLICK and then LONG HOLD the DOWN button. The same way you reset the odometer and the "distance since power on" by the way. The menu is as follows:

1.0 TRIP DISTANCE
1.1 DISTANCE SINCE POWER ON
1.2 ODOMETER

All is displayed in either miles (MIL) or kilometers (KM) depending on the setting you choose in the basic setup (imperial/metric).

Should I add so that you can set the trip distance to any value also or should that be "locked"? Feedback appreciated!
Hi Buba.

I did the main development of the firmware and I did the structure of LCD3 firmware, so I can guide you.

1.0 TRIP DISTANCE
1.1 DISTANCE SINCE POWER ON
1.2 ODOMETER
On current code, 1.1 and 1.2 are implemented but 1.2 ODOMETER is not. What I wanted to do but I didn't had time, was to store on EEPROM the last selected 1.x, so if user prefers to see for instance 1.1 DISTANCE SINCE POWER ON, the system will always start at 1.1 when users cycles over odometer fields. Is the same idea that odometer last field number is already stored on EEPROM and then the subfields would also need to be stored on EEPROM.

Do you plan to submit a pull request? I suggest you to make a pull request and then I all look and test it, then we can make a new release.
 
andyme said:
i think it is really important that casainho get involved in this matter since endlesscadence seems not to be around. casainho is in the process of adapting the firmware to work with a color display and i think in order to stay compatible with the future development all changes should be integrated ideally into one piece of software only. So i would hope that you and casainho will agree on how to create files that satisfy his and your needs so that your changes can stay integrated in all future releases.

thineight, thanks! :thumb:

andyme, I would never want it to exist separate versions and would appreciate Casainhos input and feedback into implementing these functions officially. I do respect the time he, and others, have put into this firmware and would never want to request more. I hope someone sees the code to be approved for official use in further versions.

The code is merely updated on the display side and would not take much time to inspect and approve.
 
buba said:
andyme said:
i think it is really important that casainho get involved in this matter since endlesscadence seems not to be around. casainho is in the process of adapting the firmware to work with a color display and i think in order to stay compatible with the future development all changes should be integrated ideally into one piece of software only. So i would hope that you and casainho will agree on how to create files that satisfy his and your needs so that your changes can stay integrated in all future releases.

thineight, thanks! :thumb:

andyme, I would never want it to exist separate versions and would appreciate Casainhos input and feedback into implementing these functions officially. I do respect the time he, and others, have put into this firmware and would never want to request more. I hope someone sees the code to be approved for official use in further versions.

The code is merely updated on the display side and would not take much time to inspect and approve.

As i see it you got casainho already on your train... :) good luck! i think many of us have been looking for these features.
 
On current code, 1.1 and 1.2 are implemented but 1.2 ODOMETER is not. What I wanted to do but I didn't had time, was to store on EEPROM the last selected 1.x, so if user prefers to see for instance 1.1 DISTANCE SINCE POWER ON, the system will always start at 1.1 when users cycles over odometer fields. Is the same idea that odometer last field number is already stored on EEPROM and then the subfields would also need to be stored on EEPROM.

Do you plan to submit a pull request? I suggest you to make a pull request and then I all look and test it, then we can make a new release.

Hi Casainho, and thank you for the reply!

I know what you mean and will try to fix it so that everything is stored on EEPROM and saved even when user power cycles! Good feedback!

Will try to add that also and then pull request so you can test it! Great!
 
buba said:
I know what you mean and will try to fix it so that everything is stored on EEPROM and saved even when user power cycles! Good feedback!

Will try to add that also and then pull request so you can test it! Great!
Well, but the idea would be to store all subfields last state, not only the subfiled for 1.x. I hope that while you are at it, you can structure and implementation that works for all the subfields.
 
Nah looks fine to me.. hmmm, other issues people have had is markings on their stlink was not the same as default but then you would get different errors, also not enough power on the USB port, maybe try another laptop ?
 
DPC-18 hmmmm...glue, glue, glue...and i think very different from the 850C

one thing before i start:

this UART thing....could that mean that it could be programmed without the need to open it?

ok, so i opened it...different case/housing as the 850C...there is no frame, etc...so the cover glass is glued in directly into the case. it is from real glass. I think it would be very difficult to remove it without breaking it. I broke mine into pieces. However: it could always be replaced by some piece of acrylic glass for a few cents. so that must not necessarily be the stop mark yet.

after the glass is gone, the display comes out immediately. the board is held in place by 2 small screws AND: glue....the part you want to get to is the bottom side, in order to get there you will also need to remove the USB which is, you guess it, also glued in..

i managed to remove all that (it is not really a problem, frankly spoken.

So please find attached the pics. first one is an open 850C so you can see that i was able to open that one with no issue... :lol:
 

Attachments

  • 20181207_141951.jpg
    20181207_141951.jpg
    215.5 KB · Views: 1,669
  • 20181207_142002.jpg
    20181207_142002.jpg
    184.1 KB · Views: 1,669
andyme said:
this UART thing....could that mean that it could be programmed without the need to open it?
850C also is updated by UART but it is encrypted, it uses an encrypted bootloader that I bet is the same for the DPC18. They both use the same STM32, I bet they both use UART bootloader with encryption so using UART to update is not an option.

That STM32F205RC is an Arm Cortex-M3 MCU with 256 Kbytes Flash, 120 MHz CPU and the one on 850C has 512 Kbytes Flash, 128 MHz CPU. So I would say in terms of processing and memory for implement advanced features, the 850C is good.

That board of DPC18, I can't see pads where we can connect the STLinkV2 for flashing while on 850C they are conveniently placed on top right, like on KT-LCD3 and so is easy to open a hole on the case to accommodate the programming header pins.
Also, as you say, it seems more destructive the process to open DPC18 when compared to 850C. And also since hardware is different, microcontroller reference, probably a different LCD (no LCD reference), etc, would take a lot of time and money to start develop for DPC-18 and so I am discarding that possibility.

About the remote buttons, I see 5 wires on the board: black, green, yellow, blue and red. Can you please open the remote and see how the buttons are wired?? how it has 5 buttons with only 5 wires?? Because maybe we can learn and who knows if we can do the same for 850C and it has on the board 5 pads for 5 wires from a remote...
 
casainho said:
andyme said:
this UART thing....could that mean that it could be programmed without the need to open it?
850C also is updated by UART but it is encrypted, it uses an encrypted bootloader that I bet is the same for the DPC18. They both use the same STM32, I bet they both use UART bootloader with encryption so using UART to update is not an option.

That STM32F205RC is an Arm Cortex-M3 MCU with 256 Kbytes Flash, 120 MHz CPU and the one on 850C has 512 Kbytes Flash, 128 MHz CPU. So I would say in terms of processing and memory for implement advanced features, the 850C is good.

That board of DPC18, I can't see pads where we can connect the STLinkV2 for flashing while on 850C they are conveniently placed on top right, like on KT-LCD3 and so is easy to open a hole on the case to accommodate the programming header pins.
Also, as you say, it seems more destructive the process to open DPC18 when compared to 850C. And also since hardware is different, microcontroller reference, probably a different LCD (no LCD reference), etc, would take a lot of time and money to start develop for DPC-18 and so I am discarding that possibility.

About the remote buttons, I see 5 wires on the board: black, green, yellow, blue and red. Can you please open the remote and see how the buttons are wired?? how it has 5 buttons with only 5 wires?? Because maybe we can learn and who knows if we can do the same for 850C and it has on the board 5 pads for 5 wires from a remote...

Gotcha...i will be doing this in about 8-9 hours from now
 
casainho said:
andyme said:
this UART thing....could that mean that it could be programmed without the need to open it?
850C also is updated by UART but it is encrypted, it uses an encrypted bootloader that I bet is the same for the DPC18. They both use the same STM32, I bet they both use UART bootloader with encryption so using UART to update is not an option.
With encrypted bootloader, they own the firmware and seems they sell specific firmware versions for OEMs, sometimes as we see, the only thing is placing an image banner with the brand of the OEM -- that is why I am being contacted by some OEMs/EBike sellers asking for me to place the brand on the LCD -- that must have value for them!!

I believe Bafang (and other producers) earn money by customizing their original LCD firmware for OEMs, that is why they want to lock the system and that is why this project could represent some problems to this part of their business model -- but, open the LCDs and solder pins is DIY so I guess OEMs will still prefer to pay them and buy batch of LCDs ready and with guarantee.
 
andyme said:
casainho said:
andyme said:
this UART thing....could that mean that it could be programmed without the need to open it?


Gotcha...i will be doing this in about 8-9 hours from now
I need more time to look into this. PCB is 2 sided black is supposed to be ground. Maybe there are some combinations of wires that are being activated? I will try to measure this, no idea of i will be successful. I will be back with more ...20181208_001223~01.jpg20181208_001214~01.jpg
 
Phew. I'm glad I decided not to try and open the front of my DPC18 Andyme that is one very expensive look and see you just did. :shock:
 
Is the high cadence mode only applicable to the 36V motor because the parameters used for this mode are for the 36V motor?

I can now build my own software so Im willing to try stuff for 48V motor if someone could let me know what parameters to try. Im also literate in software/firmware as its my profession and I spend all day analyzing and testing code (spent 20 years prior in coding/development).

The high human power values, still confuse me, I have been thru all the code/calculations and all looks good. Basically it just seems twice as high as it should. Just out of curiosity...from researching torques sensors like those available thru grin technologies, it appears that some only measure one pedals force and some measure from both pedals. Could this somehow be the issue?

In the end, I dont think it really matters as the power calculation is measuring work, if its off by a factor of x, thats fine. The possible issue is that the default assist multipliers seem to try be very close to those of the bosch unit but could be off if the actual power is not the same as what the bosch is measuring. From todays ride analysis, I think I am going to try lower assist multipliers like jbalat has recommended. Im basically going to just cut them(defaults) in half and see how that works. The default values just seem too 'all or nothing'. I can definately feel difference between assist 1(0.5) and 2(1.0) but 3-5(1.5,2.0,2.5) seem the same unless I intentionally barely use the pedals (low cadence, low pressure). Some might like that but it seems off to me and nothing like my brose equipped bike.

Just ordered an 850C, hoping to get that running next week
 
andyme said:
I need more time to look into this. PCB is 2 sided black is supposed to be ground. Maybe there are some combinations of wires that are being activated? I will try to measure this, no idea of i will be successful. I will be back with more ..
Try to make the schematic of that board, can be on a paper and then you take a picture.
 
jbalat said:
Nah looks fine to me.. hmmm, other issues people have had is markings on their stlink was not the same as default but then you would get different errors, also not enough power on the USB port, maybe try another laptop ?

I don’t know what is the problen. I think my laptop have enough power on usb port. ST-link is not regocnized in usb3 port. I have tried also desktop computer with usb extension cable, and no luck.

Maby I have wrong cable. There is different colors than wiki page. https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/Flash-the-firmware-on-TSDZ2

Picture colors from up to down.

Black, green orange, purple, brown and white

SpeedCable.jpg
 
dameri said:
jbalat said:
Nah looks fine to me.. hmmm, other issues people have had is markings on their stlink was not the same as default but then you would get different errors, also not enough power on the USB port, maybe try another laptop ?

I don’t know what is the problen. I think my laptop have enough power on usb port. ST-link is not regocnized in usb3 port. I have tried also desktop computer with usb extension cable, and no luck.

Maby I have wrong cable. There is different colors than wiki page. https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/Flash-the-firmware-on-TSDZ2

Picture colors from up to down.

Black, green orange, purple, brown and white




Wiring colours on that link are the same as your cable.

You should have Purple to RST, Black to SWIM, Orange to GND, and Brown to 5V. White and Green not used

To check your wiring with a multimeter here's the pin out photo https://github.com/hurzhurz/tsdz2/blob/master/pinout.md

Your ST Link Dongle is labeled slightly differently to mine The two GNDs swap places with SWIM and SWDIO but I've no idea if changing wires would cause damage. Like this:
https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/blob/master/flashing_motor_stlink.jpg


You may find this page helpful too
https://www.eco-ebike.com/blogs/eco-cycles-instructionals/tsdz2programmingfromscratch
 
Thanks Rafe.

My ST-LINK is propably not working. When I try to read tabs the light goes out of device. Is this normal? I have to unplug device and connect again and light comes on.

Where you have ordered (working) ST-LINK device? Is there sellers in europe? When order from china it takes ages to come.
 
In the UK you can order from what are listed as UK sellers on Ebay at a premium price so I assume that must be the same elsewhere. The one caveat is that many of them are actually in China using faster mail.
 
Just reading back through your posts Dameri you seem to be doing everything properly. Logically if the ST Link works on LCD3 and not on the motor controller then it has to be the wiring to the controller and that usually is the wires are too long but in your case they could not be shorter. So I would suggest checking your wiring from the ST link to the plug again because if the length of wiring is critical then a poor connection would also have the same effect. Taking out the soldering iron and re-doing it all again may just pay dividends.
 
Thank's again Rafe, I have been triple check wires and solder again wires. I think I go to buy new dongle from local dealer on monday. It's quite expensive compared to ebay but I don't have to wait.

Now I'm going to watch snooker.
 
Yes I think I would try another link too then. Enjoy the snooker, :D These cheap Chinese clones are probably a false economy.


like you I could not programme the controller from the lap top but could the LCD3 and also like you managed to read the controller a few times. I then moved over to the PC and that was still iffy so I then used the USB socket on on a memory card reader that is plugged directly into a USB riser on the motherboard with no other USB devices loading the connection and hey presto it worked. That was via a USB extension lead from PC to ST Link too but it was the second one I tried, it did not work properly on first extension lead.
 
linklemming writes
I can definately feel difference between assist 1(0.5) and 2(1.0) but 3-5(1.5,2.0,2.5) seem the same unless I intentionally barely use the pedals (low cadence, low pressure)
The stock firmware uses torque assist levels of 0.4, 0.75, 1.5, and 3.0
Note the progression, each step is double. Try something like that.
 
casainho said:
andyme said:
I need more time to look into this. PCB is 2 sided black is supposed to be ground. Maybe there are some combinations of wires that are being activated? I will try to measure this, no idea of i will be successful. I will be back with more ..
Try to make the schematic of that board, can be on a paper and then you take a picture.

ok, so it goes like this:

wire combination: "button name"

yellow and black: "plus"
green and black : "minus"
yellow and red : "info symbol"
green and red : "light symbol"
blue and red : "power symbol"

Labels:

blue: L1
green: L2
yellow: L3
red: R1
black: GND
 
Back
Top