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

MHO-C122: No info on LCD #109

Closed
FaBjE opened this issue Jul 26, 2024 · 5 comments
Closed

MHO-C122: No info on LCD #109

FaBjE opened this issue Jul 26, 2024 · 5 comments

Comments

@FaBjE
Copy link
Contributor

FaBjE commented Jul 26, 2024

I've updated one of my MHO-C122 to the ZigBee firmware as a test.
After the upgrade there is nothing on the LCD.

I think the MCU is running OK, as I can pair it with ZHA and I get regular updates.

I did a quick diff between the ZigBee LCD driver:
https://raw.githubusercontent.com/pvvx/ZigbeeTLc/master/src/lcd_mho_c122.c
and the BT LCD driver: https://raw.githubusercontent.com/pvvx/ATC_MiThermometer/master/src/lcd_mho_c122.c

I noticed some differences.

  • Datatype name differences (should not matter)
  • The "send_to_lcd" function is now a "critical section" (isr are disabled)
  • LCD init delay is disabled Is this on purpose or?

The big question is: Should this be working (theoretically) or is the LCD not implemented yet in this beta firmware?

Upgrade log:

12:21:23 PM: Searching for devices
12:22:33 PM: Connecting to: MHO-C122
12:22:44 PM: Hardware Revision String: V1.1-202106
12:22:44 PM: Software Revision String: V4.6
12:22:44 PM: Firmware Revision String: github.com/pvvx
12:22:44 PM: Detected custom Firmware
12:22:44 PM: Hardware Version: MHO-C122 V1.1-202106, Software Version: 4.6, Sensor: SHTC3 (SHTV3)
12:22:44 PM: Custom config HEX string: 55051000002804a931318bb4
12:23:10 PM: Load firmware file 'https://raw.githubusercontent.com/pvvx/ZigbeeTLc/master/bin/ZMHOC122_v0122.bin'...
12:23:11 PM: File: https://raw.githubusercontent.com/pvvx/ZigbeeTLc/master/bin/ZMHOC122_v0122.bin
12:23:11 PM: File size: 128756 bytes
12:23:11 PM: Count: 8048
12:23:14 PM: Start DFU
12:24:25 PM: Update done after 70.282 seconds
12:24:29 PM: Disconnected.

(Maybe to refresh your memory, I added the LCD driver for the MHO-C122
The BLE firmware is still working very well!))

@pvvx
Copy link
Owner

pvvx commented Jul 26, 2024

I don't have MHO-C122 and have no way to check its functionality.

You are the only owner of MHO-C122. :)

On cold start, pin PB6 = PULL_UP

https://github.com/pvvx/ZigbeeTLc/blob/master/src/board_mho_c122.h#L39

As a result, the command gpio_setup_up_down_resistor(GPIO_PB6, PM_PIN_PULLUP_10K); does nothing

The display controller is similar to LYWSD03MMC (B1.4, B1.7, B2.0). The only difference is the LCD panel segments.

Another difference is that LYWSD03MMC I2C bus frequency set higher. To optimize consumption.
On C122 I don't know what elements are soldered on the printed circuit board on I2C bus. For example CGDK2 has soldered protective diodes with high capacity (useless parts that interfere with work), which does not allow to work with I2C bus above hundred kHz...


Zigbee firmware has a function to turn off the display. It is advisable to check whether the display is on or not.

@FaBjE
Copy link
Contributor Author

FaBjE commented Jul 27, 2024

Thanks for your response.
I tried setting the "screen off" attribute to 0.

# Display On
service: zha.set_zigbee_cluster_attribute
data:
  ieee: 'a4:c1:38:94:93:??:??:??'
  endpoint_id: 1
  cluster_id: 0x0204
  cluster_type: in
  attribute: 0x0106
  value: 0

It was confirmed as successful

DEBUG (MainThread) [zigpy.zcl] [0xC86E:1:0x0204] Decoded ZCL frame: UserInterface:Write_Attributes_rsp(status_records=[WriteAttributesStatusRecord(status=<Status.SUCCESS: 0>)])
DEBUG (MainThread) [homeassistant.components.zha.core.device] [0xC86E](MHO-C122-z): set: 0 for attr: 262 to cluster: 516 for ept: 1 - res: Write_Attributes_rsp(status_records=[WriteAttributesStatusRecord(status=<Status.SUCCESS: 0>)])

But no change unfortunately.

On C122 I don't know what elements are soldered on the printed circuit board on I2C bus

On the PCB I can not identify any diode or resistor. Only capacitors and a few inductors: https://pvvx.github.io/MHO_C122/
Any limits will be in the IC's itself.

But apart from that, the I2C speed is still configured at 100 Khz as far as I can see. So that should not be a problem.

Unfortunately I am quite limited in my debug options here. (I don´t have a debugger) or any connection points to connect a logic analyzer to the I2C bus.
How would you debug an issue like this? Is there any debug UART/console available?

The display controller is similar to LYWSD03MMC (B1.4, B1.7, B2.0). The only difference is the LCD panel segments.

When porting the MHO-C122 I just flashed the LYWSD03MMC and by trial and error I was able to map the LCD.
As I see nothing now, I think there is more of a low-level/generic issue.

If I may make a suggestion/request: If you have some spare time, could you maybe load the MHO-C122 build into your LYWSD03MMC and see if any LCD segments come up?
In my opinion this should be the case.

@pvvx
Copy link
Owner

pvvx commented Jul 28, 2024

Error found. When copying from BLE, the variable name "lcd_i2c_addr" was not changed to "i2c_address_lcd".
ZigBee files for MHO-C122 have been replaced.

In https://github.com/pvvx/BZdevice the files are similarly corrected.

@FaBjE
Copy link
Contributor Author

FaBjE commented Jul 28, 2024

Great work @pvvx !

After flashing the latest binary it didn't work for me.
I did some analyzing, changed some code, sw bricked device, erased all flash, switched back to BT firmware (LCD is still working) and back to zigbee.
Now it is working!

image

I think the erase all flash in combination with the new SW did the trick. (Maybe the display was disabled after my tinkering to change the settings)
I will monitor it's behavior in the coming days.

@FaBjE
Copy link
Contributor Author

FaBjE commented Aug 5, 2024

After a week it is still working fine 👍🏻

I have one feature/functionality suggestion.
At the moment the "bluetooth bond (|) = Segment: 3.6" is always displayed.
The bit is set on the reboot-screen, but never cleared.

Maybe it is an idea to use: "(|) = Segment: 3.6" for the zigbee network state.
and "BLE = Segment 4.7" for the bluetooth state.

For (also for BZdevice) you would be able to see which one is connected.

LCD's that don't have the symbol can just use the BLE icon for both.

@FaBjE FaBjE closed this as completed Dec 15, 2024
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

2 participants