CC2538 und CC2530+CC2592 ZigBee Raspberry Pi Modul

Hey,

I’ll switch to german for a second.

german:

Ich nehme an mit low-level meinst du eine “einfachere” step by step anleitung? Klar, kann ich machen. Hast du zigbee2mqtt mit oder ohne docker installiert?

Ich plane aber auch, dafür ein script zu schreiben was den ganzen prozess besser automatisiert. Ist das sehr dringend, oder kannst du da ein paar Tage drauf warten?

deepL for english because I’m lazy:

I assume by low-level you mean an “easier” step by step guide? Sure, I can do that. Did you install zigbee2mqtt with or without docker?

But I also plan to write a script for it which automates the whole process better. Is this very urgent, or can you wait a few days for it?

1 Like

Hey

Korrekt low level Kenntnis bei mir :laughing:

Ich nutze zigbee direkt mit homegear ohne zigbee2mqtt.

Warten kann ich noch hab aktuell nur 4 zigbee module die kann ich im Notfall schnell wieder anlernen

Gruß
Felix

@Adrian, could you say something about the outcome of the error? Maybe something you can implement into homegear to fix this?

I’ll try to look over it next week to see if I can do something when the stick is initialized (when the network is ‘reset’).
Either clearing NVRAM or maybe dealing with that buggy table only. I might have to look over the firmware sources for the details.

1 Like

It seems that I already had an attempt in the code to clear NV on network initialization.
The only thing I did differently on what I found pointed out here:

Source: CC2530: Clear the Association Table of ZNP coordinator - Zigbee & Thread forum - Zigbee & Thread - TI E2E support forums

Was using a soft reset for the stick instead of a hard reset. I’ll change the code to do a hard reset to see if it makes a difference.

I think I had some issues with hard resets in the past, that’s why I avoided it (it disconnected the serial connection or something like that).

LE: Yes, I did, so for now I’ll try to find some other solution than using a hard reset.

1 Like

I’m currently trying to understand why the issue is happening.

By looking over the sources of the firmware and over the TI forums, I suspect that changing the buffers sizes when compiling the sources is a cause of the bug.

The ‘table’ that gets truncated is actually a struct that has a byte ‘all fresh’ which I think does nothing, two bytes that contain the network manager address (this should be zero, I think), two bytes that contain a counter for transmissions and a byte that represents an ‘update id’. This one seems to be dangerous to be corrupted (along with the network manager address) as it’s uses by devices that ‘think’ they lost the network, to rejoin it. It’s used for network updates.

From what I’ve seen in the sources, the devices might receive a ‘network update’ request which they would ignore if the update id they have in the NIB has a bigger or equal value with the one from the request. It appears that such requests might be sent when the channel and/or the channel mask changed.

Maybe the issue would be solved if setting the channel mask to allow only a single channel? It would be worth testing with such a setting, to see if it solves the problem…

Anyway, my attempt to solve it now is to have the NIB explicitly cleared/filled with 116 zeros when network is initialized. I’ll commit the new sources soon.

1 Like

This is great @Adrian. So in theory, with your fix, the CC2538 will just start working. Or should the devices all be re-paired?

The network should be re-initialized, so the devices need re-pair.

I would remove the devices from the network, then issue a reset from the command line, then re-pair them.

2 Likes

I didn’t create a full blown script to github, but just instructions on how to reset your controller. This is due to the fact that I had problems with handling NPM from bash script. Basically because npm doesn’t respect signal handling pretty well :grin: and I didn’t have the time to find reliable workarounds for it.

Anyway, here is a very detailed tutorial together with some scripts to repair your devices.

@dr_snuggles
In deutsch. ich hab das aus Faulheit mit DeepL übersetzt und nur drüber gelesen. Falls da noch verständnisschwierigkeiten sind, schreib mir gerne nochmal dann bessere ich das aus.
German

@Adrian
Sorry I don’t really know how homegear handles zigbee that’s why there is a TODO in the tutorial. If you can give me a short instruction if homegear does buffer the NIB_TABLE and how I could instruct users to reset it until you find a in-software way around it, that would be great.
Also, if you do a PR to homegear which fixes this, can you notify me because I would just be interested in how you solve this.

2 Likes

It doesn’t buffer NIB table. It just explicitly erases it now at network initialization / commissioning, as a workaround for the firmware bug.

1 Like

Great, so no need to delete a backup file as with z2m. Thanks!

Hey,

der Link führt ins Nirvana :grinning:Also beide :grinning:

Kannst mal prüfen ob da ein zahlen Dreher drin ist.

Für mich nochmal zum Verständnis funktioniert das jetzt nur für Zigbee2mqtt oder auch wenn man zigbee im homegear nutzt.

Danke und Gruß
Der Doc

Link sollte jetzt gehen. Sorry, das github repo war auf privat gestellt.

Ja, das läuft über zigbee2mqtt. Hab aus beruflichen Gründen momentan leider nicht die Zeit, da ein extra tool für zu bauen. Du kannst danach zigbee2mqtt wieder löschen. Während du das script laufen lässt, mach bitte homegear aus :wink:

LG

@here

Please wait using the mentioned tutorial, another test showed it might still be unstable.

Bitte noch nicht das script anwenden. Der Prozess scheint instabil zu sein, ist mir in meiner Produktionsumgebung eben aufgefallen.

Wollte noch sagen, englisch ist kein Problem es sind eher die Grundkenntnisse raspberry die mir hier fehlen. Brauchst dir also keinen abbrechen und das ins Deutsche zu bringen. Schritt für Schritt in Englisch reicht vollkommen für mich aber eben auf Anfänger Level :crazy_face:

Gruß und danke!

Der Doc

Haha okay. Sorry, hatte das so verstanden, dass du gerne etwas deutsches hättest, was ja auch kein problem ist.

@all
Regarding my problem after I put the tutorial onto my production instance.

tl;dr: I’m pretty sure it’s a hardware issue, not software/firmware connected to the CC2538 fix. So I would suggest continuing with that if you like.

I think you can continue with the script as it it, since I did a lot more with the latest changes overnight

  • updated raspberry pi OS (since I had some kind of unfixable firmware/kernel problem because I just used a rpi3 SD in a rpi4)
  • backed up homegear/openhab-docker/influx/grafana/homeassistant-docker from the old pi
  • restored everything on the new one
  • for zigbee2mqtt I did a complete new install with the NIB_TABLE fix.
  • updated homegear

After that, all devices worked pretty well. Until this morning.

It seems to be a hardware issue very clear. My raspberry has

  • problems connecting to any device with the HomematicBidCos with CC1101 SPI module.
  • problems connecting to any zigbee devices with zigbee2mqtt with CC2538 UART module

I found out it’s connected to my CC2538 and CC1101 antennas, since when I remove them, all my (near) connections work fine.

I’m not very good with electronics to be honest. Overnight after I connected all devices, I had the two antennas placed directly next to each other (I think they were even stacked). Now it seems that both of them are broken and have bad signal. Maybe the electronics people like @pmayer can say if this is some kind of nogo ^^.

Also, they are placed on the Pi case with ~1,5cm distance. Would it be better if I place one of them on the complete other side, so they have approx 4cm distance?

I always thought Zigbee is using 2.4Ghz band and Homematic 868Mhz, so I expected them not to have too many interference.

Hey,

any feedback on the solution? Still afraid to do it :flushed::joy:

So to understand you right I have to install Zigbee2mqtt do what you write and then uninstall Zigbee2mqtt. Correct? How do I uninstall Zigbee2mqtt? I looked around but didn’t find it :flushed:

Der Doc

Can confirm it works - at least all bulbs survived a cold boot :wink:

@dr_snuggles You don’t have to uninstall z2m. If you have it up and running (e.g. confirm that you can pair a Zigbee device from the web UI) you have to stop z2m, delete data/coordinator_backup.json and then run node scripts/zStackEraseAllNvMem.js /dev/ttyAMA0 from your z2m folder. Afterwards restart z2m. The newly created coordinator_backup.json should have an entry ZCD_NV_NIB with "len":116.

1 Like

@trapperjohn thanks for your feedback! Iwans busy the last weeks so could not answer.

I’m not using Zigbee2mqtt I use the zigbee client in homegear from @Adrian. That‘s why I thought about uninstalling Zigbee2mqtt after the fix. The question is there maybe already another solution to fix it with Adrian‘s version?

Doc

Hallo mal wieder.

So, nun ist es passiert. Mein Raspberry Pi mit dem Zigbee Adapter ist gecrasht. Und da das Bootmedium durch ist, muss ich vollständig neu installieren. :frowning:

Aber ich würde natürlich gerne direkt mit der richtigen Firmware arbeiten. :wink:
Aktuell habe ich diese Firmware drauf: 20200211.

Das checkLen Script aus dem Repository https://github.com/codm/cc2538-fix funktioniert nicht, da in meinem coordinator-backup dieser ganze Pfad nicht drin ist. Die Datei fängt so an, danach folgen nur noch Geräte.

{
  "metadata": {
    "format": "zigpy/open-coordinator-backup",
    "version": 1,
    "source": "zigbee-herdsman@0.13.138",
    "internal": {
      "date": "2021-09-16T13:56:08.828Z",
      "znpVersion": 2
    }
  },
  "stack_specific": {
    "zstack": {
      "tclk_seed": "0c1005acc07d90816c602d289e1e6aa8"
    }
  },
  "coordinator_ieee": "xxxxxxxxxxxxxxx",
  "pan_id": "xxxx",
  "extended_pan_id": "xxxxxxxxxxxxxxxx",
  "nwk_update_id": 0,
  "security_level": 5,
  "channel": 11,
  "channel_mask": [
    11
  ],

Kein Wort von der Länge. :frowning:

Was muss ich nun tun? Welche Firmware ist denn nun empfohlen, und mit welchem Prozess sollte ich die aufspielen. Ich weiss nicht, ob ich was übersehen habe, aber irgendwie fehlt entweder der Abschluss der Problematik, oder ich sehe ihn einfach nicht.

Vielen Dank für eure Hilfe!