cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB5MMG, is there a ZigBee Touchlink Example?

TThan
Associate III

Hi all,

I try to implement a ZigBee device that acts as a Touchlink Target.

My hardware is a STM32WB5MMG module. My debug UART is the LPUART1, no other UART configured.

I use the STM32CubeMX 6.6.1 to generate the project and STM32CubeIDE 1.10.1 to compile. My STM32Cube firmware is STM32Cube_FW_WB_V1.14.1.

I ran into severe issues which I cannot solve due to a massive lack of documentation on this topic.

The project generated by the STM32CubeIDE does not compile and gives no debug trace output. This I was able to solve with the following fixes:

  • Enable Interrupts for IPCC
  • Enable DMA for LPUART1 RX and TX
  • Add a call to Init_Debug() in "app_entry.c" in between the "USER CODE BEGEIN/END APP_Init_1" comments
  • Delete the line "APP_DBG("Channel used: %d", CHANNEL);" in "app_zigbee.c"

Now I can see at least some trace output on my serial terminal when the application starts up:

[M4 APPLICATION] APP_ZIGBEE_Init
[M4 APPLICATION] **********************************************************
[M4 APPLICATION] WIRELESS COPROCESSOR FW:
[M4 APPLICATION] VERSION ID = 1.13.2
[M4 APPLICATION] FW Type : FFD Zigbee stack
[M4 APPLICATION] Application flashed: ..
[M4 APPLICATION] Link Key: ZigBeeAlliance09
[M4 APPLICATION] Link Key value: 5a 69 67 42 65 65 41 6c 6c 69 61 6e 63 65 30 39
[M4 APPLICATION] Clusters allocated are:
[M4 APPLICATION] OnOff Client on Endpoint 1
[M4 APPLICATION] **********************************************************
 [M0] [00000000.000][API]   Init_ZigbeeStack_Infrastructure
[M4 APPLICATION] APP_ZIGBEE_StackLayersInit
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000000.018][PLATFORM]              ZbApsmeAddEndpoint : Adding endpoint 200 (0xc8), profile = 0xc05e, mem = 112

At this point then the application hangs, no more outputs. Looks like it waits forever for the ZigBee stack to initialize.

There are two things that come to my mind:

  1. Does this line "[M4 APPLICATION] Application flashed: .." signal an anomally, because of the ".."? Did I flash the ZigBee stack wrong?
  2. The trace line "OnOff CLient on Endpoint 1" is created by STMCubeMX indepenend of the Endpoint configuration. Maybe there are some more lines I have to change in the generated code? I already had to change some code to come to this point, so for me the idea that I have to change more is possible.

That leaves me with my problem:

How can I solve this? Since there are no examples from ST that show a working touchlink application I have no Idea how all this output should look like and what behaviour I should actually expect from the ST ZigBee stack.

Has anyone successfully implemented a Touchlink application already? Are there any examples available and I was just too stupid to find them?

Any help or hints are greatly appreciated.

Best Regards

Thomas

2 REPLIES 2
TThan
Associate III

Updated information:

After setting the log-level to all by calling " ZbSetLogging(zigbee_app_info.zb, ZB_LOG_MASK_LEVEL_ALL, NULL);" inf app_entry.c / APP_ZIGBEE_NwkForm() I get a bit more trace output:

The ST32WB5MMG is still configured as Touchlink Target. It stops at this output:

 [M0] [00000000.488][PLATFORM]                 touchlink_start : Setting macPanId = 0x0001, macShortAddress = 0xffff, macRxOnWhenIdle = 1
 [M0] [00000000.489][PLATFORM]          touchlink_target_step0 : Target - setting page 0, channel 11

Now I start the Touchlink commissioning on the Off-The-Shelf ZigBee initiator and get these outputs:

 [M0] [00000000.491][PLATFORM]          touchlink_target_step0 : Touchlink Target - Started (page = 0, channel = 11)
 [M0] [00000003.795][PLATFORM]  touchlink_server_handle_command : Touchlink Target processing command 0x00
 [M0] [00000003.796][PLATFORM]  touchlink_target_handle_scan_req : rssiRx=(-54) :: rssiMin(-60)
 [M0] [00000003.797][PLATFORM]  touchlink_target_handle_scan_req : Saving transaction id = 0x13d12e25
 [M0] [00000003.798][PLATFORM]  touchlink_target_handle_scan_req : Touchlink Target - Step 3 (Scan Response, channel = 11, seq = 234)
 [M0] [00000004.048][PLATFORM]  touchlink_server_handle_command : Touchlink Target processing command 0x00
 [M0] [00000004.049][PLATFORM]  touchlink_target_handle_scan_req : rssiRx=(-54) :: rssiMin(-60)
 [M0] [00000004.050][PLATFORM]  touchlink_target_handle_scan_req : Already have transaction id = 0x13d12e25 (rx id = 0x13d12e25)
 [M0] [00000004.300][PLATFORM]  touchlink_server_handle_command : Touchlink Target processing command 0x00
 [M0] [00000004.301][PLATFORM]  touchlink_target_handle_scan_req : rssiRx=(-54) :: rssiMin(-60)
 [M0] [00000004.303][PLATFORM]  touchlink_target_handle_scan_req : Already have transaction id = 0x13d12e25 (rx id = 0x13d12e25)
 [M0] [00000004.552][PLATFORM]  touchlink_server_handle_command : Touchlink Target processing command 0x00
 [M0] [00000004.553][PLATFORM]  touchlink_target_handle_scan_req : rssiRx=(-54) :: rssiMin(-60)
 [M0] [00000004.554][PLATFORM]  touchlink_target_handle_scan_req : Already have transaction id = 0x13d12e25 (rx id = 0x13d12e25)
 [M0] [00000004.804][PLATFORM]  touchlink_server_handle_command : Touchlink Target processing command 0x00
 [M0] [00000004.805][PLATFORM]  touchlink_target_handle_scan_req : rssiRx=(-54) :: rssiMin(-60)
 [M0] [00000004.807][PLATFORM]  touchlink_target_handle_scan_req : Already have transaction id = 0x13d12e25 (rx id = 0x13d12e25)
 [M0] [00000006.778][PLATFORM]  touchlink_server_handle_command : Touchlink Target processing command 0x00
 [M0] [00000006.779][PLATFORM]  touchlink_target_handle_scan_req : rssiRx=(-54) :: rssiMin(-60)
 [M0] [00000006.781][PLATFORM]  touchlink_target_handle_scan_req : Already have transaction id = 0x13d12e25 (rx id = 0x80adebb4)
 [M0] [00000006.804][PLATFORM]       zcl_command_state_timeout : ZCL command request timed-out (zcl_seq=234, zcl_cmd=0x01, dst_ep=256)
 [M0] [00000006.805][PLATFORM]       zcl_command_state_timeout : Generating ZCL_STATUS_TIMEOUT (0x94)
 [M0] [00000007.030][PLATFORM]  touchlink_server_handle_command : Touchlink Target processing command 0x00
 [M0] [00000007.031][PLATFORM]  touchlink_target_handle_scan_req : rssiRx=(-54) :: rssiMin(-60)
 [M0] [00000007.032][PLATFORM]  touchlink_target_handle_scan_req : Already have transaction id = 0x13d12e25 (rx id = 0x80adebb4)
 [M0] [00000007.282][PLATFORM]  touchlink_server_handle_command : Touchlink Target processing command 0x00
 [M0] [00000007.283][PLATFORM]  touchlink_target_handle_scan_req : rssiRx=(-54) :: rssiMin(-60)
 [M0] [00000007.285][PLATFORM]  touchlink_target_handle_scan_req : Already have transaction id = 0x13d12e25 (rx id = 0x80adebb4)
 [M0] [00000007.536][PLATFORM]  touchlink_server_handle_command : Touchlink Target processing command 0x00
 [M0] [00000007.536][PLATFORM]  touchlink_target_handle_scan_req : rssiRx=(-54) :: rssiMin(-60)
 [M0] [00000007.538][PLATFORM]  touchlink_target_handle_scan_req : Already have transaction id = 0x13d12e25 (rx id = 0x80adebb4)
 [M0] [00000007.787][PLATFORM]  touchlink_server_handle_command : Touchlink Target processing command 0x00
 [M0] [00000007.788][PLATFORM]  touchlink_target_handle_scan_req : rssiRx=(-54) :: rssiMin(-60)
 [M0] [00000007.789][PLATFORM]  touchlink_target_handle_scan_req : Already have transaction id = 0x13d12e25 (rx id = 0x80adebb4)
 [M0] [00000015.797][PLATFORM]                 touchlink_timer : Error, Touchlink has timed-out
 [M0] [00000015.798][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000000.488][PLATFORM]                 touchlink_start : Setting macPanId = 0x0001, macShortAddress = 0xffff, macRxOnWhenIdle = 1
 [M0] [00000000.489][PLATFORM]          touchlink_target_step0 : Target - setting page 0, channel 11
 [M0] [00000000.490][PLATFORM]          touchlink_target_step0 : Touchlink Target - Started (page = 0, channel = 11)

That looks promision. Something is received and some process is started.But it looks like it gets stuck something called "step 3" then times out and initiates a warm start.

When I take a look at AN5627 "STM32WB Series ZigBee commissioning guide", chapter 6, it seems to me the commissioning process runs up to the "Response to initiator request". That corresponds to this line in the trace output above;

 [M0] [00000003.798][PLATFORM] touchlink_target_handle_scan_req : Touchlink Target - Step 3 (Scan Response, channel = 11, seq = 234)

But then nothing more happens.

Has anyone an idea what I am missing? My naive assumption was that the black-box encrypted ST M0 firmware handles all the comissioning process.

Any ideas or hints on how to proceed?

Best regards

Thomas

TThan
Associate III

More Updates:

After reading lots of documentations I found out that I have to be touchlink initiator and not target.

The change was easy, but the result is a bit frustrating.

My off-the-shelf ZigBee device now starts the Touchlink process correctly, but the STM32WB5MMG ZigBee-Stack Firmware crashes with the following error message:

[M4 APPLICATION] shieldRegsReady
[M4 APPLICATION] APP_ZIGBEE_Init
[M4 APPLICATION] **********************************************************
[M4 APPLICATION] WIRELESS COPROCESSOR FW:
[M4 APPLICATION] VERSION ID = 1.13.2
[M4 APPLICATION] FW Type : FFD Zigbee stack
[M4 APPLICATION] Application flashed: ..
[M4 APPLICATION] Channel used: 11
[M4 APPLICATION] Link Key: ZigBeeAlliance09
[M4 APPLICATION] Link Key value: 5a 69 67 42 65 65 41 6c 6c 69 61 6e 63 65 30 39
[M4 APPLICATION] Clusters allocated are:
[M4 APPLICATION] OnOff Client on Endpoint 1
[M4 APPLICATION] **********************************************************
 [M0] [00000000.000][API]   Init_ZigbeeStack_Infrastructure
[M4 APPLICATION] APP_ZIGBEE_StackLayersInit
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000000.016][PLATFORM]              ZbApsmeAddEndpoint : Adding endpoint 200 (0xc8), profile = 0xc05e, mem = 112
 [M0] [00000002.023][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
 [M0] [00000000.010][PLATFORM]                     zb_msg_send : Memory exhausted. Unable to send message id: 0x2000
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
 [M0] [00000000.010][PLATFORM]                     zb_msg_send : Memory exhausted. Unable to send message id: 0x2000
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)
 [M0] [00000000.010][PLATFORM]                     zb_msg_send : Memory exhausted. Unable to send message id: 0x2000
[M4 APPLICATION] Network config : APP_STARTUP_TOUCHLINK
 [M0] [00000002.488][PLATFORM]                  ZbNlmeResetReq : NLME-RESET.request (warmStart = 0)
[M4 APPLICATION] ZbStartup Callback (status = 0xc4)
[M4 APPLICATION] Startup failed, attempting again after a short delay (500 ms)

So after some retries there is an out-of-memory fault in the Wireless Stack.

I know there is a newer version 1.14.1 of the ZigBee stack, but the release notes do not mention anything about a fix of an out-of-memory issue. So I hesitate to update the stack, because this is not so easy on my setup. I do not have access to the UART or USB bootloader, only I2C is available.

Any ideas? Or maybe even a hint from an ST employee?

Best regards

Thomas