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

Send also the nrf52_recover command. Please report back if then you will be able to flash the firmware / bootloader.
 
I think the warning applies to nrf52_recover command.
For me the mass_erase worked fine with STLink-V2.
I have never seen an error like this, perhaps the STLink-v2 locked the chip somehow (which the text you linked suggests)?
Have you tried reconnecting the power to everything?

EDIT: I don't remember correctly, but perhaps there is a special command for nrf52 erase, like nrf_erase?
 
casainho said:
Send also the nrf52_recover command. Please report back if then you will be able to flash the firmware / bootloader.

sent the command, this is the response back I get.

> init
> reset halt

> nrf52_recover
nrf52.dap
../share/openocd/scripts/target/nrf52.cfg:74: Error:
in procedure 'nrf52_recover'
at file "../share/openocd/scripts/target/nrf52.cfg", line 74
>
 
Admiralrofl said:
casainho said:
Send also the nrf52_recover command. Please report back if then you will be able to flash the firmware / bootloader.

sent the command, this is the response back I get.

> init
> reset halt

> nrf52_recover
nrf52.dap
../share/openocd/scripts/target/nrf52.cfg:74: Error:
in procedure 'nrf52_recover'
at file "../share/openocd/scripts/target/nrf52.cfg", line 74
>

All the documentation I'm reading online says that you need a j-link to flash the bootloaders on these things. I'm not sure what I'm doing wrong but I'm starting to think I might be kinda hosed on this whole deal. I'll look again at this tomorrow but I'm starting to lose hope I'll be able to get this display working.
 
Admiralrofl said:
casainho said:
Send also the nrf52_recover command. Please report back if then you will be able to flash the firmware / bootloader.

sent the command, this is the response back I get.

> init
> reset halt

> nrf52_recover
nrf52.dap
../share/openocd/scripts/target/nrf52.cfg:74: Error:
in procedure 'nrf52_recover'
at file "../share/openocd/scripts/target/nrf52.cfg", line 74
>
nrf52_recover works for me. I have to execute that command everytime after I power on the NRF52.

I can say I always used Stink V2 clones with OpenOCD V0.10. But the latest versions of OpenOCD seems a bit different...
 
Just a shot in the dark, but could you set up a Linux system, virtual box, or a temp live version or a real partition or an old machine and try using openocd from there especially casainho's version? I recall some time ago that I couldn't get ordinary working from windows. I cant recall what I was doing..There are different versions around as well. But it is a lot of faffing about and wastes so much time, but you'll figure it out eventually. :D
 
Later when I'm home I will try to reflash bootloader into my board and tell you the exact procedure that works for me.
 
kaziq said:
Later when I'm home I will try to reflash bootloader into my board and tell you the exact procedure that works for me.
If you guys write some notes for Windows, I can add to the bootloadaer page.
 
This is what I get:



Then on Telnet session I do (note that I had to send the command twice as at first it did not work):



Just after the flash works successfully:



Note that I am using now the JLink cheap bought on Aliexpress or Ebay.
 
I just checked the notes I have made when I flashed the bootloader, and they say I used the "mass_erase" command. So it looks like you somehow enabled the access port protection (AP) function, and stlink will not work for you (you need to use "nrf52_recover" command, which stlink does not support).
 
kaziq said:
I just checked the notes I have made when I flashed the bootloader, and they say I used the "mass_erase" command. So it looks like you somehow enabled the access port protection (AP) function, and stlink will not work for you (you need to use "nrf52_recover" command, which stlink does not support).
That is a pity as I remember to flash perfectly this boards with STLinkV2. So maybe I should the notes and remove the refetemces to STLinkV2.
 
casainho said:
That is a pity as I remember to flash perfectly this boards with STLinkV2. So maybe I should the notes and remove the refetemces to STLinkV2.
I don't know. For me it worked perfectly with stlink-v2.
It's hard to tell what went wrong with the Admiralrofl's case.
I think you should add a warning, that in some cases the board may lock up, and an Olimex or Segger J-Link may be required.
 
kaziq said:
casainho said:
That is a pity as I remember to flash perfectly this boards with STLinkV2. So maybe I should the notes and remove the refetemces to STLinkV2.
I don't know. For me it worked perfectly with stlink-v2.
It's hard to tell what went wrong with the Admiralrofl's case.
I think you should add a warning, that in some cases the board may lock up, and an Olimex or Segger J-Link may be required.
I am afraid the issue can be on more recent boards, because I had to do the nrf52_recover just on recent boards I bought.
Happens that I also started to use cheap JLink in favor of cheap STLinkV2 because of being more robust.
 
casainho said:
Happens that I also started to use cheap JLink in favor of cheap STLinkV2 because of being more robust.
I remember hearing a long time ago that stlink can be officially "upgraded" with a special software, that changes it into a j-link. Wonder if that would help in this case. I tried it once, but returned to stlink, because the j-link firmware didn't support the UART pins in Nucleo dongles. Don't know if the cheap stlink clones can do that too (theoretically they should, because they can be updated with the official stlink firmware).
 
I did first test ride with the Garmin Rally XC200 power meter pedals + Garmin Edge 1040. On the EasyDIY display, I have the regular 3 buttons and I also have the 4th button specifically to change the Garmin Edge pages.

The EasyDIY display is very small, shows only motor data and is hard to see outdoors. But since this display is implementing ANT+LEV Ebike, I am seeing the motor assist level value and battery SOC directly on Garmin Edge, which is showing important data as seen on the image: my human pedal power; my heart rate; my stamina; etc. There are other pages that I am not showing, like the map navigation page, elevation graph page, etc.

The pedal power meter seems to work very well, no issue at all for being installed on an EBike. And I was also using my Garmin Fenix 7 watch, where I also paired the pedals power meter, meaning I was receiving and recording the same value both on my watch and on the GPS cycling computer. This is the advantage of ANT compared to Bluetooth.



 
Admiralrofl said:
Admiralrofl said:
casainho said:
Send also the nrf52_recover command. Please report back if then you will be able to flash the firmware / bootloader.

sent the command, this is the response back I get.

> init
> reset halt

> nrf52_recover
nrf52.dap
../share/openocd/scripts/target/nrf52.cfg:74: Error:
in procedure 'nrf52_recover'
at file "../share/openocd/scripts/target/nrf52.cfg", line 74
>

All the documentation I'm reading online says that you need a j-link to flash the bootloaders on these things. I'm not sure what I'm doing wrong but I'm starting to think I might be kinda hosed on this whole deal. I'll look again at this tomorrow but I'm starting to lose hope I'll be able to get this display working.

Don't give up. I went the same stlink clone path and it wasn't pretty.
After countless of tries I went with a raspberry pi + openocd solution. It might sound complicated but compared to the struggles with the stlink clone it's nothing.
The first part of this clip is the source of the setup.

https://youtu.be/R5wub5ywzTU

No more supporting clones! Good luck!
 
@Casainho
now that you are equipped :thumb:
You can try to make custom fields
This is how the Garmin calculates custom fields

bsp7.jpg
 
I found a nasty trap. ;)
There is different HW connection from the first version (SW release v0.10.0) and latest - with CAN (SW release v0.20.0).
I spent a whole day digging what's wrong with my SPI display...
Nice project anyway. :thumb:
 
dodox said:
I found a nasty trap. ;)
There is different HW connection from the first version (SW release v0.10.0) and latest - with CAN (SW release v0.20.0).
I spent a whole day digging what's wrong with my SPI display...
Nice project anyway. :thumb:
Yes, I think I changed some pins because of Bafang version that also uses SPI for the CAN module.
 
Did You think about adding possibility to acting like a ANT+ Bicycle Speed (and / or Cadence) sensor?
 
Hi all I gave up building mine, anyone want the parts cheap?

https://endless-sphere.com/forums/viewtopic.php?f=9&t=116732
 
dodox said:
Did You think about adding possibility to acting like a ANT+ Bicycle Speed (and / or Cadence) sensor?
No I didn't. Maybe even adding cycling power, as on TSDZ2 we have that information.

I have no free time to work on this project. I wish other developers to could to help such features.
 
Which TSDZ2 motor controller firmware version is compatible (or best to use) with this display?
 
Is this a usable version for this display?
https://github.com/emmebrusa/TSDZ2-Smart-EBike-860C
 
Admiralrofl said:
All the documentation I'm reading online says that you need a j-link to flash the bootloaders on these things. I'm not sure what I'm doing wrong but I'm starting to think I might be kinda hosed on this whole deal. I'll look again at this tomorrow but I'm starting to lose hope I'll be able to get this display working.

Sorry to jump in late on this conversation.
Recently joined this topic and struggled 2 evenings with this same "issue"; the ST-Link could NOT unlock the nRF52840.

Simply not possible, BUT!!! I did manage to succeed without buying a j-link (clone).
Solution I found was to 'reconfiger' a BluePill or ST-LinkV2 by means of "CMSIS-DAP" firmware. With a 'simple' UART connection upload firmware to the BluePill.

OpenOCD (from the github.io page download) with the correct sequence opened up the nRF52 to continue the flash process of the bootloader.

Biggest difference is whether the nRF52 is 'protected' or not, once open I presume general programming will be possible with the ST-Link.

I could write out a detailed description of steps I have undertaken, if anyone would be interested.
 
Back
Top