TSDZ2 wireless mid drive motor (like Specialized Turbo Levo) -- Flexible OpenSource firmware

Discussions related to motors other than hub motors.
This includes R/C motors, botttom bracket, roller and geared drives.
bobreece20   1 mW

1 mW
Posts: 18
Joined: Jun 19 2020 11:10am

Re: TSDZ2 wireless mid drive motor (like Specialized Turbo Levo) -- Flexible OpenSource firmware

Post by bobreece20 » Aug 01 2020 12:36pm

Spent the entire day just trying to get my watch code running on top of a softdevice on the X9, who would of thought it'd be so difficult :shock:. Anyway I've got the lvgl graphics library hooked in now, got the button controls working so just need to hook in the ANT code and it'll be mostly good to go.

On a side note @casainho if you need to know how to get full debugging working on the NRF chipsets (i.e. chip registers, etc) I now know how to set that up (was trying to debug why softdevice wasn't working, turns out a bootloader is mandatory with a softdevice) and I'm also now fairly well versed with building the bootloader and application settings so I guess it wasn't a complete waste of the day

casainho   10 GW

10 GW
Posts: 4496
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 wireless mid drive motor (like Specialized Turbo Levo) -- Flexible OpenSource firmware

Post by casainho » Aug 01 2020 2:47pm

bobreece20 wrote:
Aug 01 2020 12:36pm
Anyway I've got the lvgl graphics library hooked in now, got the button controls working so just need to hook in the ANT code and it'll be mostly good to go.

I'm also now fairly well versed with building the bootloader and application settings so I guess it wasn't a complete waste of the day
Good advance!! Share pictures please.

If you can, please update / write documentation page about everything you think is useful for developers.

About the boot loader, do you want to develop it? I would say we want to use the button to enter on it as also have it running in parallel to our firmware / app, so we can go to the nrf app and always be able to update without the need to touch again on the button.

The firmware you develop for the watch, I can use for my LCD. I guess only the display size on my LCD is a bit bigger. I don't think I will have energy to fully develop firmware for my display.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa

bobreece20   1 mW

1 mW
Posts: 18
Joined: Jun 19 2020 11:10am

Re: TSDZ2 wireless mid drive motor (like Specialized Turbo Levo) -- Flexible OpenSource firmware

Post by bobreece20 » Aug 01 2020 3:09pm

Yeah I'll get around to writing to documentation soon.

Not much to see atm really. Lvgl provides a lot of nice widgets but a single button was enough to prove the concept and graphics renderering
IMG_20200726_202848_2.jpg
IMG_20200726_202848_2.jpg (374.1 KiB) Viewed 204 times
Helpfully Lvgl also comes with simulator for the PC so I can mock up the UI without having to bother with the hardware.
IMG_20200801_210043.jpg
IMG_20200801_210043.jpg (390.78 KiB) Viewed 204 times
This X9 really does have terrible screen resolution though... Will have to put some thought into how to make the UI scale for the different devices we want to target (may have to design a small (x9 Pro), medium (Pinetime) and large (bike LCD) UI)

casainho   10 GW

10 GW
Posts: 4496
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 wireless mid drive motor (like Specialized Turbo Levo) -- Flexible OpenSource firmware

Post by casainho » Aug 01 2020 4:56pm

bobreece20 wrote:
Aug 01 2020 3:09pm
This X9 really does have terrible screen resolution though... Will have to put some thought into how to make the UI scale for the different devices we want to target (may have to design a small (x9 Pro), medium (Pinetime) and large (bike LCD) UI)
Yes, a PC simulator is very nice to important and also having that library with widjets. When I started the 850C firmware I tried to make Lvgl to work but I could not and so it was for sure hard to develop current widjets, that it was not me after all to develop them, was other developer as I miss the knowledge.

With all that work on different screens, what are your expectations for the final firmware? Mine, as I told, is just the same as 860C firmware + user HR received by ANT+ or Bluetooth. I do not expect to try replace a Gain Edge!!

And why don't you simplify and develop only for Primetime as it seems the only one that will maybe be available to buy on medium/long term?
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa

bobreece20   1 mW

1 mW
Posts: 18
Joined: Jun 19 2020 11:10am

Re: TSDZ2 wireless mid drive motor (like Specialized Turbo Levo) -- Flexible OpenSource firmware

Post by bobreece20 » Aug 01 2020 5:14pm

casainho wrote:
Aug 01 2020 4:56pm
With all that work on different screens, what are your expectations for the final firmware? Mine, as I told, is just the same as 860C firmware + user HR received by ANT+ or Bluetooth. I do not expect to try replace a Gain Edge!!

And why don't you simplify and develop only for Primetime as it seems the only one that will maybe be available to buy on medium/long term?
My expectations (for now) is to be able to use the watch to monitor the bike and control it. Currently I'm not thinking about HR or anything like that. A simple small device to control is all I wish for now. Obviously I've no objections to working towards a Garmin Edge like device but I want to start off small xD

The X9 is useful for me atm whilst I'm still in prototyping/learning stage as if I break it, it's £9 and a two day wait for another. With a suitable HAL there shouldn't be much effort to switch to PineTime anyway (and the longer I leave the PineTime the more likely all the hardware drivers will of been figured out and available).

Anyway, just tested the DFU bootloader. All you have to do have the following two lines:
```
NRF_POWER->GPREGRET = BOOTLOADER_DFU_START;
NVIC_SystemReset();
```
and this define:
```
#define BOOTLOADER_DFU_START 0xB1
```
in and it'll cause the device to reboot into the dfu bootloader. The dfu bootloader can then be connected to from nRF Connect on Android to pass new firmware to the device. I've not tested actually producing a firmware zip yet but I assume it'll work fine (and it looks fairly simple https://devzone.nordicsemi.com/nordic/s ... 7imj1jfgvi). As for getting out of the DFU Bootloader, I believe there is an abort code but I'm unsure how to use that from nRF Connect so you have to wait for the 2 min inactivity timer on the bootloader to trigger before it returns back to the current application.

Post Reply