Page 13 of 17

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Oct 17 2019 11:42am
by e3s
There's runtastic

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Oct 19 2019 1:23pm
by Aquakitty
Hey all I'm pretty confused about what version works with what. Should the latest hex for TSDZ2 work with Alpha 0.19.12? I see you all are talking about higher versions, but for the life of me I can't find them. The link in the wiki goes here: https://github.com/OpenSource-EBike-fir ... /releases/

But if you click that repo name it says that project is deprecated. The reason I ask is I am getting a "motor not connected?" error on the SW102 (flashing it went fine) but I don't think it's my soldering.

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Oct 19 2019 1:28pm
by casainho
Aquakitty wrote:
Oct 19 2019 1:23pm
Hey all I'm pretty confused about what version works with what. Should the latest hex for TSDZ2 work with Alpha 0.19.12? I see you all are talking about higher versions, but for the life of me I can't find them. The link in the wiki goes here: https://github.com/OpenSource-EBike-fir ... /releases/

But if you click that repo name it says that project is deprecated. The reason I ask is I am getting a "motor not connected?" error on the SW102 (flashing it went fine) but I don't think it's my soldering.
You need the latest stable version of TSDZ2 firmware, v0.19.x.

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Oct 19 2019 1:28pm
by Aquakitty
casainho wrote:
Oct 19 2019 1:28pm
Aquakitty wrote:
Oct 19 2019 1:23pm
Hey all I'm pretty confused about what version works with what. Should the latest hex for TSDZ2 work with Alpha 0.19.12? I see you all are talking about higher versions, but for the life of me I can't find them. The link in the wiki goes here: https://github.com/OpenSource-EBike-fir ... /releases/

But if you click that repo name it says that project is deprecated. The reason I ask is I am getting a "motor not connected?" error on the SW102 (flashing it went fine) but I don't think it's my soldering.
You need the latest stable version of TSDZ2 firmware, v0.19.x.
Thank you.

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Oct 21 2019 6:18pm
by geeksville
The the latest sw102 firmware is here. You want 0.19.17: https://github.com/OpenSource-EBike-fir ... D/releases

It has many improvements vs that old tree.

And you may be using a 0.19 version of the motor firmware. If you are using 0.20 motor firmware all of the current sw102 releases will show that message.

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Oct 22 2019 2:40pm
by NoClassic
I currently have an SW102 display within an existing system and was hoping there was a way to get it functioning with a new KT controller upgrade that I recently purchased. Is this something that is possible given the open firmware available?

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Oct 22 2019 2:43pm
by casainho
NoClassic wrote:
Oct 22 2019 2:40pm
I currently have an SW102 display within an existing system and was hoping there was a way to get it functioning with a new KT controller upgrade that I recently purchased. Is this something that is possible given the open firmware available?
Would be possible if the developers of the OpenSource firmware for KT, would want to support the SW102 running our OpenSource firmware -- please ask on the KT firmware thread.

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Oct 27 2019 6:51am
by Doohickey
Hi all,

Just to confirm, the wiki page for wiring it says that red wire is GND on the sw102. Is this correct?

Just seems a bit odd that they'd do that, so just checking because I don't want to fry it...

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Oct 27 2019 7:16am
by geeksville
Yes that is correct. The red wire scared me also but it is correct.

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 01 2019 9:42am
by Steph
Hello,

As mentioned in the early posts of this thread, there is a way to backup the original firmware before tinkering with the device.
The method (also described here: https://blog.includesecurity.com/2015/1 ... nique.html in a way that I found clearer) involves locating a load instruction and looping on it.

To save time for those interested in backing up their unit, there is a such a load instruction at address 0x6B2.
Then, the dump script should be:
base = 0
loop on 256k
- set R3 = base
- set PC = 0x6B3
- step the core
- get value of R3 and save it (this is the word value @ base)
- base += 4
(I'm not using open ODC, so I cannot reproduce the actual commands, just the pseudo-script)

Sorry if this has been covered in a previous post, I somehow missed the updates here. It will take me time to read them through and I only planned for a quick visit today.

I'm also working on this display for my project (I plan to code a controller as well as the display) so I will make sure not to miss updates anymore.

Cheers,

Stephane

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 01 2019 12:10pm
by gatorsean
Is there currently a problem with the SW102 firmware version 19.17 and using the throttle?

I assumed a problem with the throttle would be in the drive controller firmware, but others have it working it seems.

In the technical menu, I see the ADC values change with the throttle, but the motor does not spin. It does spin with walk assist, so the motor and controller are working. My bike is still on the build rack so I can't quite ride it yet...

Someone else mentioned it could be overvotlage cutoff. I charge to 58.8V, but the display shows 59.6V Is there a way to adjust the cutoff or the adc calibration in the display or should I look to fix it in the code?

Thanks!

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 01 2019 9:48pm
by geeksville
Btw I made this article into a tool I used when I was doing the solderless update work: https://github.com/geeksville/nrf51-extractor
Steph wrote:
Nov 01 2019 9:42am
Hello,

As mentioned in the early posts of this thread, there is a way to backup the original firmware before tinkering with the device.
The method (also described here: https://blog.includesecurity.com/2015/1 ... nique.html in a way that I found clearer) involves locating a load instruction and looping on it.

To save time for those interested in backing up their unit, there is a such a load instruction at address 0x6B2.
Then, the dump script should be:
base = 0
loop on 256k
- set R3 = base
- set PC = 0x6B3
- step the core
- get value of R3 and save it (this is the word value @ base)
- base += 4
(I'm not using open ODC, so I cannot reproduce the actual commands, just the pseudo-script)

Sorry if this has been covered in a previous post, I somehow missed the updates here. It will take me time to read them through and I only planned for a quick visit today.

I'm also working on this display for my project (I plan to code a controller as well as the display) so I will make sure not to miss updates anymore.

Cheers,

Stephane

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 02 2019 12:13am
by casainho
gatorsean wrote:
Nov 01 2019 12:10pm
Is there currently a problem with the SW102 firmware version 19.17 and using the throttle?

I assumed a problem with the throttle would be in the drive controller firmware, but others have it working it seems.

In the technical menu, I see the ADC values change with the throttle, but the motor does not spin. It does spin with walk assist, so the motor and controller are working. My bike is still on the build rack so I can't quite ride it yet...

Someone else mentioned it could be overvotlage cutoff. I charge to 58.8V, but the display shows 59.6V Is there a way to adjust the cutoff or the adc calibration in the display or should I look to fix it in the code?

Thanks!
Look at git log recent commits, I did enable throttle on 850C, see if the same need to be done on SW102.

It would be very strange your motor controller to measure such wrong value of 59.6V when it is 58.8V. I also charge my 3 ebikes with 58.8V and all the 3 motor controllers measure well.
And I don't remember if the motor controller is limiting due to high voltage, if so, we need to make an error code for that situation and show to user on display.

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 02 2019 2:59am
by gatorsean
casainho wrote:
Nov 02 2019 12:13am
gatorsean wrote:
Nov 01 2019 12:10pm
Is there currently a problem with the SW102 firmware version 19.17 and using the throttle?

I assumed a problem with the throttle would be in the drive controller firmware, but others have it working it seems.

In the technical menu, I see the ADC values change with the throttle, but the motor does not spin. It does spin with walk assist, so the motor and controller are working. My bike is still on the build rack so I can't quite ride it yet...

Someone else mentioned it could be overvotlage cutoff. I charge to 58.8V, but the display shows 59.6V Is there a way to adjust the cutoff or the adc calibration in the display or should I look to fix it in the code?

Thanks!
Look at git log recent commits, I did enable throttle on 850C, see if the same need to be done on SW102.

It would be very strange your motor controller to measure such wrong value of 59.6V when it is 58.8V. I also charge my 3 ebikes with 58.8V and all the 3 motor controllers measure well.
And I don't remember if the motor controller is limiting due to high voltage, if so, we need to make an error code for that situation and show to user on display.
It looks like this should be the line of code to change to enable throttle? &1 is for temp, &3 is for throttle?
case 8:
// motor temperature limit function or throttle
ui8_g_usart1_tx_buffer[5] =
l2_vars.ui8_temperature_limit_feature_enabled & 3;

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 02 2019 3:09am
by casainho
gatorsean wrote:
Nov 02 2019 2:59am
casainho wrote:
Nov 02 2019 12:13am
gatorsean wrote:
Nov 01 2019 12:10pm
Is there currently a problem with the SW102 firmware version 19.17 and using the throttle?

I assumed a problem with the throttle would be in the drive controller firmware, but others have it working it seems.

In the technical menu, I see the ADC values change with the throttle, but the motor does not spin. It does spin with walk assist, so the motor and controller are working. My bike is still on the build rack so I can't quite ride it yet...

Someone else mentioned it could be overvotlage cutoff. I charge to 58.8V, but the display shows 59.6V Is there a way to adjust the cutoff or the adc calibration in the display or should I look to fix it in the code?

Thanks!
Look at git log recent commits, I did enable throttle on 850C, see if the same need to be done on SW102.

It would be very strange your motor controller to measure such wrong value of 59.6V when it is 58.8V. I also charge my 3 ebikes with 58.8V and all the 3 motor controllers measure well.
And I don't remember if the motor controller is limiting due to high voltage, if so, we need to make an error code for that situation and show to user on display.
It looks like this should be the line of code to change to enable throttle? &1 is for temp, &3 is for throttle?
case 8:
// motor temperature limit function or throttle
ui8_g_usart1_tx_buffer[5] =
l2_vars.ui8_temperature_limit_feature_enabled & 3;
3 options there: temperature, throttle and all disabled. Yes, must be the &3 and not &1 as was previously.

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 05 2019 9:43am
by Nfer
I bought the SW102 but I am not sure if there is a way to flash with the Bluetooth for the first time without open it. Is it safe? I read some post a while ago

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 05 2019 9:52am
by casainho
Nfer wrote:
Nov 05 2019 9:43am
I bought the SW102 but I am not sure if there is a way to flash with the Bluetooth for the first time without open it. Is it safe? I read some post a while ago
Follow the wiki.

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 05 2019 10:04am
by Nfer
casainho wrote:
Nov 05 2019 9:52am
Nfer wrote:
Nov 05 2019 9:43am
I bought the SW102 but I am not sure if there is a way to flash with the Bluetooth for the first time without open it. Is it safe? I read some post a while ago
Follow the wiki.
I see. The wiki only describes the open method. I wish I can help you guys to develop and test the bluetooth metod but I have no clue of anything related to this stuff.
https://github.com/OpenSource-EBike-fir ... -using-SWD

Edit: I found the no-need-to-open discussion. It is still under development
https://github.com/OpenSource-EBike-fir ... /issues/35

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 09 2019 8:43am
by Nfer
Nfer wrote:
Nov 05 2019 10:04am
casainho wrote:
Nov 05 2019 9:52am
Nfer wrote:
Nov 05 2019 9:43am
I bought the SW102 but I am not sure if there is a way to flash with the Bluetooth for the first time without open it. Is it safe? I read some post a while ago
Follow the wiki.
I see. The wiki only describes the open method. I wish I can help you guys to develop and test the bluetooth metod but I have no clue of anything related to this stuff.
https://github.com/OpenSource-EBike-fir ... -using-SWD

Edit: I found the no-need-to-open discussion. It is still under development
https://github.com/OpenSource-EBike-fir ... /issues/35
I tried to open the sw102 cutting the glue at sides of the keypad and I killed the down button contact. It was my fault, instructions are good.
Is it possible to use the display without the down button?

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 09 2019 11:13am
by windburner
Nfer wrote:
Nov 09 2019 8:43am
I tried to open the sw102 cutting the glue at sides of the keypad and I killed the down button contact. It was my fault, instructions are good. Is it possible to use the display without the down button?
The Down button is critical for the configuration process, as well as adjusting the Assist Level, so, I'd say no. Can you solder in a wire or something to bridge the break? (I know it is tight working, as I hope to never have to mess about inside my SW102 again.)

New SW102 release 0.5.0-beta4

Posted: Nov 09 2019 9:54pm
by geeksville
Hi ya'll,

The 0.19.17 was pretty solid, but I released it for the gang before I was on a long hiking trip. This new release pulls in the great work by @casainho and @lowPerformer. Note: I've switched to the naming system they constructed for versions, so this new version is 0.5.0-beta-4. It is what we recommend if you have a SW102. Currently we do releases on a per device basis, but it is fairly likely that soon releases will include both SW102 and 850C binaries for each release build.

Major changes in this release:

* SOC calculations now work! (kudos @lowPerformer)
* Automatic power off interval is now correct (kudos @lowPerformer)

A full list of changes is [here](https://github.com/OpenSource-EBike-fir ... 5.0-beta-4)

The initial install (mainly getting access to the programming pins) is a bit of a hassle but we've written [instructions](https://github.com/OpenSource-EBike-fir ... re-install) to make it easier. Every installation after that is very painless via our bluetooth bootloader software-update.

If you are upgrading from a previous release, you can upgrade over bluetooth. The procedure is:

* Install "nRF Connect" from your appstore of choice (Google Play or whatever)
* Download our [sw102-otauptdate-xxx.zip](https://github.com/OpenSource-EBike-fir ... D/releases) file onto your phone (do not unzip)
* Press and hold the M key on the SW102, then press and hold the power button. Keep both buttons pressed down for at least eight seconds. You can then release the buttons. You will know you are in the bootloader if the screen stays dark.
* Run the "nRF Connect" app. You should see "SW102 DFU" list, click on Connect
* On this new pane you will see a small DFU icon in the upper right of the screen. Click on it.
* Select our "application bundle" and our zip file.
* The update should start and show progress as it progresses
* After the upload completes turn your bike completely off
* Then start your new SW102 load as normal (a long press on the power button)

Future releases will include release notes, but for now here's a link to our [TODO list](https://github.com/OpenSource-EBike-fir ... re/TODO.md). If you encounter bugs please open as issue [here](https://github.com/OpenSource-EBike-fir ... LCD/issues). Make sure you mention you were using a SW102 and include as much information as possible.

We look forward to your reports of great success (or failure, ahem) in this [thread](viewtopic.php?f=30&t=99698).

Re: New SW102 release 0.5.0-beta4

Posted: Nov 10 2019 12:05am
by windburner
geeksville wrote:
Nov 09 2019 9:54pm
This new release ...
Thanks all for the work this represents.

Can you confirm that the ability remains to revert to 0.19.17 via bluetooth should we encounter a disabling condition with 0.5.0-beta-4?

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 10 2019 1:18am
by geeksville
alas - the bootloaders that we have out in the field now can't go backwards (there are various pros cons to letting that happen). So I can't change that choice we made without pushing out new bootloaders (which I'm loathe to do without a really good reason). Historically our releases have been pretty good (though the .13ish era was a bit rough because I was testing sans bike). I've been using this build on my bike for a couple of days and it seems pretty good (and the SOC stuff is great).

If there is a big problem with this release I'll quickly push out a new build (even if it means just bumping the version number from an old source tree).

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 10 2019 1:20am
by geeksville
windburner wrote:
Nov 09 2019 11:13am
Nfer wrote:
Nov 09 2019 8:43am
I tried to open the sw102 cutting the glue at sides of the keypad and I killed the down button contact. It was my fault, instructions are good. Is it possible to use the display without the down button?
The Down button is critical for the configuration process, as well as adjusting the Assist Level, so, I'd say no. Can you solder in a wire or something to bridge the break? (I know it is tight working, as I hope to never have to mess about inside my SW102 again.)
If you do need to fix your button, you can try removing the PCB (it comes out with a little connector on the back - just flip the black tab up to release the cable). This should give you better access to plug in a jumper. But if that won't work, yeah you'll need to plunk down another $35.

Re: Bafang SW102 Bluetooth LCD - OpenSource firmware and mobile app

Posted: Nov 10 2019 12:49pm
by bikelpl
Hello, i've sucesfully flashed my SW102.
I did it in quite clean way so i want to share some photos with You.
I just cut small hole at side panel..
After this operation, all should be still waterproof.
Image

Key to sucesfull solder thin wires is to make thin soldering iron tip.
I did it from one single wire from 10mm2 cable.
After all i glued it with hot gun glue.
Excessive gluea i removed by cutting it.
You can use heat gun at the end or lighter to "polish" cutted hot gun glue.

You can download bigger photos from here: http://bikel.pl/pliki/TSDZ2/SW102/sw102-proces.zip

What do you think?