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: dstShortAddr parameter of MSA_McpsDataReq() on broadcast coordinate mode

Part Number: CC2530
Other Parts Discussed in Thread: TIMAC

Tool/software:

I use the TIMAC v1.5.2 SDK.. The original code is below.

if (msa_IsCoordinator)
      { //HAL_TURN_ON_LED2();//red
        if (MSA_PACKET_LENGTH >= MSA_HEADER_LENGTH)
        {
          /* Coordinator sending to devices. Use the associated list of device to send out msg */
          msa_Data1[0] = MSA_PACKET_LENGTH;
          msa_Data1[1] = HI_UINT16(msa_DeviceRecord[index].devShortAddr);
          msa_Data1[2] = LO_UINT16(msa_DeviceRecord[index].devShortAddr);
          msa_Data1[3] = sequence;
        }

        MSA_McpsDataReq((uint8*)msa_Data1,
                        MSA_PACKET_LENGTH,
                        msa_DeviceRecord[index].isDirectMsg,
                        msa_DeviceRecord[index].devShortAddr );
        

        /* Reset the index if it reaches the current number of associated devices */
        if (++index == msa_NumOfDevices)
        {
          index = 0;
        }

my modified coding is "MAC_SHORT_ADDR_BROADCAST" instead of "msa_DeviceRecord[index].devShortAddr" at 15th row.

Question)this is a broadcast communication, there is no need to specify an index.
So how can I modify the below part?

7th row : msa_Data1[1] = HI_UINT16(msa_DeviceRecord[index].devShortAddr);
8th row : msa_Data1[2] = LO_UINT16(msa_DeviceRecord[index].devShortAddr);
14th row : msa_DeviceRecord[index].isDirectMsg,

What do you think about this? 
7th row : msa_Data1[1] = HI_UINT16(MSA_PAN_ID);
8th row : msa_Data1[2] = LO_UINT16(MSA_PAN_ID);
14th row : TRUE,

the coordinator and the device same as above coding.

  • Hello Edan,

    The 7th and 8th rows are personal preference since they involve the data packet, you would just need to take care when processing on the receiving side if using these bytes as a filter within your application.  The 14th row (Direct message) should be TRUE and the 15th row would be MAC_SHORT_ADDR_BROADCAST, so what you've listed sounds reasonable at first glance.  Does this result in a broadcast message as intended when using a sniffer, and it is received by your target devices?  Note that sleepy devices will not receive broadcast messages since their receivers are turned off while in sleep mode.

    Regards,
    Ryan

  • Hi, Ryan

    I don't know if it goes into sleep mode or not. How can I force it not to go into sleep mode?

  • For msa.c, check, whether msa_isDirectMsg is TRUE or FALSE as this will determine the state of MAC_RX_ON_WHEN_IDLE accordingly.

      /* This device is setup for Direct Message */
      if (msa_IsDirectMsg)
        MAC_MlmeSetReq(MAC_RX_ON_WHEN_IDLE, &msa_MACTrue);
      else
        MAC_MlmeSetReq(MAC_RX_ON_WHEN_IDLE, &msa_MACFalse);
        

    Regards,
    Ryan

  • in 30 minutes,I checked the value of the msa_IsDirectMsg.

        if (events & MSA_SEND_EVENT){
            if (msa_IsDirectMsg)
              debug(0,"msa_IsDirectMsg:TRUE",strlen("msa_IsDirectMsg:TRUE"));
            else
              debug(0,"msa_IsDirectMsg:FALSE",strlen("msa_IsDirectMsg:FALSE"));
             
        

    The result is TRUE. never changed.

    What is means?

    and How can I force it not to go into sleep mode?

  • TRUE is fine as it means MAC_RX_ON_WHEN_IDLE is TRUE as well, which is necessary as the receiver has to be on in order to receive broadcasts (note this increases device power consumption since the device and radio has to stay on in order to receive packets at any time).

    Regards,
    Ryan

  • Can I use the code below to prevent it from going into sleep mode?

    if (events & MSA_SEND_EVENT){ 
        MAC_MlmeSetReq(MAC_RX_ON_WHEN_IDLE, &msa_MACTrue);

  • That is the intent, most importantly it will keep the RX on during idle states so that it can receive broadcast messages at any time.  You should only need to use this function once during startup of your application, not every MSA_SEND_EVENT.

    Also make sure that you call MSA_PowerMgr with a parameter value of zero to keep the device always on.  Remove the POWER_SAVING pre-define if used.

    Regards,
    Ryan

  • OK. thanks a lot.