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.

Bidirectional Communication using Temp. Monitor Code

Other Parts Discussed in Thread: SIMPLICITI

Hi,

Hi All,

We are trying to connect eZ430-RF2500 in star configuration using simplicity protocol by modifying the temperature monitor code. The program for communication between one AP and ED  flows as follows

1. End device(ED) sends message to the access point(AP) using smpl_send()function. Works fine!

2. At the AP, smtl_receive() function is used to read the received message. This data path is working fine!

3. Now we want to add another data path in which AP will send back the modified received information to the ED. For this we used smpl_send() function in AP as

Part of Code at Access Point

unsigned char uid[1];
   
    uid[0] = 0x0A;

 if (SMPL_Receive(sLID[i], msg, &len) == SMPL_SUCCESS)
        {
          ioctlRadioSiginfo_t sigInfo;                                  //sigInfo is defined here
          sigInfo.lid = sLID[i];                                        //slid is taken into lid of type sifInfo
          SMPL_Ioctl(IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_SIGINFO, (void *)&sigInfo);          
          transmitData( i, (signed char)sigInfo.sigInfo[0], (char*)msg );     // we transmit not the lid but i, sigInfo.sigInfo[0]
          BSP_TOGGLE_LED2();                                                  // and the mssg arrat now in new case it will be 8 bytes of data
          BSP_ENTER_CRITICAL_SECTION(intState);
          sPeerFrameSem--;
          BSP_EXIT_CRITICAL_SECTION(intState);
        
        SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_AWAKE, "" );

    //------------below is the part added and uid is defined above

    if (SMPL_SUCCESS == SMPL_Send(sLID[i], uid, sizeof(uid)))  
    {
      BSP_TOGGLE_LED2();
    }
    else
    {
      BSP_TOGGLE_LED2();
      BSP_TOGGLE_LED1();
    }

We are using the same sLID ie. the linkID so that the ED that sends the message gets the response.

4. At the ED, we used smtl_receive() to read data which has been received

PART OF CODE ON ED

     SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_SLEEP, "" );
    __bis_SR_register(LPM3_bits+GIE);       // LPM3 with interrupts enabled
    SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_AWAKE, "" );
    BSP_TOGGLE_LED2();
    if (SMPL_SUCCESS == SMPL_Send(linkID1, uid, sizeof(uid)))   //inplace of UID was msg-Suyash
    {
      BSP_TOGGLE_LED2();
    }
    else
    {
      BSP_TOGGLE_LED2();
      BSP_TOGGLE_LED1();
    }
         
        //requirement is to wait until response from the AP is recevied

       while(!(SMPL_Receive(linkID1, msg, &len) == SMPL_SUCCESS)){}

       //Now here I am now trying to toggle led, which is not happening.and it directly jumps to the new iteration of sending data to AP.

Some things that we are worried about are:

1. Do we have to enable the radio again right before the SMPL_Receive command by SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_AWAKE, "" );

2. Is the way we are polling for data to be received correct?

3. Is there timing issue?

Your comments and suggestions will be of Great Great help. Thank you.

SJAIN

  • Hello.

    The problem is likely that you do not have the receiver on in the ED. When you awaken the radio by default the receiver is off. This is to conserve power. If the ED is a sensor, as it is the shipping example, there is no need to have the receiver on when the radio is awakened. So, you need to place the radio in Rx mode sometime before you expect to receive the message from the AP. There is an ioctl call for this purpose

    As for the polling loop, it will work in principle. But you could get stuck there for a long time.

    In the full SimpliciTI dsitribution there is a macro named NWK_REPLY_DELAY that is documented in the API dcument. There is also a model for how to use it in the main_manyEDs.c application main program that is used for the AP-as-data-hub example. This is the same scenario as is used on the ez430-CC2500 demo.

     

    Hope this helps.

    lfriedman

     

  • Hey Lfriedman,

    you speak of the macro's that are documented in the API-document. But where can i
    find detailed information about the macro's that are putted default in the library and
    that are available to use?

    Kind Regards

     

  • Hi SuyashJain,

    did you already found the problem?  We actually have exactly the same problem:-s

    We are trying to work bidirectional(AP to ED and ED to AP) starting with the demo-application.

    We don't poll but use a callbackfunction in the ED also. The problem is that or ED doesn't respond.

    The AP sends a message, but the ED doesn't notice?

    Are there any suggestions for this? Please let us know.

     

    Kind Regrads

  • Hello.

    The ED as shipped in the temperature sensor demo is a sensor. There is no need for the ED to receive a message as it is shipped.

    Since SimpliciTI is aimed at supporting low power environments, EDs are configured differently than APs or Range Extenders. The AP and REs are assumed to be always-on and powered from a inexhaustible source so the receiver is always on. But wen the radio is turned on for EDs the receiver is off by default to conserve power. This works fine for the sensor-only case. If the device is sending only there is no need to activate the receiver. But if you want the ED to receive a message as well you need to turn the receiver on after the radio is awakened. You can do this either before or after you send the frame. If do do it after the send there is a race condition but it conserves a little more power. There is an ioctl call for activating the recevier.

    Hope this helps.

    lfriedman