Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to connect to g6 #1

Open
kljensen opened this issue Apr 12, 2020 · 7 comments
Open

Failing to connect to g6 #1

kljensen opened this issue Apr 12, 2020 · 7 comments

Comments

@kljensen
Copy link

I'm using a g6 with firmware 2.18.2.98 and software version SW11818.

I repeatedly get

Forming a connection to xx:xx:xx:xx:xx:xx
 - Created client
onDisconnect
We have failed to connect to the transmitter!
Going to hibernation sleep mode now.

I set transmitterID appropriately and toggled both force_rebonding and useAlternativeChannel in the hope that would help me, but alas, no. I'd greatly appreciate your advice.

(And I want to say thank you emphatically for working on such a noble thesis project! This will make a big difference in our family life.)

@TheEpicBigBoss
Copy link
Owner

TheEpicBigBoss commented Apr 12, 2020

Hello,
first off thank you for these nice words.
I see that you are using one of the newest firmware versions and I heard that Dexcom changed something in the protocol. But nevertheless the esp should at least connect.

You can try these:

  1. Dissable all other cgm receivers and smartphones (xDrip+ or Dexcom App) so that the Esp is the only one trying to connect.
  2. It could also be a timing problem so that the esp detects the woken up transmitter to late and starts connecting when the transmitter is going to shut down again.
    You could try to disable other BLE devices around (smartwatches, ...) and/or set this command to true:
    pBLEScan->setActiveScan(false); // Possible source of error if we cant connect to the transmitter.

When you are using the Arduino Serial Monitor can you enable timestamps and tell me if the "onDisconnect" message happens a view ms or like ~5s after the "- Created client" message.

@kljensen
Copy link
Author

kljensen commented Apr 12, 2020 via email

@kljensen
Copy link
Author

Max - I tried setActiveScan(true) without success. ;(

I set the CORE_DEBUG_LEVEL to "DEBUG" and was able to see this, which doesn't seem too helpful.

20:12:20.664 -> [D][BLEAdvertisedDevice.cpp:418] setRSSI(): - setRSSI(): rssi: -92
20:12:20.664 -> [D][BLEAdvertisedDevice.cpp:247] parseAdvertisement(): Type: 0x09 (), length: 8, data: 446578636f6d4743
20:12:20.664 -> [D][BLEAdvertisedDevice.cpp:407] setName(): - setName(): name: DexcomGC
20:12:20.664 -> [D][BLEAdvertisedDevice.cpp:247] parseAdvertisement(): Type: 0x01 (), length: 1, data: 04
20:12:20.664 -> [D][BLEAdvertisedDevice.cpp:247] parseAdvertisement(): Type: 0x02 (), length: 2, data: bcfe
20:12:20.702 -> [D][BLEAdvertisedDevice.cpp:447] setServiceUUID(): - addServiceUUID(): serviceUUID: 0000febc-0000-1000-8000-00805f9b34fb
20:12:20.702 -> [D][BLEAdvertisedDevice.cpp:247] parseAdvertisement(): Type: 0xff (), length: 4, data: d000fc03
20:12:20.702 -> [D][BLEAdvertisedDevice.cpp:395] setManufacturerData(): - manufacturer data: d000fc03
20:12:20.702 -> [D][BLEAdvertisedDevice.cpp:247] parseAdvertisement(): Type: 0x09 (), length: 8, data: 446578636f6d4743
20:12:20.737 -> [D][BLEAdvertisedDevice.cpp:407] setName(): - setName(): name: DexcomGC
20:12:20.737 -> [D][BLEAdvertisedDevice.cpp:247] parseAdvertisement(): Type: 0x02 (), length: 2, data: bcfe
20:12:20.737 -> [D][BLEAdvertisedDevice.cpp:447] setServiceUUID(): - addServiceUUID(): serviceUUID: 0000febc-0000-1000-8000-00805f9b34fb
20:12:20.737 -> [D][BLEAdvertisedDevice.cpp:247] parseAdvertisement(): Type: 0xff (), length: 4, data: d000fc03
20:12:20.737 -> [D][BLEAdvertisedDevice.cpp:395] setManufacturerData(): - manufacturer data: d000fc03
20:12:20.772 -> BLE Advertised Device found: Name: DexcomGC, Address: xx:xx:xx:xx:xx:xx, manufacturer data: d000fc03, serviceUUID: 0000febc-0000-1000-8000-00805f9b34fb
20:12:20.772 -> Forming a connection to xx:xx:xx:xx:xx:xx
20:12:20.772 ->  - Created client
20:12:20.772 -> [I][BLEDevice.cpp:593] addPeerDevice(): add conn_id: 0, GATT role: client
20:12:20.772 -> [D][FreeRTOS.cpp:189] take(): Semaphore taking: name: RegEvt (0x3ffde5bc), owner: <N/A> for connect
20:12:20.805 -> [D][FreeRTOS.cpp:198] take(): Semaphore taken:  name: RegEvt (0x3ffde5bc), owner: connect
20:12:20.805 -> [D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
20:12:20.805 -> [D][BLEClient.cpp:158] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
20:12:20.805 -> [D][FreeRTOS.cpp:189] take(): Semaphore taking: name: OpenEvt (0x3ffde460), owner: <N/A> for connect
20:12:20.843 -> [D][FreeRTOS.cpp:198] take(): Semaphore taken:  name: OpenEvt (0x3ffde460), owner: connect
20:12:20.952 -> [D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
20:12:20.952 -> [D][BLEClient.cpp:158] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
20:12:20.952 -> We have failed to connect to the transmitter!
20:12:20.952 -> [I][BLEDevice.cpp:604] removePeerDevice(): remove: 0, GATT role client
20:12:20.952 -> [D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
20:12:20.966 -> [D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown

Does anything in there suggest to you another direction I can pursue? (I didn't try unpairing other clients, which is complicated for our daily lives. I could turn them off easily of course.)

@TheEpicBigBoss
Copy link
Owner

TheEpicBigBoss commented Apr 13, 2020

I will compare your output with mine to see what exactly is different but I think the transmitter is closing the connection so I wouldn't find anything unusual.

I think turning off the other clients is enough. The transmitter only allows two connections and if you have already two devices that connect to the transmitter then the esp gets kicked out.

@kljensen
Copy link
Author

Oh really? only two devices? that is unfortunate. do you know where i can find documentation about that?

@ptalip
Copy link

ptalip commented Dec 23, 2021

Hi
First of all, thank you for this work. Normally, the Dexcom G6 transmitter is used for 3-4 months. Is it possible to use it for a long time with this code?

@brownedon
Copy link

It is not, that's handled in the transmitter. The battery is pretty much dead after 90-120 days anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants