pvvx / ATC_MiThermometer

Custom firmware for the Xiaomi Thermometers and Telink Flasher
https://github.com/pvvx/pvvx.github.io/tree/master/ATC_MiThermometer
Other
2.94k stars 205 forks source link

There is a problem with CGDK2 #273

Closed 1286840533 closed 1 year ago

1286840533 commented 1 year ago

After flashing the Custom firmware. Temperature and humidity both show 0. E2 is displayed after restoring the original firmware

bogi-bo commented 1 year ago

I have the same Problem Problem, with custom FW 0 and with original E2, or EZ I have one which I haven't flashed, there is the Firmware v1.1.1_0223.bin as stock

1286840533 commented 1 year ago

I have the same Problem Problem, with custom FW 0 and with original E2, or EZ I have one which I haven't flashed, there is the Firmware v1.1.1_0223.bin as stock

I've tried all the firmware to no avail.

pvvx commented 1 year ago

Has the sensor type changed?

bogi-bo commented 1 year ago

Has the sensor type changed?

What do you mean with this?

Is it possible to download firmware with OTA BLE from a working one and put it to a broken one?

pvvx commented 1 year ago

What do you mean with this?

It is described that "After flashing Custom firmware. Temperature and humidity show 0." This is possible if an unknown temperature and humidity sensor is installed.

Is it possible to download firmware with OTA BLE from a working one and put it to a broken one?

Yes.

bogi-bo commented 1 year ago

Is it possible to download firmware with OTA BLE from a working one and put it to a broken one?

Yes. do you have maybe a short instruction or a link? Would be great! If I can help you with providing Data from the exact sensor inside, just let me know! I'd love to support your great work!

pvvx commented 1 year ago

https://github.com/pvvx/ATC_MiThermometer/issues/114#issuecomment-979458611

there is the Firmware v1.1.1_0223.bin as stock

I don't have Firmware v1.1.1_0223

bogi-bo commented 1 year ago

#114 (comment)

there is the Firmware v1.1.1_0223.bin as stock

I don't have Firmware v1.1.1_0223

Hope this can help. I've done the instruction and here is the file. Thank you again for your support!

pvvx commented 1 year ago

Сut and added file Qingping CGDK2 Original Firmware v1.1.1_0223 (The checksum of the original firmware is normal.)

You can delete your file if you have any concerns about the data from it.

bogi-bo commented 1 year ago

Сut and added file Qingping CGDK2 Original Firmware v1.1.1_0223 (The checksum of the original firmware is normal.)

You can delete your file if you have any concerns about the data from it.

It is working, thank you! For me it looks "solved"

@1286840533 can you try?

pvvx commented 1 year ago

It remains to find out which sensor is used in the new version.

bogi-bo commented 1 year ago

It remains to find out which sensor is used in the new version.

If I can help, let me know…

pvvx commented 1 year ago
  1. A good photo of the board or reading the marking from the sensor is required. To do this, you need to disassemble the case. The action is complicated by the possibility of spoiling the plastic latches and the rear view of the case...

  2. Another way to guess is by writing firmware to a breadboard with TLSR8253 and connecting to the I2C bus. At startup, a request with the source address of the sensor is possible ... And if the I2C address is specific, then you can guess the type of sensor. Or maybe not. Divination...

I only have the option to use method 2. I don't have new CGDK2. And the total number of various thermometers used for this project is already huge and it is not known where to put them :)

pvvx commented 1 year ago

Without sensors, bare TLSR8253, firmware v1.1.1_0223 (fullflash), start log with I2C. i2c_log.zip Now guess who is at 0x88 (0x44), and 0xE0(0x70), and 0x00:

SHT4x -> i2c addr 0x44: SHT4x Command: read serial number [2 8-bit data; 8-bit CRC; 2 8-bit data; 8-bit CRC] image image SHT4x Command: measure T & RH with high precision (high repeatability) image

SHTC3 -> i2c addr 0x70 (ACK no -> commands completed earlier) image

SMBALERT# : image

LCD controller at the same address (0x3E) as in older models.

pvvx commented 1 year ago

I don't see any changes. And what doesn't work for you? What does it mean "Problem, with custom FW 0 and with original E2, or EZ"?

bogi-bo commented 1 year ago

I don't see any changes. And what doesn't work for you? What does it mean "Problem, with custom FW 0 and with original E2, or EZ"?

I can try to open it and take a picture for you.

a better description would be: With the custom FW the temperature and humidity is showing 0.0 on both.

when flashing with „original FW 217“ on the display is showing „E2“

according what i‘ve found in a documentation from qingping it says the „sensor“ is broken, so it looks like what you thought, that there is an other sensor.

3DA8DA30-3A06-4820-A827-0BE46052C18A

pvvx commented 1 year ago

My firmware uses automatic recognition of two types of sensors - an analogue of SHTC3 and a variant from the SHT4x series.

As a result, you should make sure what type of sensor is used in the new version. They could also change the circuit - make the sensor power on/off. Then there will also be readings of 0.0.

An empty TLSR8253 chip with Original_OTA_CGDK2_v1.1.1_0217.bin and Original_OTA_CGDK2_v1.1.1_0223.bin firmware shows: image :) I have no other information on the new CGDK2.

opcode02 commented 1 year ago

I have the same CGDK2 issue. I took mine apart and took a close up picture of the sensor. It appears its a SHTV3 maybe?

20221218_110429 (2022-12-18T17_09_22 062)

pvvx commented 1 year ago

SHTV3 = SHTC3

1286840533 commented 1 year ago

删减文件清平CGDK2 Original Firmware v1.1.1_0223 (原固件校验正常) 如果您对其中的数据有任何疑虑,可以删除您的文件。

它正在工作,谢谢! 对我来说它看起来“解决了”

@1286840533你能试一下吗?

Sorry for the late reply, this firmware works fine

yuchangyuan commented 1 year ago

after flash v39, same issue happen(both temp & humi display 0).

flash https://github.com/pvvx/ATC_MiThermometer/blob/master/Original_OTA_CGDK2_v1.1.1_0223.bin back make device work again.

pvvx commented 1 year ago

There is no PCB photo to support the new version of CGDK2. Perhaps the circuit related to the sensor has been changed.

yuchangyuan commented 1 year ago

I use this sensor in bathroom, so I have do hardening, so it may not usefull.

IMG20221224154005 IMG20221224154041

joe-sydney commented 1 year ago

I recently bought a few of these and I am experiencing this issue. Happy to open it up to take a picture of the PCB but it wasn't obvious how to do so. If that would be useful, please let me know how to dismantle it.

pvvx commented 1 year ago

@yuchangyuan The capacitor in the power circuit is excluded. This affects the operation of the device = incomplete use of the battery life! image image

MatMaul commented 1 year ago

@pvvx nice catch, any idea if/why it would affect sensor reading ? I am having the same trouble.

I can compile the firmware so let me know if you want me to try out a fix.

pvvx commented 1 year ago

I don't think it affects the sensor. Last fortune-telling on the version of CGDK2 that I do not have indicate the possibility of tricky behavior of the i2c bus. :) Perhaps it is running a modified LCD controller occupying the i2c bus signals.

But this is all "guessing on the coffee grounds." And reality says that no one needs it, because. anyone can remove all logs from any bus or just take a photo of a printed circuit board.

For this reason, everyone will have to wait until I have new CGDK2. But at the moment this is not expected, because. CGDK2 are not very good - they consume a lot and the display quality is not up to par. And the second reason - I'm tired of buying all the options for thermometers, for several in different stores, so that the necessary versions come across. They already have nowhere to put them, and the number of supported versions has long passed over dozens. Although the list of models is only 4 pcs. If we take LYWSD03MMC, then in 2 years 6 models were released that differ in hardware. Respectively and programmatically. To get research, you need dozens of purchases in different stores. There are still other options for Xiaomi thermometers, which are also necessary for disassembly with the possibility of reprogramming and support. And some orders are still on the way by mail... And help can only be the exchange of specific information, and not the transfer and purchase of some more models, for which it will be necessary to spend even more time. Money in this topic has no value. Therefore, no donations are accepted, except for information posted in the public domain.

MatMaul commented 1 year ago

I did take the photos yesterday actually. I am not sure the quality is enough however, let me know if you need a clearer view of some parts. https://photos.app.goo.gl/ccjWPhPaBh7bHwLh6

The sensor itself is definitively a SH3V.

Absolutely please stop buying more :) I have one and can help pretty easily.

I am not sure what you are asking regarding logs, I can easily change code and report. I however don't have any USB-UART around for now, but we can probably dump some values in the EEP to read them afterwards ? Or just dump some values in the BT advertising frame and read them live ?

I can tinker with the code, but mostly new to this so need some guidance to what/where to look for.

pvvx commented 1 year ago

So far the only thing you can find: Marking = identity: image Differences: image image

The sensor itself is definitively a SH3V.

SHTV3 ?

pvvx commented 1 year ago

CGDK2_test.bin - Firmware for SHTC3 sensor only. No auto-detect.

jerome-73 commented 1 year ago

CGDK2_test.bin - Firmware for SHTC3 sensor only. No auto-detect.

Hi,

I've got the same issue and tested the CGDK2_test.bin. Nothing changed. The display seems to work but displays 0 for temp and humidity.

MatMaul commented 1 year ago

Same here.

I began adding some "tracing" in read_sensor_cb by setting measured_data.temp. First observation, I can see my fake temperature updates in bluetooth, but not on the display, so here is another problem, or a related one.

It seems like we never receive an ACK: I put 2 different fake temp value in https://github.com/pvvx/ATC_MiThermometer/blob/master/src/sensors.c#L105 and https://github.com/pvvx/ATC_MiThermometer/blob/master/src/sensors.c#L108, and it seems the second is never reached.

Not sure where to go next.

pvvx commented 1 year ago

This means that the sensor has a different crystal and protocol than what is indicated on the label. Those. it is necessary to remove the logs from the working sensor from the of.firmware.

joe-sydney commented 1 year ago

Is there any chance that custom firmware will work on this version of the CGDK2? I just bought several of these and if it's never going to work, perhaps the documentation should be updated with a warning of the risk of being sold the new version.

pvvx commented 1 year ago

It is possible that a problem with the sensor is detected if the board has protective diodes on the I2C bus. A similar situation arose with the new MJWSD05MMC, but it was immediately resolved, since the devices are available, unlike the new CGDK2. The test will be in a new beta version with the number 4.0 later, since no one has helped :)

1286840533 commented 1 year ago

It is possible that a problem with the sensor is detected if the board has protective diodes on the I2C bus. A similar situation arose with the new MJWSD05MMC, but it was immediately resolved, since the devices are available, unlike the new CGDK2. The test will be in a new beta version with the number 4.0 later, since no one has helped :)

The latest firmware doesn't show the temperature Status: Hardware Version: CGDK2 2.1.0, Software Version: 4.0 Vbat: 2833 mV , Temp: 0.00°C, Humi: 0.00%, ID: 0, Reed switch counter: 0, flg: 0x01:r1/t0

Sawadee2u commented 1 year ago

I can confirm that beta 4.1 does not correct the temperature and humidity issue. Still displays "0" for both. Hardware Version: CGDK2 2.1.0, Software Version: 4.1 Note: Production Date 2022.12 Unknown Number: 0000214 (possible S/N or production unit count) YP-SKU: 3159963 Bar Code SKU: 6 974046 710305

Sawadee2u commented 1 year ago

image image image For what it's worth. Here are pictures of one of the 4 I just received (2022.12). Firmware 4.0 and 4.1 result on "0" for temp and humidity. Stock version v1.1.1_223 returns it to normal operation.

pvvx commented 1 year ago

image

Requires documentation or log taken from a working SHTV3 AAC29.

Sawadee2u commented 1 year ago

I have the skills to do this but not the knowledge of this device interface. What device do I need to interface with this device? Can you point me to documentation? Also. If you would like me to send you one (unopened) I will be happy to. Whatever I can do to help.

giomf commented 1 year ago

after flash v39, same issue happen(both temp & humi display 0).

flash https://github.com/pvvx/ATC_MiThermometer/blob/master/Original_OTA_CGDK2_v1.1.1_0223.bin back make device work again.

@yuchangyuan How did you manage to flash the device back. After the "E2" error im not able to connect to the device again.

19:08:36: Searching for devices
19:08:38: Connecting to: Qingping Temp RH Lite
19:08:42: Not found Telink OTA service!
19:08:42: Disconnected.
Sawadee2u commented 1 year ago

I got the E2 notice also. I was able to reflash with the 223 bin after pulling the battery and replacing.

giomf commented 1 year ago

Unfortunately, I have had no success so far.

Sawadee2u commented 1 year ago

Sorry to hear that. For what it’s worth, I was able to reprogram with 4.0 then 4.1 then back to233 bin. I only did one unit so may have been dumb luck.. I also held down the reset button for 10 seconds or do. This is the button that changes C to F. I believe the display flashed. Best of luck. Hoping for an update. I do have this working with Home Assistant using 233 bin and bind key.*

On Feb 16, 2023, at 3:02 PM, Guillaume Fournier @.***> wrote: Unfortunately, I have had no success so far.

—Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented. Message ID: @.***>

mafrmt00 commented 1 year ago

The Sensor used is a SHTV3 PXL_20230216_153838257 The Datasheet is: HT_DS_SHTC3_D1.pdf

I took a quick look into I2c with the stock firmware. PXL_20230217_081431730 PXL_20230217_081541865

As you can see, the address is 0x70 and the sleep/wakeup commands are according to the datasheet.

I hope this helps.

yuchangyuan commented 1 year ago

after flash v39, same issue happen(both temp & humi display 0). flash https://github.com/pvvx/ATC_MiThermometer/blob/master/Original_OTA_CGDK2_v1.1.1_0223.bin back make device work again.

@yuchangyuan How did you manage to flash the device back. After the "E2" error im not able to connect to the device again.

I can still connect to the sensor, maybe I replace battery as @Sawadee2u do, I forget the details. Replace with a new battery maybe necessary because flashing will consume a lot of power.

19:08:36: Searching for devices
19:08:38: Connecting to: Qingping Temp RH Lite
19:08:42: Not found Telink OTA service!
19:08:42: Disconnected.
mafrmt00 commented 1 year ago

after flash v39, same issue happen(both temp & humi display 0). flash https://github.com/pvvx/ATC_MiThermometer/blob/master/Original_OTA_CGDK2_v1.1.1_0223.bin back make device work again.

@yuchangyuan How did you manage to flash the device back. After the "E2" error im not able to connect to the device again.

I can still connect to the sensor, maybe I replace battery as @Sawadee2u do, I forget the details. Replace with a new battery maybe necessary because flashing will consume a lot of power.

19:08:36: Searching for devices
19:08:38: Connecting to: Qingping Temp RH Lite
19:08:42: Not found Telink OTA service!
19:08:42: Disconnected.

In my case, with the SW displaying "E2" I only was able flash it via USB.

pvvx commented 1 year ago

As you can see, the address is 0x70 and the sleep/wakeup commands are according to the datasheet.

These commands are identical with the current firmware version:

image

This is the protocol used in custom fw for CGDK2.

@mafrmt00 - What version of CGDK2 do you have?

All versions for all types of thermometers use the same driver. The driver supports 2 types: SHTV3(SHTC3) and SHT4x.

The SHTV3 sensor is used in both old and new versions of CGDK2. But the unknown ones don't work.

All the CGDK2 thermometers I have, purchased at different times, work and use SHTV3. The test firmware of the version without auto-detection of sensors did not work for users on an unknown CGDK2. The SHTC3 type was fixed in it.

In unknown versions of CGDK2, something is wrong with the sensors. But I did not manage to buy such a version of CGDK2.

mafrmt00 commented 1 year ago

@mafrmt00 - What version of CGDK2 do you have?

The Version with the problem. It shows only zeros when flashed with alternative firmware and E2 with the older stock firmware. (also with the missing capacitor as described in this thread)

pvvx commented 1 year ago

Logs of commands to measure and read data from the sensor are required. The rest matches so far.

TelinkMiFlasher.html shows which sensor is being used:. Hardware Version: CGDK2 2.1.0, Software Version: 4.1, Sensor: SHTC3 (SHTV3)