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.

SimpliciTI Peer to peer problems

Other Parts Discussed in Thread: SIMPLICITI, CC2500

Hi,

I've some problems with my program. I just triying link two end devices i dont know where is the problem because i dont have errors compiling and i have all the libraries.

ED1 Code : Linklisten

--------------------------------------------------------------------------------------------

#include "bsp.h"
#include "mrfi.h"
#include "nwk_types.h"
#include "nwk_api.h"
#include "bsp_leds.h"
#include "bsp_buttons.h"

static uint8_t sRxCallback(linkID_t);              
static         linkID_t LinkID2;               
void toggleLED(uint8_t);

unsigned int delay (unsigned int x)
{       
   unsigned int i,j;            
   for (i = 0; i<= x; i++)        
   {                        
      for(j=0;j<=1000; j++);
   }
return 0;
}

void programa(void);

int x,y,j;
        
void main(void)
{
    uint8_t msg[2], len;
    WDTCTL = WDTPW + WDTHOLD;
    BSP_Init();
   
#ifdef I_WANT_TO_CHANGE_DEFAULT_ROM_DEVICE_ADDRESS_PSEUDO_CODE
  {
    addr_t lAddr;

    createRandomAddress(&lAddr);
    SMPL_Ioctl(IOCTL_OBJ_ADDR, IOCTL_ACT_SET, &lAddr);
  }
#endif /* I_WANT_TO_CHANGE_DEFAULT_ROM_DEVICE_ADDRESS_PSEUDO_CODE */


    SMPL_Init(sRxCallback);          //inicializamos el protocolo
    while(1)
    {
        if(SMPL_SUCCESS == SMPL_LinkListen(&LinkID2))  
     // this part is working fine i think, Because im proving with LinkTo example SImple_Peer_to_Peer" and work fine with my proyect.

        {                                                                                                                               
           toggleLED(2);
           NWK_DELAY(100);
          break;
        }
            toggleLED(1);                                                                                         
    } 

    SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_RXON, 0); //encendemos el radio que por default esta apagado
    while(1)
    {
        if(SMPL_SUCCESS == SMPL_Receive(LinkID2, msg, &len))
        {
            programa();
        }
    }
}

void programa(void)
{
    //do something
}

static uint8_t sRxCallback(linkID_t port)
{
  uint8_t msg[2], len ;

  //check if sent port matches our assigned port (sLinkID1)
  if (port==LinkID2)
  {
    //yep.  proceed
     if(SMPL_Receive(LinkID2, msg, &len)==SMPL_SUCCESS)
     {
       //do something useful
     
       //troubleshooting.  if led toggles, we were sent the correct port #
       BSP_TOGGLE_LED2();//green
     
       return 1 ;  //kill frame. no longer needed
     }
  }
  
  return 0 ; //preserve frame
}

void toggleLED(uint8_t which)
{
  if (1 == which)
  {
    BSP_TOGGLE_LED1();
  }
  else if (2 == which)
  {
    BSP_TOGGLE_LED2();
  }
  return;
}

-------------------------------------------------------------------------------------------

ED2 Code :  link

------------------------------------------------------------------------------------------

#include "bsp.h"
#include "mrfi.h"
#include "nwk_types.h"
#include "nwk_api.h"
#include "bsp_leds.h"
#include "bsp_buttons.h"

static uint8_t sRxCallback(linkID_t);                           
static linkID_t LinkID1;                
void toggleLED(uint8_t);


unsigned int delay (unsigned int x)
{      
   unsigned int i,j;           
   for (i = 0; i<= x; i++)       
   {                       
      for(j=0;j<=1000; j++);
   }
return 0;
}

void programa(void);

int x,y,j;
       
void main(void)
{
    uint8_t msg[2], len;
    WDTCTL = WDTPW + WDTHOLD;
    BSP_Init();
   
#ifdef I_WANT_TO_CHANGE_DEFAULT_ROM_DEVICE_ADDRESS_PSEUDO_CODE
  {
    addr_t lAddr;
   
    createRandomAddress(&lAddr);
    SMPL_Ioctl(IOCTL_OBJ_ADDR, IOCTL_ACT_SET, &lAddr);
  }
#endif /* I_WANT_TO_CHANGE_DEFAULT_ROM_DEVICE_ADDRESS_PSEUDO_CODE */
    SMPL_Init(sRxCallback);          //inicializamos el protocolo
 
  while (SMPL_SUCCESS != SMPL_Link(&LinkID1))           // in this part when im debuggin never pass form here whith the 2 ED working SMPL_Link() never is SMPL_SUCCESS
       {                                                                                                                   
            toggleLED(2);
            toggleLED(1);
            NWK_DELAY(100);                                        
    }

 
    SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_RXON, 0);
    msg[0] = 0x01;
    while(1)
    {   
           SMPL_Send(sLinkID1, msg, sizeof(msg));
    }
}

static uint8_t sRxCallback(linkID_t port)
{
  uint8_t msg[2], len ;

  //check if sent port matches our assigned port (sLinkID1)
  if (port==LinkID1)
  {
    //yep.  proceed
     if(SMPL_Receive(LinkID1, msg, &len)==SMPL_SUCCESS)
     {
       //do something useful
     
       //troubleshooting.  if led toggles, we were sent the correct port #
       BSP_TOGGLE_LED2();//green
     
       return 1 ;  //kill frame. no longer needed
     }
  }
  
  return 0 ; //preserve frame
}

void toggleLED(uint8_t which)
{
  if (1 == which)
  {
    BSP_TOGGLE_LED1();
  }
  else if (2 == which)
  {
    BSP_TOGGLE_LED2();
  }
  return;
}

------------------------------------------------------------------------

Im sorry for a lot of code, principally I have problems with "ED2 code : link" in the part with red, i dont know what is happen, maybe a variable, configuration.....If some can help me.

Additionaly I don't have any problem compiling the program, just is the communication that is unsuccesful

 

 

  • Each device on the network, even in a peer to peer situation, needs to have a unique device address.  In the SimpliciTI build environment, there is a configuration file that provides this information when building for a particular device.

    smpl_config.dat

    You need to modify this file for one of your nodes and provide for an unique THIS_DEVICE_ADDRESS.

  • Thanks Brandon for your answer but THIS_DEVICE_ADDRESS is diferent for each device.

     

    Grettings and thank you

     

  • Hello.

    EDs will not hear anything until you explicitly turn on RX. These are assumed to be low power devices working off batteries. When the radio is turned on, leaving RX on unnecessarily wastes power so the radio wakes up in the idle state for EDs. Alwasy powered devices like APs are always in RX (unless sending).

    Are you certain that the ED1 example is working? The return code  is SMPL_SUCCESS? From the looks of your code the radio is not in RX state. In both your examples if you move the ioctl call that immedotaely follows your failing code to preceed the failing code you might have better luck.

    Hope this helps.

    lfriedman

  • Hello again.

    I have checked the code and in the case of SMPL_Link() and SMPL_LinkListen() the NWK layer takes care of ensuring that RX is on for the duration of the transaction. It turns RX on for the transaction and leaves the radio in the state it was in originally when the transaction is done.

    My mistake. I don't know offhand what the problem in your code might be.

    Note that for explictly receiving a frame, that is, if an application on an ED is expecting to receive a frame from a peer, in that case you do have to explicitly turn RX on with the ioctl call.

    Sorry for any confusion.

    lfriedman

  • Hello.

    Maybe my configuration is wrong.

    I've the next includes.

    ·         C:\Texas Instruments\SimpliciTI-CCE-1.1.0\Components\bsp

    ·         C:\Texas Instruments\SimpliciTI-CCE-1.1.0\Components\bsp\boards\EZ430RF

    ·         C:\Texas Instruments\SimpliciTI-CCE-1.1.0\Components\bsp\drivers

    ·         C:\Texas Instruments\SimpliciTI-CCE-1.1.0\Components\mrfi

    ·         C:\Texas Instruments\SimpliciTI-CCE-1.1.0\Components\simpliciti\nwk

    ·         C:\Texas Instruments\SimpliciTI-CCE-1.1.0\Components\simpliciti\nwk_applications

    also 2 configuration files:

    simpl_config.dat                          ---- here for each ED I've a differenet device address

    smpl_nwk_config.dat              

    but i have a dude with 2 folders of an proyect of TI, because when i run my ".c" in his proyect everthing was working well.

    Thanks a lot!!!

     

     

  • Hello

    You write the code directly in the projet CC2500?

    I must create a new communication project betwenn 2 eZ430 watchs.

    You can help me. I use the SimpliciTI Protocol.

     

    Thanks

  • Hello Oliver, yes i can help you, i wrote the code for my proyect, i had dudes only for the configuration, but actually i dont have any  problems.

  • Hello can you send my your code please i'm loosing in the simpliciti layer.

     

    You must chage wath in the code for make a communication between 2 watchs?

     

    Thanks

  • hello emix

     

    Eum this your code its is for the watch eZ430-Chronos?

    Thanks

  • hi emix,

    can i know if you still have the code?

    can i reference? cause currently i'm doing a project for this also.