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