This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2530: How to design a message exchange interface between RF module with Z-Stack and the host MCU

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK,

I am working on the project where ZED is implemented in the form of CC2530 as RF module and another MCU as a host. I am using one of the sample projects for ZED from the HomeAutomation directory provided with the Z-Stack 3.0.2 package. It fits perfectly for my application from a Zigbee interface perspective as I don't have to implement Zigbee standard interface management, for example, binding, in the host MCU connected through the UART to the RF module and interacting with it through MT interface commands. I have defined all the required attributes in the zcl_samplethermostat_data.c header. However, I still have to receive and transmit data from the host MCU. I have just modified the sample code slightly to send the MT_AF_INCOMING_MSG message to the host through the serial interface to process the application data by the host (apart from processing ZCL frames at the endpoint internally in the RF module). To send data to another node over Zigbee interface, I use AF_DATA_REQUEST with ZCL Write Attribute command sent from the host MCU. Unfortunately, in this case, the corresponding attributes in the RF module are not updated and report old value upon receiving ZCL Read Attributes command from ZC.

Below I have described the current situation.

Message exchange using ZCL Write Attributes from ZC to ZED:

  1. ZC sends attribute value to ZED over Zigbee.
  2. ZED's RF module receives attribute value, updates its internal variable, and passes data to the ZED's host MCU using MT_AF_INCOMING_MSG over UART.
  3. ZED's host MCU receives MT_AF_INCOMING_MSG and updates its internal variable accordingly.

Message exchange using ZCL Write Attributes from ZED to ZC:

  1. ZED's host MCU sends AF_DATA_REQUEST ZED's with ZCL Write Attributes command to ZED's RF module over UART.
  2. ZED's RF module sends attribute value from host to ZC without updating its internal variable.

Although this would be sufficient for most of the cases, I need to support reading attributes as well to comply with the Zigbee standard and to unlock other use cases.

Message exchange by reading attributes from ZED by ZC:

  1. ZC sends ZCL Read Attributes command to ZED.
  2. ZED's RF module responds with ZCL Read Attributes Response carrying the value stored in its own variables.

The problem is that ZED's host MCU variable can contain a different value from the one stored in the ZED's RF module. Same about reporting, where I don't want to involve host MCU as well.

What is the best way to resolve this problem? I see the following options but open to consider others as I might miss something:

  1. Modify ZED's RF module source code in the way that its internal variables are updated upon receiving the AF_DATA_REQUEST from the ZED's host MCU. Not sure if it will trigger redundant reporting of the change in case of the binding.
  2. Implement custom messages just for the purpose to synchronize data between ZED's RF module and ZED's host MCU. Looks like something I should have done from the beginning.