EasyDIY OpenSource display for EVs: TSDZ2 and Bafang M500/M600 EBike motors

Current state of the display for Bafang M500/M600 motors:

The build of the boards started as this:




Yes, some components has glue because I am reusing them from other displays I built for TSDZ2 Ebike motor:


All the wiring done except the ones for the CAN module. Here I can already see the display working as also see if I can turn ON/OFF:


On last step I add the CAN module:


Finally I connect to the Bafang motor and it should fully work:


Yesterday I designed and 3D printed the enclosure final version:


The display works well, here is it installed on my handlebar:
 
My TSDZ2, with 8 wires, has already flashed the firmware TSDZ2-v1.1.1.hex, I made a 1.3-inch OLED (I2C version) EasyDIY display (I didn't install DCDC, I directly used the 5V wire inside the motor), I have some problems:
1. When I update the firmware firmware_ota-TSDZ2-OLED_1.3_I2C-0.20.0.zip and firmware_ota-OLED_1.3_I2C-0.10.0.zip, there will be abnormal display, but flashing firmware_ota-OLED_0.96_I2C-0.10.0.zip and firmware_ota-TSDZ2-OLED_0.96_I2C-0.20.0.zip is good;
2. There is a switch on my battery. When my battery is powered on, the display will automatically turn on to the ready state (the interface showing the speed), and you can ride normally. However, when you press and hold the on/off button to turn it off ,then press the on/off button to turn it on, the display will turn on, but it will not jump to the motor interface (it seems that the motor is not powered on).
3. After updating the firmware firmware_ota-TSDZ2-OLED_0.96_I2C-0.20.0.zip, by pressing twice and holding the on/off button, the customized numeric fields of the three main screens cannot be edited, and re-update the firmware firmware_ota-OLED_0.96_I2C After -0.10.0.zip, the customized numeric fields can be edited and selected, but this morning it was not editable again.
4. Available information to show on display, the variable “trip distance” is missing, other variables are available, but the variable "odometer" remains unchanged at 0.
 
Hi,

maybe the wrong place here to ask: I've flashed the bootloader to the nrf52 as described by @casainho here:

https://opensourceebike.github.io/bootloader.html

My question is, is it able to restore the default bootloader and firmware of the nrf52 Dongel?

Thanks!

BW
 
Turn off the device after setting, the next time it is turned on, it is very likely that the content of the last setting will not be displayed. It needs to be turned off by pressing the button, then turned on, then turned off, and turned on again to display the last set content.
 
First, people like @casainho are awesome :D. I really enjoyed putting the display together. Although I wouldn't call it easy diy, if the easy is referring to how easy it is to build a display that is. With my fat fingers and thin wires it was a journey. Along the difficulties of soldering, at one stage I managed to solder the display upside-down :).
Anyway, my old display got ruined by rain so I really want this diy display to be super waterproof.
Any ideas?
 
tanagra said:
First, people like @casainho are awesome :D. I really enjoyed putting the display together. Although I wouldn't call it easy diy, if the easy is referring to how easy it is to build a display that is. With my fat fingers and thin wires it was a journey. Along the difficulties of soldering, at one stage I managed to solder the display upside-down :).
Anyway, my old display got ruined by rain so I really want this diy display to be super waterproof.
Any ideas?
Easy DIY because actually the electronics are assembled by machines and the components are so tiny like a grain of sand, so, it is easy comparing to actual technology that is only to be used by machines and not humans.

Super water prof? I would say do add some kind of glue all over 3D printed enclosure. Maybe even adding some glue layer on inside and then other on the outside.
 
casainho said:
tanagra said:
First, people like @casainho are awesome :D. I really enjoyed putting the display together. Although I wouldn't call it easy diy, if the easy is referring to how easy it is to build a display that is. With my fat fingers and thin wires it was a journey. Along the difficulties of soldering, at one stage I managed to solder the display upside-down :).
Anyway, my old display got ruined by rain so I really want this diy display to be super waterproof.
Any ideas?
Easy DIY because actually the electronics are assembled by machines and the components are so tiny like a grain of sand, so, it is easy comparing to actual technology that is only to be used by machines and not humans.

Super water prof? I would say do add some kind of glue all over 3D printed enclosure. Maybe even adding some glue layer on inside and then other on the outside.

Ok, thanks for the suggestion. I will try multiple things. I have ordered a transparent heat shrink tube, let's see how that plays out.

There's another thing, not strictly related to the display. The motor keeps pushing although I do not apply any force to the pedals. I have calibrated the torque sensors and enabled/disabled numerous settings with no luck. I have to press fairly hard backwards for the motor to stop.
 
Here the way I use silicone:



And my final EBike build, running perfectly with our OpenSource EasyDIY display (in fact, I end up to never use the original display):



Two of my EBikes, left side MTB with M500 motor and on right side our mini cargo bike with TSDZ2 - both with EasyDIY display:


 
I just finished the build notes for the display, Bafang version: https://opensourceebike.github.io/build_display-bafang_m500_M600.html

I didn't change anything on the build process concepts compared to the TSDZ2 version. This displays are working well and withstand with the water from when I wash my EBikes. I do not have yet experience with rain, but I hope I will on next winter.

The tape, it is really important to use it to avoid water entrance on the display:

build-2.png
 
Can you try Garmin IQ AppBuilder 5+ with your Display
you can do a lot of interesting things with this application
https://ciq-appbuilder.blogspot.com/p/examples.html
https://apps.garmin.com/en-US/apps/394941a6-4e73-4843-820b-fdcfbc877f3a

cnkf.jpg
 
SUPERJC said:
Can you try Garmin IQ AppBuilder 5+ with your Display
you can do a lot of interesting things with this application
https://ciq-appbuilder.blogspot.com/p/examples.html
https://apps.garmin.com/en-US/apps/394941a6-4e73-4843-820b-fdcfbc877f3a

cnkf.jpg
Nice picture!!!

I do not have yet ANT+ well tested on this display, but I want for myself and so as soon I have it, I need to write more notes on the site about it and probably use that links your refer! Thanks.
 
Again a wonderful job around this great TSDZ2 motor !! Thanks to Casainho and all !!

I'm considering going towards this diy display solution, but have a couple of questions :

1) I suppose this will work only with Casainho firmware on TSDZ2 ? I currently ride with Mbrusa firmware + SW102 display. I love/need the Emtb assist mode, and the possibility to change assist mode when riding in other types of conditions.
How difficult would it be to merge both projects ?

2) Seems quite difficult to find available mosfets currently. I suppose it is possible to use other types/brands. Can someone give at least the general or minimum specs they have to respect ?


Thks in advance
 
ben5763 said:
Again a wonderful job around this great TSDZ2 motor !! Thanks to Casainho and all !!

I'm considering going towards this diy display solution, but have a couple of questions :

1) I suppose this will work only with Casainho firmware on TSDZ2 ? I currently ride with Mbrusa firmware + SW102 display. I love/need the Emtb assist mode, and the possibility to change assist mode when riding in other types of conditions.
How difficult would it be to merge both projects ?

2) Seems quite difficult to find available mosfets currently. I suppose it is possible to use other types/brands. Can someone give at least the general or minimum specs they have to respect ?


Thks in advance
Build and using this display is a good investment.

1) you need to ask MBrusa to support this display.

2) this display is the result of many contributions of different developers. The one that did initially that part for turn on/off the TSDZ2 motor, I think is not active anymore and I do not know an answer to you. But look at previous recent messages, seems others did find alternatives to that components.
 
ben5763 said:
Again a wonderful job around this great TSDZ2 motor !! Thanks to Casainho and all !!

I'm considering going towards this diy display solution, but have a couple of questions :

1) I suppose this will work only with Casainho firmware on TSDZ2 ? I currently ride with Mbrusa firmware + SW102 display. I love/need the Emtb assist mode, and the possibility to change assist mode when riding in other types of conditions.
How difficult would it be to merge both projects ?

2) Seems quite difficult to find available mosfets currently. I suppose it is possible to use other types/brands. Can someone give at least the general or minimum specs they have to respect ?


Thks in advance

For the 2). Are you using 36v or 48v?
 
tanagra said:
ben5763 said:
Again a wonderful job around this great TSDZ2 motor !! Thanks to Casainho and all !!

I'm considering going towards this diy display solution, but have a couple of questions :

1) I suppose this will work only with Casainho firmware on TSDZ2 ? I currently ride with Mbrusa firmware + SW102 display. I love/need the Emtb assist mode, and the possibility to change assist mode when riding in other types of conditions.
How difficult would it be to merge both projects ?

2) Seems quite difficult to find available mosfets currently. I suppose it is possible to use other types/brands. Can someone give at least the general or minimum specs they have to respect ?


Thks in advance

For the 2). Are you using 36v or 48v?

48v
 
I cannot help you with the 48 volts. I was in the same situation a couple of months ago when I built mine. But my system is 36 volts and I could then find another solution.

So for the rest of you who wants to build this wonderful display and you use 36 volts you can swap the BTS4140N and BSP292/BSS123 to an ITS4141N.
 
@ben5763 I am quoting my post from page 4:

kaziq said:
Hi, recently I had the same problem, BTS4140N is not available anywhere (I ordered some from Aliexpress, but they never came).
I decided to replace BTS4140 with BSP321 P-Mosfet and some additional resistors to protect the gate.
(BTS4140 is just a P-Mosfet with some additional circuits for protection and easier driving).
Here is my schematic and picture of it soldered. I tested very briefly, and the proper voltage appears on the TSDZ2_Vin line with the motor connected. I did not test it fully, because it would need reflashing the motor firmware, and I don't want to do it yet.

Please note that the BSP321, although the same package as BTS4140, is connected differently!

schem.jpg

DSC_7485.jpg

The images didn't quote properly, so you will have to go to page 4 if you want to see them.

The resistor values in my schematic are for 48V motor. They should work for 36V too, but the BTS4140 replacement transistor should have lower Vgs(th), around -5V or closer to zero.

The transistors can be replaced with many others. The general requirements are:
For BTS4140N replacement: P-Mosfet, enhancement mode, Vds >= 60V, Rdson <= 1 Ohm, Vgs(th) <= -7V
For BSP296 replacement: N-Mosfet, enhancement mode, Vds >= 60V, Rdson <= 1 Ohm, Vgs(th) <= 2V

Perhaps it would still work with the higher Rdson values, but I didn't try, so I can't tell for sure.
 
I've been banging my head against the wall with trying to flash the NRF bootloader. I've 100% wired it correctly and have tried to flash 2 different NRF chips with a confirmed working stlinkv2 and every time I keep hitting this error. I've tried different OCD versions, I've updated the ST-link v2 to the latest firmware and even checked continuity on my solder joints to be sure everything is connected. What the hell am I doing wrong? below is the error I get in the CMD when I enter the command. Any help is greatly appreciated.

:\openocd\bin>openocd.exe -f ../share/openocd/scripts/interface/stlink.cfg -f ../share/openocd/scripts/target/nrf52.cfg -c "init" -c "halt" -c "nrf5 mass_erase" -c "exit"
Open On-Chip Debugger 0.11.0 (2021-11-18) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

nRF52 device has a CTRL-AP dedicated to recover the device from AP lock.
A high level adapter (like a ST-Link) you are currently using cannot access
the CTRL-AP so 'nrf52_recover' command will not work.
Do not enable UICR APPROTECT.

Info : clock speed 1000 kHz
Info : STLINK V2J39S7 (API v2) VID:pID 0483:3748
Info : Target voltage: 3.269960
Warn : target nrf52.cpu examination failed
Info : starting gdb server for nrf52.cpu on 3333
Info : Listening on port 3333 for gdb connections
Error: Target not examined yet


c:\openocd\bin>
c:\openocd\bin>
 
Admiralrofl said:
I've been banging my head against the wall with trying to flash the NRF bootloader. I've 100% wired it correctly and have tried to flash 2 different NRF chips with a confirmed working stlinkv2 and every time I keep hitting this error. I've tried different OCD versions, I've updated the ST-link v2 to the latest firmware and even checked continuity on my solder joints to be sure everything is connected. What the hell am I doing wrong? below is the error I get in the CMD when I enter the command. Any help is greatly appreciated.

:\openocd\bin>openocd.exe -f ../share/openocd/scripts/interface/stlink.cfg -f ../share/openocd/scripts/target/nrf52.cfg -c "init" -c "halt" -c "nrf5 mass_erase" -c "exit"
Open On-Chip Debugger 0.11.0 (2021-11-18) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

nRF52 device has a CTRL-AP dedicated to recover the device from AP lock.
A high level adapter (like a ST-Link) you are currently using cannot access
the CTRL-AP so 'nrf52_recover' command will not work.
Do not enable UICR APPROTECT.

Info : clock speed 1000 kHz
Info : STLINK V2J39S7 (API v2) VID:pID 0483:3748
Info : Target voltage: 3.269960
Warn : target nrf52.cpu examination failed
Info : starting gdb server for nrf52.cpu on 3333
Info : Listening on port 3333 for gdb connections
Error: Target not examined yet


c:\openocd\bin>
c:\openocd\bin>
Try to run the same line but remove that init, halt and mass erase.

The way I do, is run OpenOCD without that commands, then on the OpenOCD sheel (using Telnet), I send that.commands one by one at a time and I get specific feedback for each one.

See the end of this page for the commands O send: https://opensourceebike.github.io/development/development-flash_and_debug_firmware.html
 
casainho said:
Admiralrofl said:
I've been banging my head against the wall with trying to flash the NRF bootloader. I've 100% wired it correctly and have tried to flash 2 different NRF chips with a confirmed working stlinkv2 and every time I keep hitting this error. I've tried different OCD versions, I've updated the ST-link v2 to the latest firmware and even checked continuity on my solder joints to be sure everything is connected. What the hell am I doing wrong? below is the error I get in the CMD when I enter the command. Any help is greatly appreciated.

:\openocd\bin>openocd.exe -f ../share/openocd/scripts/interface/stlink.cfg -f ../share/openocd/scripts/target/nrf52.cfg -c "init" -c "halt" -c "nrf5 mass_erase" -c "exit"
Open On-Chip Debugger 0.11.0 (2021-11-18) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

nRF52 device has a CTRL-AP dedicated to recover the device from AP lock.
A high level adapter (like a ST-Link) you are currently using cannot access
the CTRL-AP so 'nrf52_recover' command will not work.
Do not enable UICR APPROTECT.

Info : clock speed 1000 kHz
Info : STLINK V2J39S7 (API v2) VID:pID 0483:3748
Info : Target voltage: 3.269960
Warn : target nrf52.cpu examination failed
Info : starting gdb server for nrf52.cpu on 3333
Info : Listening on port 3333 for gdb connections
Error: Target not examined yet


c:\openocd\bin>
c:\openocd\bin>
Try to run the same line but remove that init, halt and mass erase.

The way I do, is run OpenOCD without that commands, then on the OpenOCD sheel (using Telnet), I send that.commands one by one at a time and I get specific feedback for each one.

See the end of this page for the commands O send: https://opensourceebike.github.io/development/development-flash_and_debug_firmware.html

I'm running windows and setting up the visual studio code is a bit above my technical know-how. I did just try running the code without the init, halt and mass erase and i get this
C:\openocd\bin>openocd.exe -f ../share/openocd/scripts/interface/stlink.cfg -f ../share/openocd/scripts/target/nrf52.cfg
Open On-Chip Debugger 0.11.0 (2021-11-18) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

nRF52 device has a CTRL-AP dedicated to recover the device from AP lock.
A high level adapter (like a ST-Link) you are currently using cannot access
the CTRL-AP so 'nrf52_recover' command will not work.
Do not enable UICR APPROTECT.

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : STLINK V2J39S7 (API v2) VID:pID 0483:3748
Info : Target voltage: 3.269960
Warn : target nrf52.cpu examination failed
Info : starting gdb server for nrf52.cpu on 3333
Info : Listening on port 3333 for gdb connections

It just hangs here and doesnt do anything. Is there anyway to send those commands through the CMD prompt and avoid using visusal studio code?
 
Admiralrofl said:
casainho said:
Admiralrofl said:
I've been banging my head against the wall with trying to flash the NRF bootloader. I've 100% wired it correctly and have tried to flash 2 different NRF chips with a confirmed working stlinkv2 and every time I keep hitting this error. I've tried different OCD versions, I've updated the ST-link v2 to the latest firmware and even checked continuity on my solder joints to be sure everything is connected. What the hell am I doing wrong? below is the error I get in the CMD when I enter the command. Any help is greatly appreciated.

:\openocd\bin>openocd.exe -f ../share/openocd/scripts/interface/stlink.cfg -f ../share/openocd/scripts/target/nrf52.cfg -c "init" -c "halt" -c "nrf5 mass_erase" -c "exit"
Open On-Chip Debugger 0.11.0 (2021-11-18) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

nRF52 device has a CTRL-AP dedicated to recover the device from AP lock.
A high level adapter (like a ST-Link) you are currently using cannot access
the CTRL-AP so 'nrf52_recover' command will not work.
Do not enable UICR APPROTECT.

Info : clock speed 1000 kHz
Info : STLINK V2J39S7 (API v2) VID:pID 0483:3748
Info : Target voltage: 3.269960
Warn : target nrf52.cpu examination failed
Info : starting gdb server for nrf52.cpu on 3333
Info : Listening on port 3333 for gdb connections
Error: Target not examined yet


c:\openocd\bin>
c:\openocd\bin>
Try to run the same line but remove that init, halt and mass erase.

The way I do, is run OpenOCD without that commands, then on the OpenOCD sheel (using Telnet), I send that.commands one by one at a time and I get specific feedback for each one.

See the end of this page for the commands O send: https://opensourceebike.github.io/development/development-flash_and_debug_firmware.html

I'm running windows and setting up the visual studio code is a bit above my technical know-how. I did just try running the code without the init, halt and mass erase and i get this
C:\openocd\bin>openocd.exe -f ../share/openocd/scripts/interface/stlink.cfg -f ../share/openocd/scripts/target/nrf52.cfg
Open On-Chip Debugger 0.11.0 (2021-11-18) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

nRF52 device has a CTRL-AP dedicated to recover the device from AP lock.
A high level adapter (like a ST-Link) you are currently using cannot access
the CTRL-AP so 'nrf52_recover' command will not work.
Do not enable UICR APPROTECT.

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : STLINK V2J39S7 (API v2) VID:pID 0483:3748
Info : Target voltage: 3.269960
Warn : target nrf52.cpu examination failed
Info : starting gdb server for nrf52.cpu on 3333
Info : Listening on port 3333 for gdb connections

It just hangs here and doesnt do anything. Is there anyway to send those commands through the CMD prompt and avoid using visusal studio code?
So that output seems good, as if OpenOCD were able to correctly connect. That line is what is called on Visual Code Studio.

Now you just need to use Telnet to open a connection sheel to OpenOCD and then run each command one by one.

Try to see online how to do it. I do not have Windows so I can't tell.
 
The easiest way for Windows is to use PuTTY. Download from here: https://www.putty.org/
In the Host Name field type localhost
In the Port field type 4444
In the Connection type field select Telnet
It should open a console where you will be able to type the commands.
 
kaziq said:
The easiest way for Windows is to use PuTTY. Download from here: https://www.putty.org/
In the Host Name field type localhost
In the Port field type 4444
In the Connection type field select Telnet
It should open a console where you will be able to type the commands.

yeah, i googled and found someone recommended putty as well, I've used it before for RPI stuff. I logged in through putty and started sending commands, when I get to mass erase i get this

> init
> reset halt

> nrf5 mass_erase
Target not examined yet
Couldn't read CONFIGID register
auto_probe failed


So I went back and looked and I reread this message that pops up in CMD

nRF52 device has a CTRL-AP dedicated to recover the device from AP lock.
A high level adapter (like a ST-Link) you are currently using cannot access
the CTRL-AP so 'nrf52_recover' command will not work.
Do not enable UICR APPROTECT.

reading through this https://blog.dbrgn.ch/2020/5/16/nrf52-unprotect-flash-jlink-openocd/
It appears to me to issue these mass erase commands you need to connet with a jlink, not a stlinkv2. Am i misunderstanding this? were you all able to end erase this with a stlink-v2 this way?


Edit: I found another post talking about this exact issue.
 

Attachments

  • Capture.PNG
    Capture.PNG
    171.9 KB · Views: 923
Back
Top