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

porting firmware for TS0201 _TZ3000_v1w2k9dd #128

Open
dynasticorpheus opened this issue Oct 23, 2024 · 47 comments
Open

porting firmware for TS0201 _TZ3000_v1w2k9dd #128

dynasticorpheus opened this issue Oct 23, 2024 · 47 comments

Comments

@dynasticorpheus
Copy link

Would be great if someone could share some hints how to prep an OTA for my TS0201 _TZ3000_v1w2k9dd which is already Zigbee out of the box. Bit unsure how to create something that is recognized by ZHA when using below config.

Note they work out of the box in home assistant but only seem to update when registering big changes in temperature / humidity hence my wish to use this custom firmware.

Bought here

image_type_id 0x008 ---> 65535
manufacturer_id 0x007 ---> 4098
zha:
  zigpy_config:
    ota:
      extra_providers:
        - type: advanced
          warning: I understand I can *destroy* my devices by enabling OTA updates from
            files. Some OTA updates can be mistakenly applied to the wrong
            device, breaking it. I am consciously using this at my own risk.
          path: /config/zigpy_ota

zha_toolkit:

@juha63
Copy link

juha63 commented Nov 15, 2024

You first have to check if your board looks like https://pvvx.github.io/TS0201_TZ3000/. You need to check if LED and BUTTON are connected to the right ports of the ZTU also. If not, you can't use any prebuilt firmware and have to compile it yourself.

Look at #124

@dynasticorpheus
Copy link
Author

@pvvx Tuya is obviously very messy so wondering if you can tell me if this variant is somehow already supported either by downloading an OTA binary or compile one myself? Thanks!

photo_5769483939164047832_y

@dbmaxpayne
Copy link

dbmaxpayne commented Jan 16, 2025

I have the same boards as @dynasticorpheus and wanted to flash them with a new firmware to get configurable report intervals.
However, the PCB is wired completely different to others and I don't quite understand how to compile a new firmware for it.

The PCB traces as follows:
C2 -> LED (to GND)
C3 -> SDA
D2 -> SCL
B4 -> Button (to GND)
B5 -> 3V0/Bat+ (via 7.2k resistor)

I quickly had a look at https://github.com/pvvx/ZigbeeTLc where I saw that apprently the boards are defined in src/board_*.h.
Then I wanted to see if I can just make my own board definition and change the GPIOs to match this board, however, there is the following line
#define I2C_GROUP I2C_GPIO_GROUP_C2C3
which somehow defines an I2C_GROUP. As far as I can see, there is no I2C_GPIO_GROUP_D2C3.
How can this board be supported?
Or am I using the wrong ZTU schematic?

This is what I used.
image

Cheers,
Mark

@dbmaxpayne
Copy link

dbmaxpayne commented Jan 16, 2025

This is the sensor.
Also no idea what type it is.
PXL_20250116_105547980 MP
maybe some SHT4x clone?

EDIT:
Pins of sensor trace as follows (see previous post for MCU traces):
Top Left -> VDD
Bottom Left -> SDA
Top Right -> GND
Bottorm Right -> SCL

EDIT2:
Seems to be Sensylink CHT8320ADNR.
However according to the datasheet SDA & SCL would be swapped.
Maybe the markings on the PCB are simply wrong.

@dbmaxpayne
Copy link

I'm currently trying to port the firmware for software I2C and the CHT832x sensors.
As I'm not a programmer and currently lacking a reliable SWire programmer (already ordered) it will take a while until I can tests things and report back, though.

@dbmaxpayne
Copy link

Alright. I couldn't wait for the programmer to get here so I fiddled around with the USB->UART SWire emulation and got a working firmware flashed.
All subsequent updates were done via OTA.
After a few tries it even works good and incorporates software I2C to talk to the CHT832x.
Temperature and humidty can already be read successfully.

I will download the old firmware when I get the hardware programmer.
It always stopped at 0x100 when using the emulator.

@pvvx How would you like me to contribute this?
Unfortunately I've got no experience with Github collaboration, but am happy to share my findings.

Also I'd be interested in a way to forcefully flash the original Tuya devices with the new firmware without having to solder an SWire programmer to the board.
I tried changing the following, but that resulted in an "Invalid image" error in Zigbee2Mqtt OTA.

#define MANUFACTURER_CODE_TELINK           	0x1002
#define	IMAGE_TYPE							0x203

@pvvx
Copy link
Owner

pvvx commented Jan 22, 2025

Full match with ZY-ZTH02Pro. But no LCD.
BLE firmware is already assembled and working, without LCD.

The sensor is probably a clone of SHT30.
Or https://github.com/pvvx/pvvx.github.io/blob/master/TH03Z/CZ_SHT30_GX_0001.pdf
https://xonstorage.blob.core.windows.net/pdf/gxcas_gxhtc3c_apr22_xonlink.pdf

https://www.gxcas.com/public/en/public/html/index.html#/proOne?pid=21&id=23

Already working in an unheated garage in "LE Long Range" mode:
Image

At that distance from home and with multiple walls, Zigbee doesn't work:
Image

https://github.com/pvvx/ATC_MiThermometer/raw/refs/heads/master/ZY02_v50.bin - Will work for your device temporarily.
Then the display will be added.

@pvvx
Copy link
Owner

pvvx commented Jan 22, 2025

I recommend unsoldering or breaking out R13 and R11. This is unnecessary battery consumption and does not provide anything else.

ZTU Mark   
D3   ---
D7   ---
C0 PC0 R3-VCC
SWS    
B6    
A0 RXD2  
A1 TXD2  
C2 LED  
C3 SCL R4 - VCC
D2 SDA R5 - VCC
B4 KEY  
B5 P34 R1 - VCC
GND    
VCC    
B1 TXD1  
B7 RXD1  
C4 +BAT R13 R11
RST RST  
C1    
D4    
NC    

@dbmaxpayne
Copy link

Good stuff, mate.
Thanks for your efforts :) Greatly appreciated.

The sensor is definitely a CHT832x.

If you are interested in my changes, I have just created a fork and uploaded my changes.
https://github.com/dbmaxpayne/ZigbeeTLc

Basically I created or changed the following files:

board_ts0201_tz3000_v1w2k9dd.h
i2c_drv.h
i2c_drv.c
sensor_cht832x.h
sensor_cht832x.c
version_cfg.h

Makes sense by the way that these boards are similar or share the firmware.
I saw, that the MCU also scans other I2C addresses like 7C or so.

Do you know why R13 and R11 are there in the first place?

Cheers,
Mark

@pvvx
Copy link
Owner

pvvx commented Jan 22, 2025

Do you know why R13 and R11 are there in the first place?

ADC divider for measuring battery voltage.
The device was made by children for Tuya, and they do not know how to work with TLSR8258 microcircuits.
The original firmware from Tuya for Zigbee has a huge power consumption...

@pvvx
Copy link
Owner

pvvx commented Jan 22, 2025

Analogue of STH30
Image

Image

02:15:46: Searching for devices
02:15:58: Connecting to: ZY2_E515C0
02:16:07: Hardware Revision String: V1.1
02:16:07: Software Revision String: V5.0
02:16:07: Firmware Revision String: github.com/pvvx
02:16:07: Detected custom Firmware
02:16:07: Hardware Version: Unknown or DIY (37) V1.1, Software Version: 5.0
02:16:07: Custom config HEX string: 55873000005004a9310025b4
02:16:10: Get Sensor Settings...
02:16:10: Sensor SHT30 id: 00308010, I2C address: 0x88, Kt: 17500, Kh: 10000, Zt: -4500, Zh: 0

id: 00308010 -> Status Register at startup: 0x8010.

@dynasticorpheus
Copy link
Author

Good stuff, mate. Thanks for your efforts :) Greatly appreciated.

The sensor is definitely a CHT832x.

If you are interested in my changes, I have just created a fork and uploaded my changes. https://github.com/dbmaxpayne/ZigbeeTLc

Basically I created or changed the following files:

board_ts0201_tz3000_v1w2k9dd.h
i2c_drv.h
i2c_drv.c
sensor_cht832x.h
sensor_cht832x.c
version_cfg.h

Makes sense by the way that these boards are similar or share the firmware. I saw, that the MCU also scans other I2C addresses like 7C or so.

Do you know why R13 and R11 are there in the first place?

Cheers, Mark

@dbmaxpayne Is this still WIP or can I have a go at it? (make install; make ends up in error at my end hence asking)

@dbmaxpayne
Copy link

dbmaxpayne commented Jan 23, 2025

@dynasticorpheus
I have not uploaded all necessary files like the SDK itself.
That and TC32 would have to be extracted from pvvx's ZIP files.

Let me know in a private message what error you're getting and I might be able to help.
Also I didn't use the make commands, but Telink IoT Studio's build targets (Windows).
Maybe that's the same under the hood, maybe not.
I didn't go too deep into the whole thing and was happy when I was able to compile it :)

I will upload the bin files to my fork in a second if that helps.

Edit:
OTA: https://github.com/dbmaxpayne/ZigbeeTLc/blob/master/bin/1141-0225-01243001-ts0201_tz3000_v1w2k9dd.zigbee
SWire: https://github.com/dbmaxpayne/ZigbeeTLc/blob/master/bin/ts0201_tz3000_v1w2k9dd.bin

@vjaunet
Copy link

vjaunet commented Jan 23, 2025

Hi there, many thanks for all your efforts.
I am a bit confused on how to flash this new firmware to the device. Can I use the z2m OTA procedure or what should I do ?
Many thanks for your help.
Vincent

@dbmaxpayne
Copy link

I'd be interested too if there is a way to flash this over a stock firmware via OTA.
I don't know, though.

I used this: https://github.com/pvvx/TlsrComSwireWriter
However, it requires soldering of at least the SWS pin.
GND and VCC can be temporarily connected via a clamp to the battery terminals.
I used a Raspberry Pi 3 for flashing, but it should also work with other USB->UART-Converters.

Erase flash: python3 ./TlsrComSwireWriter/TLSR825xComFlasher.py -p /dev/ttyS0 -t 5000 ea
Write firmware: python3 ./TlsrComSwireWriter/TLSR825xComFlasher.py -p /dev/ttyS0 -t 5000 we ./firmwareFile.bin
Reset CPU: python3 ./TlsrComSwireWriter/TLSR825xComFlasher.py -p /dev/ttyS0 -t 5000 -r

@pvvx
Copy link
Owner

pvvx commented Jan 23, 2025

@dbmaxpayne - what "Zigbee Image Type" does the original TS0201 _TZ3000_v1w2k9dd have?
This is needed for Zigbee OTA.

1002-0203-59013001 ?

Manufacturer Code Image Type File Version Stack Version
1002 0203 5901 3001

?

@dbmaxpayne
Copy link

@pvvx
Is there a way to get that information via Zigbee2MQTT?
I haven't gotten my hardware flasher yet, so I cannot retrieve the firmware and check via a hex editor yet.

@pvvx
Copy link
Owner

pvvx commented Jan 23, 2025

ZHA only gives this:

Image

1002-0203-59013001 I got from the header of the firmware binary file.

zigbee_ota.py TS0201_TZ3000_v1w2k9dd_ota.bin 

https://github.com/pvvx/ATC_MiThermometer/tree/master/utils -> zigbee_ota.py

fw 1002-0203-60993001-ZYZTH02BLE_v50.zigbee for converting Tuya Zigbee to BLE added to https://github.com/pvvx/ATC_MiThermometer

I don't use Zigbee2MQTT and I can't say anything about it.
It takes me a lot of time to check 30 versions of different devices in BLE and ZigBee in different programs... :)

@dbmaxpayne
Copy link

Sorry, I only started with Zigbee last week when I got those sensors, so my learning curve is still quite steep.
I just enabled debug logging and got the following line:
[2025-01-23 23:01:03] debug: z2m: Received Zigbee message from '0xa4c138bdf4a039ba', type 'commandQueryNextImageRequest', cluster 'genOta', data '{"fieldControl":0,"fileVersion":1510027265,"imageType":515,"manufacturerCode":4098}' from endpoint 1 with groupID 0

So I guess 1002 and 0203 are correct.
However, I don't understand the fileVersion here.

I will try 1002-0203-60993001-ZYZTH02BLE_v50.zigbee on my second sensor once I downloaded its stock firmware.

@pvvx
Copy link
Owner

pvvx commented Jan 23, 2025

For your ts0201_tz3000_v1w2k9dd.bin file, create a header for Zigbee OTA:

python3 make\zb_bin_ota.py bin\ts0201_tz3000_v1w2k9dd.bin bin\ts0201_tz3000_v1w2k9dd -m0x1002 -i0x0203 -v0x60993001 -s"Tuya to ZigbeeTlc"

It will be 1002-0203-60993001-ts0201_tz3000_v1w2k9dd.zigbee

Zigbee OTA is triggered automatically if the program version number is higher.
Or forced OTA is required, but this is difficult to do in Z2M and ZHA.

@vjaunet
Copy link

vjaunet commented Jan 24, 2025

Thanks both for your inputs. I have an "Invalid Image" error from z2m ota update. It was so close ;-) but I am unsure how I can get the exact information
I will try the by-wire flashing asap.
best,

@dbmaxpayne
Copy link

@vjaunet
Did you also try Victor's 1002-0203-60993001-ts0201_tz3000_v1w2k9dd.zigbee file?

@vjaunet
Copy link

vjaunet commented Jan 24, 2025

That's the one I tried, obtained as per pvvx instructions from your bin file.

@dbmaxpayne
Copy link

@pvvx
Do you know what the purpose of the following traces is?

ZTU Board Trace
C0 C0 ->R3 (7.5k)->VCC
B5 P34 ->R12 (7.5k)->VCC

Can or should they be removed when using your firmware to save power?

@pvvx
Copy link
Owner

pvvx commented Jan 24, 2025

Can or should they be removed when using your firmware to save power?

GPIO_PB5 and GPIO_PC0 are not used. This does not increase battery consumption.

@pvvx
Copy link
Owner

pvvx commented Jan 24, 2025

A large increase in consumption is created by ZHA, forcing the "Long Poll interval" to 6 seconds. This is the notification time of the device that it is working. In the Zigbee 3.0 standard, the "Long Poll interval" is set within the limits that the device transmits. But ZHA does not look at what the device says.

Have to write a patch into the firmware because of ZHA... And the firmware loses full compatibility with ZigBee 3.0.

zha\zigbee\cluster_handlers\general.py (LONG_POLL = 6 * 4 # 6s)

@registries.CLUSTER_HANDLER_ONLY_CLUSTERS.register(PollControl.cluster_id)
@registries.CLUSTER_HANDLER_REGISTRY.register(PollControl.cluster_id)
class PollControlClusterHandler(ClusterHandler):
    """Poll Control cluster handler."""

    CHECKIN_INTERVAL = 55 * 60 * 4  # 55min
    CHECKIN_FAST_POLL_TIMEOUT = 2 * 4  # 2s
    LONG_POLL = 6 * 4  # 6s
    _IGNORED_MANUFACTURER_ID = {
        4476,
    }  # IKEA

    async def async_configure_cluster_handler_specific(self) -> None:
        """Configure cluster handler: set check-in interval."""
        await self.write_attributes_safe(
            {PollControl.AttributeDefs.checkin_interval.name: self.CHECKIN_INTERVAL}
        )

    def cluster_command(
        self, tsn: int, command_id: int, args: list[Any] | None
    ) -> None:
        """Handle commands received to this cluster."""
        if command_id in self.cluster.client_commands:
            cmd_name = self.cluster.client_commands[command_id].name
        else:
            cmd_name = command_id

        self.debug("Received %s tsn command '%s': %s", tsn, cmd_name, args)
        self.emit_zha_event(cmd_name, args)
        if cmd_name == PollControl.ClientCommandDefs.checkin.name:
            self.cluster.create_catching_task(self.check_in_response(tsn))

    async def check_in_response(self, tsn: int) -> None:
        """Respond to checkin command."""
        await self.checkin_response(True, self.CHECKIN_FAST_POLL_TIMEOUT, tsn=tsn)
        if self._endpoint.device.manufacturer_code not in self._IGNORED_MANUFACTURER_ID:
            await self.set_long_poll_interval(self.LONG_POLL)
        await self.fast_poll_stop()

    def skip_manufacturer_id(self, manufacturer_code: int) -> None:
        """Block a specific manufacturer id from changing default polling."""
        self._IGNORED_MANUFACTURER_ID.add(manufacturer_code)

For some reason, for IKEA devices, ZHA ignores the forced LONG_POLL setting of 6 seconds.

CHECK_INTERVAL - after this interval, if the device has not notified, then it will be disconnected from the network.
That is, when the Zigbee coordinator is turned off, the device will drop out of the network in 55 minutes :)
In ZHA they write what they like without adding anything to the settings. And there's a lot of that kind of ugliness there.
It's no better in Z2M...
The batteries are not theirs and they don't care what the users end up with. :)

@pvvx
Copy link
Owner

pvvx commented Jan 24, 2025

"CheckInIntervalMin", "LongPollIntervalMin", "FastPollTimeoutMaximum" attributes are supported in legacy ZigbeeTLc. But ZHA doesn't care.

ZigBee Cluster Library Specification
Image

ZHA believes that it is necessary to maximize the radio channel load so that users cannot use many ZigBee devices on one coordinator.

@dynasticorpheus
Copy link
Author

That's the one I tried, obtained as per pvvx instructions from your bin file.

Any luck with applying OTA as soldering is out of my league unfortunately?

@vjaunet
Copy link

vjaunet commented Feb 4, 2025

I'd be interested too if there is a way to flash this over a stock firmware via OTA. I don't know, though.

I used this: https://github.com/pvvx/TlsrComSwireWriter However, it requires soldering of at least the SWS pin. GND and VCC can be temporarily connected via a clamp to the battery terminals. I used a Raspberry Pi 3 for flashing, but it should also work with other USB->UART-Converters.

Erase flash: python3 ./TlsrComSwireWriter/TLSR825xComFlasher.py -p /dev/ttyS0 -t 5000 ea
Write firmware: python3 ./TlsrComSwireWriter/TLSR825xComFlasher.py -p /dev/ttyS0 -t 5000 we ./firmwareFile.bin
Reset CPU: python3 ./TlsrComSwireWriter/TLSR825xComFlasher.py -p /dev/ttyS0 -t 5000 -r

That worked nicely, it was just missing the write address in the second command line :

Write firmware: python3 ./TlsrComSwireWriter/TLSR825xComFlasher.py -p /dev/ttyS0 -t 5000 we 0 ./firmwareFile.bin

Many thanks !

@dbmaxpayne
Copy link

So my hardware programmer has finally arrived.
Using python .\TlsrPgm.py -t 1 -a 20 -p COM6 rf 0 0x80000 orig_512k.bin I was able to pull the original firmware which you can find here: TS0201_TZ3000_v1w2k9dd_NoDisplay_ff.bin

I have tried to upgrade the firmware of my second device without soldering by changing the zigbee header using the command @pvvx mentioned:
python3 make\zb_bin_ota.py bin\ts0201_tz3000_v1w2k9dd.bin bin\ts0201_tz3000_v1w2k9dd -m0x1002 -i0x0203 -v0x60993001 -s"Tuya to ZigbeeTlc"

However, I also get an INVALID_IMAGE error.
To me it's not a problem to solder, however, @pvvx would you have a idea what to change by looking at my downloaded firmware to make it work via OTA only?

With my narrow understanding of the topic and using a hex editor I can see that the MANUFACTURER_ID and IMAGE_TYPE should be correct at addresses 0x12 and 0x14.

Cheers,
Mark

@pvvx
Copy link
Owner

pvvx commented Feb 10, 2025

Here are the data obtained in the ZHA log about the firmware in the new https://pvvx.github.io/ZY-ZTH02/:

2025-02-10 17:12:30.243 DEBUG (MainThread) [zigpy.zcl] [0x1CF3:1:0x0019] Decoded ZCL frame: Ota:QueryNextImageCommand(field_control=<FieldControl: 0>, manufacturer_code=4098, image_type=515, current_file_version=1442918401)
2025-02-10 17:12:30.243 DEBUG (MainThread) [zigpy.zcl] [0x1CF3:1:0x0019] Received command 0x01 (TSN 162): QueryNextImageCommand(field_control=<FieldControl: 0>, manufacturer_code=4098, image_type=515, current_file_version=1442918401)

manufacturer_code=4098=0x1002,
image_type=515=0x0203,
current_file_version=1442918401=0x56013001

But, no matter what numbers I put in, ZHA complains during OTA:

Image

I tried to feed it my own original firmware. The result is the same.


It seems that the original firmware does not support Zigbee OTA or has an error. It is also possible that some special registration is required from the manufacturer's device.

@dbmaxpayne
Copy link

dbmaxpayne commented Feb 10, 2025

@dynasticorpheus

Any luck with applying OTA as soldering is out of my league unfortunately?

So the most solderless version will probably be using Victor's https://github.com/pvvx/TLSRPGM repo.
However, you will still have to solder one wire on the TB-03F-KIT (see the repo for more info).
I got it on AliExpress for like $4.
(This soldered wire is only needed once and temporarily, though, so you might get away with holding a breadboard cable's pin to CH340's pin for a few seconds - same as I do below with the sensor's MCU).

I used the following command to write the firmware:
python .\TlsrPgm.py -t 1 -a 20 -p COM6 we 0 "..\ZigbeeTLc\bin\TS0201_TZ3000_v1w2k9dd.bin"
It takes like 10 seconds to flash and I used crocodile clamps to connect GND->BAT- and POWER->BAT+ on the sensor's board.
For SWS I simply held a breadboard cable's pin to the MCU's SWS pad.

Image
This will be the way I'm going to reflash the rest of my sensors.
It's not worth it to me to fiddle around more now to get OTA working, sorry.

If you have a USB->UART converter you can also try https://github.com/pvvx/TlsrComProg825x.
You might get away without soldering at all.
However, here the flash process takes like 15 minutes or so.
That's a very long time to hold a cable to the MCU's SWS pin.

@pvvx
Copy link
Owner

pvvx commented Feb 10, 2025

It's not worth it to me to fiddle around more now to get OTA working, sorry.

Apparently, in this version of the original firmware, Zigbee OTA simply does not work. There are many things that point to this. The firmware does not support changing the communication interval, and in the analysis of the operation by current consumption, when turning on OTA, it simply breaks the connection, and when forced to start by short pressing the button, an error appears. Otherwise, OTA will be interrupted due to timeout at the initial 0.3%.

@pvvx
Copy link
Owner

pvvx commented Feb 11, 2025

_TZ3000_v1w2k9dd TS0201 is not suitable for IoT :

Image

Such rare readings are completely unnecessary.

@dbmaxpayne
Copy link

_TZ3000_v1w2k9dd TS0201 is not suitable for IoT :

Image

Such rare readings are completely unnecessary.

What do you mean? The stock firmware is very bad, yes, but with your firmware it works well for me.

Image

@pvvx
Copy link
Owner

pvvx commented Feb 11, 2025

What do you mean? The stock firmware is very bad, yes, but with your firmware it works well for me.

I did give a comparison, but with BLE.

@vjaunet
Copy link

vjaunet commented Feb 19, 2025

I'd be interested too if there is a way to flash this over a stock firmware via OTA. I don't know, though.

I used this: https://github.com/pvvx/TlsrComSwireWriter However, it requires soldering of at least the SWS pin. GND and VCC can be temporarily connected via a clamp to the battery terminals. I used a Raspberry Pi 3 for flashing, but it should also work with other USB->UART-Converters.

Erase flash: python3 ./TlsrComSwireWriter/TLSR825xComFlasher.py -p /dev/ttyS0 -t 5000 ea
Write firmware: python3 ./TlsrComSwireWriter/TLSR825xComFlasher.py -p /dev/ttyS0 -t 5000 we ./firmwareFile.bin
Reset CPU: python3 ./TlsrComSwireWriter/TLSR825xComFlasher.py -p /dev/ttyS0 -t 5000 -r

I can't get my flashed Thermometer to join Zigbee2mqtt. Have you managed to get it to join ? Also, no led is working anymore on the thermometer, is that for energy saving purposes ?
Thanks

@vjaunet
Copy link

vjaunet commented Feb 19, 2025

I have been delivered TS0201 _TZ3000_v1w2k9dd and try to get around.

@pvvx
Copy link
Owner

pvvx commented Feb 19, 2025

So something went wrong during the firmware. It's worth repeating.

@dbmaxpayne
Copy link

LED blinks only very shortly with my firmware.
Not sure if that is by error (I was messing around with it for debugging purposes).
Either way the devices paired quickly after pressing the buttom for like 7 seconds.

If that doesn't work I also recommend just flashing it again.

@pvvx
Copy link
Owner

pvvx commented Feb 19, 2025

@dbmaxpayne In your firmware, the LED always turns on when TLSR825x is active. Blinking indicates any chip activity.
You just have an error in the LED signal inversion.

In the ZigbeeTLc version, the LED works when the button is pressed or blinks on request "Identify", as well as at the time of pairing or when the network connection is lost.

@vjaunet
Copy link

vjaunet commented Feb 19, 2025

I have repeated the flashing process many times without luck. I even read the firware of a brand new device and tried to burn it back, without success. Seems like my flashing set-up does not make it properly...
I am using the serial port of an RPi 4, is there any special care that needs to be done in that case ?

@pvvx
Copy link
Owner

pvvx commented Feb 19, 2025

Rpi cannot transmit a continuous stream of bytes to UART.
Cheap USB-COM adapters work fine.
And on RPi a lot of things work incorrectly.

@dbmaxpayne
Copy link

dbmaxpayne commented Feb 19, 2025

Interesting. I actually used an RPi 3B for intial flashing as my USB->UART (FTDI) didn't work.
Maybe I just got lucky.
However, did you use the resistor mentioned here?
https://github.com/pvvx/TlsrComSwireWriter

You must also connect GND of the MCU and RPi together so they share a common ground.
Also wires should be as short as possible.

@dbmaxpayne
Copy link

dbmaxpayne commented Feb 19, 2025

Oh and if you are using pigpiod or any other interrupt-based software, disable that before flashing as it might interfere with the correct timings.
Apart from that I can recommend pigpiod in combination with piscope for debugging of your UART.

@vjaunet
Copy link

vjaunet commented Feb 20, 2025

Finally got it to work on the RPI 4 !
The wiring was ok, the resistor also and grounding was fine but :

  • I was missing the reset line of tlsrComSwire
  • I had to disable pigpiod as you mentioned.

Many many thanks both @dbmaxpayne and @pvvx !

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

5 participants