Koenkk / Z-Stack-firmware

Compilation instructions and hex files for Z-Stack firmwares
MIT License
2.33k stars 643 forks source link

CC2530 Z-Stack_Home_1.2 Crash Problem when +10 routers in the network #384

Closed King-anderson closed 1 year ago

King-anderson commented 2 years ago

Hi @Koenkk I'm reviewing Z-Stack_Home_1.2 stack source code to find out why it crashes (possibly a memory leak issue) I want to debug in online mode (using IAR and CCDEBUGGER). but if I use Debug project instead of ProdHex, the linker says flash memory capacity is not enough. it's strange. I can't use Debug project at all. even if I use the default parameters and without your patch file. in ProdHex project, I should set the optimization parameter on medium or High which the debugger can't start with main.c code lines!

summarize: I can't debug z-stack source code lines using cc-debugger.

have you ever debug it using a debugger? do you know any way to see any debug logs (z-stack log)?

Koenkk commented 2 years ago

@King-anderson I've never debugged a CC2530/CC2531 with the ccdebugger. I suggest asking this on the e2e TI forum.

King-anderson commented 2 years ago

@Koenkk OK. I asked about it as an issue in the e2e TI forum. but I see a strange event. after crashing the adapter. when I reflash it or reset it (with reset pin, many times it resolves with resetting instead of reflashing), the routers start to sending "route request" command to adapter to send its network address (route request includes the adapter MAC address). but adapter doesn't respond to them. is "route request" command handled in zigbee-herdsman or z-stack?

EDIT: above issue sometimes occurs and in this situation, the crash issue occurs. if the adapter responds to the command, the crash problem doesn't occur. I see that the adapter responds to one of the "route request" commands and the crash issue doesn't occur.

the situation crash problem occurs, routers periodically send "route request" command to find adapter address , it seems that adapter doesn't respond to the commands and after some minutes it crashs: image

the situation crash problem doesn't occur. I see "link status" data instead of "route request" image

Koenkk commented 2 years ago

but adapter doesn't respond to them. is "route request" command handled in zigbee-herdsman or z-stack?

Route requests are handled in z-stack. However the route requests are not send to the coordinator specifically but are a broadcast instead (all devices will receive it when destination 0xFFFF). If no device has the route nobody will respond. To who is the route requested? (do you get more details when clicking on the "route request"?)

King-anderson commented 2 years ago

Hi @Koenkk sorry for the delay. to answer your question I had to repeat my test which is time-consuming. I join 19 pcs routers to my cc2530+z2m hub. everything was ok. I turned off 13 routers and then turned on them simultaneously. the routers started to send "route request" or "Network address request" to the adaptor simultaneously. after these requests adapter crashed. every time I perform this test, the adapter is crashed. but when I reset the adapter by lowing its pin and restarting the z2m, it works fine. I guess, the crash problem relates to handling multiple routing requests and may be resolved by changing the z-stack preinclude.h file macro values. below is the network log in normal and crashed conditions:

1- normal condition: nomoskel

2- first time after turning off and on 13 pcs routers simultaneously: moshkel1_network_request

3- I restart adapter and z2m and repeat the test (step 2): moshkel2_rout_request

EDIT-1: mac address mentioned in "route request" and "network address request" is my adapter mac. EDIT-2: The blue highlight messages correspond to crash occurrence time.

Koenkk commented 2 years ago

may be resolved by changing the z-stack preinclude.h file macro values.

I guess you are talking about the routing table sizes. These are the number of routes that can be stored at the coordinator side, it doesn't have anything to do with responding to them (which is the case here).

zen2 commented 2 years ago

I follow the discussion from far since I'm not impacted with this issue.

I wonder the firmware use some algorithms that depend on routing table size. If it's the case: depending on algorithms complexity the routing table size can involve:

I've always suspect this kind of problem with old CC2531 coordinator when using a lot of router devices with extended routing table size.

It's just my 2 cents idea.

King-anderson commented 2 years ago

Hi @Koenkk can you tell me the "Defined symbols" you used for CC2530_SOURCE_ROUTING_20211116

Koenkk commented 2 years ago

@King-anderson non except the ones mentioned in step 6: https://github.com/Koenkk/Z-Stack-firmware/blob/master/coordinator/Z-Stack_Home_1.2/COMPILE.md

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days