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 Sending data command from the coordinator to an end device

Other Parts Discussed in Thread: CC2530, CC2430, Z-STACK

Hello,

I am working with a CC2530ZDK. I am developing a system of monitoring. I am already capable of taking samples and send them to the coordinator and from the coordinator to another device by the RS232.

Now, I want to send some commands from my device to an specific end device (passing by the coordinator), for example, my device will receive a sample and if it is bigger than some value, the device will send an order to the end device makes pin 4 of Port 1 equals to 1.

Someone could help with this? where can I find information about how to program this? 

Thanks,

Victor.

  • Hi Victor,

    What is the example you have programmed your coordinator and end device with?

  • Hi Igor,

    The example that I am working with was developed by a friend based on the GenericApp for the CC2430. I have already done some modifications to adapt it for the CC2530. 

    thanks,

    Victor.

  • Hi Victor,

    To send  some data from coordinator to end device you can use the same method

    as in the case of sending data from end device to coordinator. Usually one calls the

    AF_DataRequest() function to send data from one point to another (it may be a unicast

    or a broadcast message). You can also refer to "Z-Stack API.pdf" document to read

    more about the parameters passed to this function. 

  • Hi Igor,

    I am facing a little problem. I don't know the reason, but when the coordinator receives the message sent by a device over the serial port, I have some problem on the wireless network and the coordinator starts a new network. Do you have any idea for where I should start to look?

    thanks,

    Victor.

  • If you have a packet sniffer, start with it. Try to catch the over the air traffic

    once coordinator showing such behavior, analyze it, may be it can shed

    some light. You can also post this log here, so we could examine it too.

  • I am still facing the same problem. I don't have a packet sniffer, so I will try to explain you what I am doing.

    On Serial_ProcessData ( uint8 port, uint8 event ), the coordinator receives a message and calls the osal_msg_send( GenericApp_TaskID, (uint8 *)msgForGeneric ); where msgForGeneric->hdr.event = SERIAL_SYS_APP_MSG;

    On GenericApp_ProcessEvent( byte task_id, UINT16 events ) I have:

    if ( events & SYS_EVENT_MSG ) {
       MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( GenericApp_TaskID );
       while ( MSGpkt )
       {
             switch ( MSGpkt->hdr.event )
             {
             #if defined(ZDO_COORDINATOR)
             case SERIAL_SYS_APP_MSG:
                   // Callback by serial.c               
                   Send_Cmd();
                   break;
             #endif

    I also defined: 

    #if defined(ZDO_COORDINATOR)
          void Send_Cmd(){
                char theMessageData[] = "Broadcast Test";

                afAddrType_t dstAddr;
                dstAddr.addrMode = AddrBroadcast;
                dstAddr.addr.shortAddr = NWK_BROADCAST_SHORTADDR_DEVALL;

                if ( AF_DataRequest(          &dstAddr,
                                                                &GenericApp_epDesc,
                                                                GENERICAPP_SEND_CMD,
                                                                (byte)osal_strlen( theMessageData ) + 1,
                                                                (byte *)&theMessageData,
                                                                &GenericApp_TransID,
                                                                AF_DISCV_ROUTE,
                                                                AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
                {                       
                            SetLed1();
                }


          }
    #endif

    The routers and end-devices have:

    GenericApp_ProcessEvent( byte task_id, UINT16 events )
    {

          afIncomingMSGPacket_t *MSGpkt;

          if ( events & SYS_EVENT_MSG ) {

          MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( GenericApp_TaskID );
          while ( MSGpkt )
          {
                switch ( MSGpkt->hdr.event )
                {

                      case AF_INCOMING_MSG_CMD:
                            GenericApp_MessageMSGCB( MSGpkt );
                            break;

    void GenericApp_MessageMSGCB( afIncomingMSGPacket_t *pkt ) {
          uint16 DataLength;
          uint8 index = 0;
          uint8 appDataLen=0;
          uint8 *appData;

          switch ( pkt->clusterId ) {
                case GENERICAPP_SEND_CMD:
                      SetLed1();
                      break;

    When I send a message over RS232 to the coordinator, its Led1 is activated, but not the Led1 of Routers and End-devices, what is happening?

    I didn't paste all my code, but if with have questions you can ask me. 

    Thanks,

    Victor.

  • I think I found the problem..

    I was forgetting this:  dstAddr.endPoint = GENERICAPP_ENDPOINT;  on Send_Cmd(). 

    Now,  Led1 is on   =D

  • Hi,

    This is great, I'm glad it's working. :)

  • Hi,

    if the coordinator knows the 64b IEEE address of an end-device, it can use the APSME_LookupNwkAddr() function to look up the 16b address in the Address Manager, right?

    I would like to know if there is a 64b IEEE address corresponding to the broadcast. So, APSME_LookupNwkAddr()  will receive this address as parameter and will return 0xFFFF. There is something like this?

  • Hi ,

    I m also doing similar kind of application but with additionally serial port included...

    I want to send a data from Co-ordinator  to specific ieee(64-bit address) configured either as router/end device

    How this is possible i m trying to get the IEEE using ZDP_IEEEAddrReq and ZDO_NwkAddrReq but i m really unable to get the IEEE 

    I am able to get the nwkaddr of 16-bit which i could verify it by seeing it on the Router LCD...

    Kindly reply asap.....

  • Victor Farias Monteiro said:

    Hello,

    I am working with a CC2530ZDK. I am developing a system of monitoring. I am already capable of taking samples and send them to the coordinator and from the coordinator to another device by the RS232.

    Now, I want to send some commands from my device to an specific end device (passing by the coordinator), for example, my device will receive a sample and if it is bigger than some value, the device will send an order to the end device makes pin 4 of Port 1 equals to 1.

    Someone could help with this? where can I find information about how to program this? 

    Thanks,

    Victor.

    Hello Victor,

    Now i developing a monitoring system for building. and i using CC2530 to make a network, and now, i learning the documents from z-stack but i still confused with those function. can you share your code to sending serial data from end device to coordinator?

    Thank you.