ki2 icon indicating copy to clipboard operation
ki2 copied to clipboard

Losing connection...

Open walkingtheworld24 opened this issue 2 years ago • 9 comments

Hi! Thank you so much for developing this app. I'm running the latest software updates on both the Karoo 2 and Ki2, and I moved the wireless transponder to be as close to the Karoo 2 as possible, however, I'm still losing connection with Ki2 after a 1 minute into my ride. The connection will randomly come back during the ride, but only for a few seconds. I've deleted the Ki2 and reinstalled it, but to no avail. Any other suggestions for how to maintain the connection? I have no other sensors loaded and do not typically connect my phone to the Karoo. Thanks!

walkingtheworld24 avatar Sep 07 '23 14:09 walkingtheworld24

Hi, you need to debug the problem on our side, I can give you some guidance to follow:

1 - Do you have Di2 registered in other devices? For example, do you have Di2 registered in a Garmin watch? If yes: try to have Di2 only added in Karoo an not in other devices at the same time.

2- Even if the Di2 wireless transponder is close to Karoo, try to check for signal quality:

It could be a signal issue, verify the signal between the wireless unit and Karoo. To do that, tap on the shifting device on the list of devices in Ki2. The signal value is displayed on the top when the shifting unit is connected. Signal values between -30 to -60dBm offer best and stable connectivity while a signal in range of -75 to -90dBm is degraded and can cause connectivity issues. There is nothing that can be done in the app/software to improve the signal. Recommendation is to move or rotate the shifting wireless unit, perhaps moving it a small amount could be enough or in some cases it may require relocating the wireless unit to another location in the bicycle closer to Karoo.

Other than that I'm not aware of any problems, so the issue might be with your setup. Can you try Di2 with another device?

valterc avatar Sep 07 '23 14:09 valterc

Thanks for the response. The transponder is between -30 to -60 dBm, mostly in the -40 range and is located as close to the Karoo as it possibly can be. I have E-Tubes app on my iPhone for updating the software, but no other devices connected to the Karoo or to the Di2. I never had connection issues with the old set-up directly to the Karoo software. I'm wondering if an update to the Karoo interfered with the connection. 🤷🏻‍♀️

walkingtheworld24 avatar Sep 08 '23 00:09 walkingtheworld24

So today I went for a 28 mile ride and decided to connect my iPhone to the Karoo 2 for messages. The Ki2 stayed connected the entire ride. I'm not sure what connecting my phone did, but maybe that's my solution!

walkingtheworld24 avatar Sep 10 '23 00:09 walkingtheworld24

I have the broken connection problem also. Very easy to repeat by stopping a ride when connection lost and then restart ride again after some seconds and then after some seconds K2 connects again. The connection stays on and active something like 70-80s, displaying gear changes perfectly. Then the K2 display freezes, it stops showing the gear changes. The freeze state stays around 10-20sec and then K2 shows a message for the gears like waiting for connection. The battery status display stays on but I don't know if it's updated correctly.

I have auto pause enabled in K2, speed 4.0kph. Today I rode 80km and tested the am. sequence, very easy to repeat. Start ride, switch gears, monitor that gear changes are displayed correctly K2. Then after a while the K2 display freezes - it doesn't show gear changes anymore - and then wait some seconds more and K2 gear display boxes shows a message like connection lost or waiting to connect.

My setup on the bike is as follows:

Shimano Ultegra R8170 Di2 complete group using wireless shifters. Derailleurs are wired. Battery is inside the seat post. I don't have any additional Shimano wireless units.

K2 attached into middle and front of handlebars. Distance from K2 (middle of screen) to shifters (top of hood) around 21cm.

Software Versions:

Derailleurs: FD: FD-R8150 V4.1.0 - latest 30.03.2023 RD: FD-R8150 V4.1.0 - latest 30.03.2023

Shifters: ST-R8170-L V4.1.2 - latest 31.10.2022 ST-R8170-R V4.1.2 - latest 31.10.2022

Battery: BT-DN300 V4.1.0 - latest 06.09.2023

The distance between K2 and derailleurs:

Front derailleur ~ 71cm (middle of FD unit to bottom part of K2) Rear derailleur ~ 110cm (middle of RD unit to bottom part of K2)

The wireless signal strength seems to be ok. At least I'm not planning to buy any Shimano extra transponder ? until I know that it fixes the connection problem and install or even glue it into the bottom of K2 unit. I could turn wireless shifters inwards some mm but this causes that during riding I have to move my elbows outward.

One option could be to use wiring for shifters. There is one empty connection in battery and then I could use that connection with junction box to do the wiring.

I have tried following changes with K2 and E-Tube but no success. Playing with different channels so 1st I configured channels so that the system uses same channels Ch1 and Ch2 in K2 and Di2. Then I thought that maybe using same channels cause some sort interference. Then I changed channels so that Di2 uses Ch1 & Ch2 and K2 uses Ch3 & Ch4 but no difference.

I'm software engineer but I have no Android programming experience. Anyway I would try some sort of "low hanging fruit" changes into K2 software like playing with process/thread priorities ? The Ki2 software works but there seems to be some sort of integration issue into Di2 system that causes K2 to lose connection.

One possibility is also that Shimano Di2 software has feature that prevents SRAM/Hammerhead devices to connect.

pulmark avatar Sep 10 '23 12:09 pulmark

One option would be to add simple timer (< 70s) to K2 software that initializes the connection into Di2 devices periodically but the problem is what to display during the initialization period in K2 - old data ?

pulmark avatar Sep 10 '23 12:09 pulmark

Addition to my configuration. I have the Shimano shifters top button configured as follows:

Left button: Single-press - shift K2 page left Double-press - take lap time Continuous-press - zoom map in

Right button - shift K2 page right Double-press - switch to map view Continuous-press - zoom map out

I have been testing the shifter buttons inside without the bike moving, K2 displays that it is in auto-pause state. The shifter buttons seems to work as configured much longer than 1min. The K2 says when taking lap time with left shifter top button during auto-pause that "Only one lap allowed per pause".

I will do test ride tomorrow without auto-pause activated. Maybe it's the root cause that stops K2 Ki2 package working properly.

pulmark avatar Sep 10 '23 15:09 pulmark

No auto-pause on today's ride. After the start K2 displayed gear status, battery status etc. normally for 60+ sec then stopped displaying changes. The error message on the K2 screen related to Di2 data was: "Waiting for data". So I don't know if connection was lost/broken or just that no data received.

Some sort of Di2 channel data recorder and analyzer would be useful to find out what happens and for debugging.

pulmark avatar Sep 11 '23 14:09 pulmark

@walkingtheworld24 your solution worked for me! Thank you. Frankly I was quite worried about this issue (connection drop after 60sec and re-connecting randomly to be dropped again) and couldn't find the root cause. The signal quality was within the -30 to -40 range, the device was placed right below the handlebar, just cm away from my Karoo 2, so it had to be another issue. So, it seems like the bluetooth connection isn't kept alive unless I connect my Android phone to the Karoo 2 using the Karoo companion app. By doing this during my ride today I managed to keep the connection between my Karoo 2 and D-fly alive as well. In my view, the Ki2 project isn't the problem but the Karoo 2.

apamo avatar Jan 01 '24 22:01 apamo

I had connection issues also, but the connecting the mobile worked for me also. Only thing that I don't like the notifications while driving, but perhaps I can reduce them from the mobile.

auvinenak avatar May 31 '24 07:05 auvinenak

I would also like to confirm this is a very real and persistent bug with the App. It is not in any way linked to the signal quality. With the signal reported as -30dbm and the bluetooth unit positioned just 5cm from the Karoo, the issue still persists. What does alter the behaviour is the number of bluetooth devices you have active and the order in which they were paired. 0 or 1 Bluetooth device seems to be ok, but 2 is a fail. 3 strangely seems to work again. Pairing after the ride is active and di2 connected seems to have less of an impact than pairing all bluetooth devices before a ride, but this means reconnecting your sensors while trying to ride.

I understand this is free software, but please don't dismiss the reports above as a signal issue or an issue with the di2 unit.

Suggestions I could think of is to:

  • see if the di2 could be connected via bluetooth instead of Ant+ as the underlying issue might simply be Karoo's implementation of ant+
  • see if the priority of the di2 device can be raised to the top to make sure it is serviced before it times out.

Munka9 avatar Sep 13 '24 13:09 Munka9

Hi, I personally never had such disconnect problems, so for me it's tricky to replicate the issue and work on a potential fix.

I would ask anyone with this issue to help me troubleshoot and understanding the cause.

First let's understand your setup:

  • You mention Bluetooth a lot, Di2 should never be used with Bluetooth, only ANT. You should not connect to Di2 via Bluetooth and you should not connect to Di2 in the Karoo interface itself, only from Ki2.
  • Please make sure your Di2 setup has the firmware up to date, this includes the Wireless Di2 adapter if you have one 🙂
  • What other sensor/devices are connected in Karoo? Do you any other ANT sensor and do have your phone or other bluetooth devices paired? Using the SIM?

Now, after understanding that, there are two things you can do:

  1. Collect ANT traces

    • Enable ANT recording:
      • Open Ki2
      • Go to Settings
      • Scroll down to General Settings
      • Enable "ANT Recording"
      • Exit Ki2
      • Restart Karoo so we get all the ANT logs from the beginning
    • Connect to a Di2 sensor from Ki2
    • Wait until the connection drop problem occurs
    • Extract the logs from Karoo
    • Enable Developer mode in Karoo (should be enabled already)
    • Enable MTP mode / File transfer mode in 'Select USB Configuration' in the developer options in Karoo
    • Connect Karoo to a computer
    • Use file explorer and open Karoo device
    • Inside Karoo internal storage, navigate to Android/data/com.valterc.ki2/
    • Look for a directory named 'ant-recording', it should have some text files inside
    • Copy those text files, they should have ANT logs from Ki2
    • Disable Ki2 ANT recording before re-using Karoo
    • Copy the content of the file to this issue in github
  2. Collect logs from Ki2

    • Make sure you have Android Platform Tools in your computer (it's the same tool that was used to install Ki2)
    • Start your Karoo and use it normally, and do the actions that will cause the disconnects
    • Without shutting down the Karoo, connect it to your computer
    • In a Terminal/Powershell window, in the directory of the extracted Android Platform Tools, run each of the following commands separately:
      • .\adb.exe logcat -d -e ki2
      • .\adb.exe logcat *:W -d
    • Copy the output of those commands to this issue in github

If the output is too large to paste on github, please use a service like pastebin.

valterc avatar Sep 13 '24 21:09 valterc

Hi Thank you for your response, keen to try help debug it.

Unfortunately the first part isn't working, I've attached a screenshot showing this folder is empty unfortunately, and yes logging is on in the general settings of Ki2 (and yes I rebooted :) ). That said hopefully the logcat is working. Another "interesting" point. When indoors, and no GPS signal ki2 seemed to stay connected. I had 2 goes at getting data through Logcat. The first attempt was indoors, at around 1300hrs I moved my PC outside so I could get a gps lock. And yes after a few minutes it did lose connection to the di2 again.

To answer your other questions: Why mention bluetooth - Earlier in the Karoo 2s life it was plagued with connection issues. Most of them manifested when using a mix of bluetooth and Ant+ devices. People could fix this by using either all Ant+ or all Bluetooth. Karoo did some work in the background to provide an update that got the priority right, but for some time that "work around" was the only way to get things going for some. I have a watch which transmits HR and can only do bluetooth, with the ki2 app only using Ant+ there is no option to make all the connections bluetooth. Update firmware - yep done. I've even plugged in via USB and forced a re-upload to try and fix this issue, but it doesn't appear related. The other sensors I have are: a Rotor Inspider power meter which also provides cadence data. A Pixel Watch 2 which broadcasts HR over bluetooth. I do use the SIM in the Karoo. I do not carry a phone. The Rotor Inspider holds connection flawlessly on Bluetooth, but on Ant+ also loses connection after prolonged coasting down a hill, so my preference is to use the Inspider on bluetooth. When the Inspider and the Pixel Watch are on Bluetooth the Di2 disconnects after 2 minutes. If only the Pixel Watch 2 is on bluetooth things seem pretty good. Things are also more likely to be stable if I pair the watch after the ride is started - no idea why.

I will also try

  • carrying my phone
  • removing the sim
  • anything else that might help?

logcat.txt Screenshot 2024-09-14 123650

Munka9 avatar Sep 14 '24 05:09 Munka9

I already forgot the problems with Ki2 and Shimano Di2. Anyway at some point between March - April the shifter buttons started working so that I can now switch between different screens and also take lap times. I haven't tried the Ki2 gear view. I have updated Ki2 whenever there is new update available. I also run the latest Shimano Di2 software for derailleurs and battery. I haven't updated the shifters because it requires wired connection and I don't see any need for shifter update now ... following the 1st rule of programming: if it works don't touch it.

pulmark avatar Sep 14 '24 06:09 pulmark

One more bit of feedback. I went for a ride with the sim out. 2 minutes in Ki2 disconnected. This doesn't appear connect to the sim card in any way.

So I then paired my phone. Di2 stayed paired for the rest of the ride. So as others have said, the issue is definitely linked to the phone connection. The phone connection is bluetooth, hence why somehow, this is all related to bluetooth. I never carry a phone, rely on my pixel watch for calls.

Munka9 avatar Sep 14 '24 08:09 Munka9

Thanks for the logs, I see some familiar traces similar to the ones from the issue #233.

I will release a new Ki2 version today, it should fix that particular problem, but not 100% sure it will fix all connection issues. Give it a try.

In summary what is happening is that sometimes Karoo is automatically disabling the ANT radio, if some conditions are met, for example when no ANT sensor is registered in Karoo or if Karoo is not able to connect to any ANT sensors for a while.

valterc avatar Sep 14 '24 12:09 valterc

Awesome, can confirm version 8.0 is a slam dunk so far for me! Have had a busy day with family, so have only been able to complete a 5 and 20 minute ride, but everything was completely flawless. Thank you!

Edit - 2 more rides, 30 minutes each, yep totally flawless. Really happy. Coffee sent :)

Munka9 avatar Sep 15 '24 05:09 Munka9

Great! Closing this issue, if you encounter other problems let me know.

valterc avatar Sep 20 '24 08:09 valterc