Hi.I'm building SimpliciTI network and I have a problem with the addressing of messages.The network shall consist of PIR movement detectors (SED), and light switches (ED), one pair per room.In addition network will consist AP to archiving all the data, and a remote control (ED) that can control the light in each room regardless of PIR sensors.And now what's the problem:If I use only one PIR sensor and one light switch, and configure them as it is in the sample code SimpliciTI (PIR = SED, switch = AP), it all works nicely.In fact, I also may use several PIR sensors, and this also will work (although such action is pointless because the lighting in one room can be controled by the sensors from different rooms, but it should not be).The problem appears to want to add additional light switches and assign them to appropriate PIR sensors.As is easy to guess each switch should respond only to signals from the one PIR sensor, in the same room.So the data sent from the PIR sensors should be addressed.Well, nowhere can I find information on how to do it. I know I need to set the address DST_ADDR, but I do not know how to do this from the application.I can put right address directly inside the SMPL_Send function, but first, then it does not work :D, and secondly, certainly not so to have do it. I think that is certainly a function that will allow me to give this address from the application (with the function of main.c). Except that I do not know what is this function.The second issue is I don't know where i must set the address of each device on the network.I know that is the definition in the file smps_config.dat (DTHIS_DEVICE_ADDRESS), but later in the code I see that an address is generated using createRandomAddress. Which of these addresses is the real device address?For now (to be sure) I placed addresses both in DTHIS_DEVICE_ADDRESS and in place of those generated by the function createRandomAddress.And the third question by the way: Is the SED at the start of the function SMPL_LinkListen AP sends information to the AP that he just woke up? To AP knew that he may send the information waiting for SED?Thank you very much!
Hi Andy,
Andy Yang The problem appears to want to add additional light switches and assign them to appropriate PIR sensors.As is easy to guess each switch should respond only to signals from the one PIR sensor, in the same room.So the data sent from the PIR sensors should be addressed.Well, nowhere can I find information on how to do it. I know I need to set the address DST_ADDR, but I do not know how to do this from the application.I can put right address directly inside the SMPL_Send function, but first, then it does not work :D, and secondly, certainly not so to have do it. I think that is certainly a function that will allow me to give this address from the application (with the function of main.c). Except that I do not know what is this function.
The problem appears to want to add additional light switches and assign them to appropriate PIR sensors.As is easy to guess each switch should respond only to signals from the one PIR sensor, in the same room.So the data sent from the PIR sensors should be addressed.Well, nowhere can I find information on how to do it. I know I need to set the address DST_ADDR, but I do not know how to do this from the application.I can put right address directly inside the SMPL_Send function, but first, then it does not work :D, and secondly, certainly not so to have do it. I think that is certainly a function that will allow me to give this address from the application (with the function of main.c). Except that I do not know what is this function.
Basically SimpliciTI works on Peer-To-Peer concept, which means once the communication is established, the application no longer needs the remote device to send or receive messages, this is all taken care of the stack. The application shall just use the linkID handle to do the communication. I add this information on the SimpliciTI FAQ wiki:
http://processors.wiki.ti.com/index.php/SimpliciTI_FAQ
There you can also find the information about the Token which i would call as the specifier for linking two devices. You should be able to use the Token to determine which device shall be connected to which device.
Andy Yang The second issue is I don't know where i must set the address of each device on the network.I know that is the definition in the file smps_config.dat (DTHIS_DEVICE_ADDRESS), but later in the code I see that an address is generated using createRandomAddress. Which of these addresses is the real device address?For now (to be sure) I placed addresses both in DTHIS_DEVICE_ADDRESS and in place of those generated by the function createRandomAddress.
The second issue is I don't know where i must set the address of each device on the network.I know that is the definition in the file smps_config.dat (DTHIS_DEVICE_ADDRESS), but later in the code I see that an address is generated using createRandomAddress. Which of these addresses is the real device address?For now (to be sure) I placed addresses both in DTHIS_DEVICE_ADDRESS and in place of those generated by the function createRandomAddress.
The short answer to this is basically the THIS_DEVICE_ADDRESS is the default address used by the stack. The code with createRandomAddress() is only activated if you define I_WANT_TO_CHANGE_DEFAULT_ROM_DEVICE_ADDRESS_PSEUDO_CODE during compilation (which is per default not defined), and the createRandomAddress() itself is per default not defined anywhere in the code.
The purpose of this part of code is only to show how the address can be generated randomly during startup and not using the THIS_DEVICE_ADDRESS definition.
Andy Yang And the third question by the way: Is the SED at the start of the function SMPL_LinkListen AP sends information to the AP that he just woke up? To AP knew that he may send the information waiting for SED?
And the third question by the way: Is the SED at the start of the function SMPL_LinkListen AP sends information to the AP that he just woke up? To AP knew that he may send the information waiting for SED?
I am not really sure that i understand this question correctly, however the SMPL_LinkListen() is basically a "passive" function, means it waits for an incoming message Link request and send the Link reply if everything is ok to establish the connection. On the other part, it is the SMPL_Link() function which is actively sending the Link request message.
I hope this helps.
-Leo-
Regards,
Leo Hendrawan
Thanks for your reply.I'm thought long over it all and I came to some conclusions.But one by one: DAbout DTHIS_DEVICE_ADDRESS address I understand everything now. Previously I had missed it somewhere. Thanks.As for SMPL_LinkListen () and its passivity I think I understand it too.But I don't quite understand this:
lhend Basically SimpliciTI works on peer-to-peer concept, Which Means once the communication is ESTABLISHED, the application no longer needs the remote device to send or receive messages, this is all taken care of the stack.
Basically SimpliciTI works on peer-to-peer concept, Which Means once the communication is ESTABLISHED, the application no longer needs the remote device to send or receive messages, this is all taken care of the stack.
What do You mean as the remote device? Because I do not think a second device of the pair? Because it is rather necessary to communicate: DAnd what to use the Token is I have quite mixed feelings.Using this seems to me pointless in this solution if I know all the addresses of the devices.And from what I understand is to use the Token is used to establish a connection so to obtain an DTHIS_DEVICE_ADDRESS other device.But first this address is not known by the stack Simpilciti.So I thing that the SimpliciTI device must use a broadcast mode to send the Token to other nodes. So each device (other nodes) will have to receive data from the Token frame.And only after receiving a frame, and the full decoding this frame, SimpliciTI device can see that the token does not fit for it and can continue to go to sleep (only for one device Token be proper).And this is probably not conducive to energy efficiency.Secondly, getting the Token frame connection takes some time.That is, modules must been in send/receive state for longer time.I understand that after I get Token Connection SimpliciTI stack have the device address. And I will have access to the device (second node) without playing with the DST_ADDR address, and simply by using Link_ID (becaouse SimpliciTI stack know DST_ADDR address now).No only that, for me, using Token and Link_ID seems the same (if not more) playing than the direct addressing the frame using DST_ADDR (which address I anyway know in advance). In the end, I have to enter a parameter, whether Token or DST_ADDR.I can't do it this way that I will immediately use DST_ADDR?In my opinion, use of Token would make sense if it a device address be variable.Just as the Internet I not use IP address when I want connect with someone, such as by Skype. Because it would be inconvenient. So I use a user name. And Skype (or network services of operating system) reads the IP address independently and use it to connect. And I may not worry about IP address. In this situation it is really convenient.But in SimpliciTI it's rather something else.Because nothing gets better with this reason that it does not using DST_ADDR, since I still have to manually specify something else: Token.In other words, I still must give something. An identifier.As such it is probably better at once give directly DST_ADDR.Then there I don't need establish a connection before sending data.Just once send data frame already directly addressed by DST_ADDR.And this frame receiving only one module because modules CC1000 hardware filtering address (at least first byte). It certainly is more energy efficient.I can't do that directly?Or maybe i don't understand something else in SimpiciTI connection?Thanks You once again.
Andy Yang But I don't quite understand this: lhend Basically SimpliciTI works on peer-to-peer concept, Which Means once the communication is ESTABLISHED, the application no longer needs the remote device to send or receive messages, this is all taken care of the stack. What do You mean as the remote device? Because I do not think a second device of the pair? Because it is rather necessary to communicate: D
But I don't quite understand this:
What do You mean as the remote device? Because I do not think a second device of the pair? Because it is rather necessary to communicate: D
Sorry for the confusion, i think my brain was faster than my finger typing the words at that point in time :) What i meant is actually:
Basically SimpliciTI works on peer-to-peer concept, Which Means once the communication is ESTABLISHED, the application no longer needs the remote device's address to send or receive messages, this is all taken care of the stack.
Andy Yang And what to use the Token is I have quite mixed feelings.
And what to use the Token is I have quite mixed feelings.
I think you may have misunderstood the concept of the Token in SimpliciTI. I added this information on the SimpliciTI FAQ wiki: http://processors.wiki.ti.com/index.php/SimpliciTI_FAQ. If you know a little bit about Zigbee, i would say that the concept of Token in SimpliciTI is pretty much the same with the concept of PAN ID in Zigbee which is basically makes the following basic rule: only devices with the same Token(PAN ID in Zigbee) can communicate with each other.
The aim of the token concept in SimpliciTI is application specifier, to determine that the devices are connected to another devices running the same application. Just a small example: let's say you are building a small building automation system with devices communicating with each other wirelessly using a proprietary protocol based on SimpliciTI. For example you have smoke detectors which connected with each other wirelessly and also temperature sensor which is connected to a simple thermostat. When you setup the whole system, you definitely do not want the smoke detectors connected to the thermostat although both application are using SimpliciTI. This is exactly where the Token concept plays important role. In this case, you should use different Token between the smoke detectors and the temp sensor+thermostat. Since the smoke detectors are using different token with the temp sensor+thermostat, they can only connect with another smoke detectors, on the other hand because the temp sensor is using the same token as the thermostat, they can only connect with each other but not with the smoke detectors.
However please notice that there are basically two types of token: join token and and link token. If your application is using an Access Point (AP) and the ED shall join the AP, you should notice that basically they should have the same join token, and the link token after the joining will be determined by the link token sent by the AP in the Join reply message.
I hope this helps you further a bit. Please feel free to ask more questions if you are still not sure about something. Sorry also about the poor documentation of SimpliciTI that might causes you trouble getting understand of the concept. We are planning of course to improve this in the future.
Thank you again.As for the smoke detectors, i thinking about them too :)I guess is that the Token has also the advantage that it does not need to add any new sensor to the system (I mean his address), and it is enough that it will have the appropriate Token and immediately be visible in the system.Of course this only works for example in smoke detectors (where each sensor independently of its location affects one alarm signal).In my case, it is a little different because each sensor has to operate with only one light switch and I must therefore have to use very many Tokens.I think rather choose to use Token, but still ask to be sure:Does SimpliciTI provides this my simplified communication by direct addressing using DST_ADDR?Unfortunately I newer using ZigBee, so I must ask:One device can have multiple Tokens, or must have only one token?Because of my case, for example, I have 3 devices.1, 2 and 3I want to send information between the 2 of 1, and between 3 to 1 (bidirectional).When I set them all the same token and when i connected 1 to 2, does 3 will not receive information from 1 or 2 (depending on transmission direction)?I see the example on the SimpliciTI Wiki, but I do not really see exactly where the token is given. I guess that it must be some number (it is L_LINK_TOKEN_OS?).May i use void nwk_setLinkToken(uint32_t token) function to change the Token?Don't worry about Simpiclit documentation. My lack of understanding is rather due to the fact that I have a pretty low-level approach to this. I mean I wanted to control everything himself (the addresses) instead control this by stack. The SimpilciTI documentation is simply more focused on just such high-level use of the finished stack.
Andy.
Andy Yang I think rather choose to use Token, but still ask to be sure:Does SimpliciTI provides this my simplified communication by direct addressing using DST_ADDR?
I think rather choose to use Token, but still ask to be sure:Does SimpliciTI provides this my simplified communication by direct addressing using DST_ADDR?
No unfortunatelly not, the easiest way to see this is by looking into the API functions, and you can see that there is no way to address such messages directly.
Andy Yang Unfortunately I newer using ZigBee, so I must ask:One device can have multiple Tokens, or must have only one token?
Unfortunately I newer using ZigBee, so I must ask:One device can have multiple Tokens, or must have only one token?
You can have only one active Token at a time (Token is implemented as single variable in the stack - look for sLinkToken and sJoinToken in the stack code), but of course you can change it at run time by using SMPL_Ioctl() function with the object IOCTL_OBJ_TOKEN.
Andy Yang Because of my case, for example, I have 3 devices.1, 2 and 3I want to send information between the 2 of 1, and between 3 to 1 (bidirectional).When I set them all the same token and when i connected 1 to 2, does 3 will not receive information from 1 or 2 (depending on transmission direction)?
Because of my case, for example, I have 3 devices.1, 2 and 3I want to send information between the 2 of 1, and between 3 to 1 (bidirectional).When I set them all the same token and when i connected 1 to 2, does 3 will not receive information from 1 or 2 (depending on transmission direction)?
In this case i assume that your device 1 will do two time SMPL_LiskListen() while device 2 and 3 do one time SMPL_Link(). As i mentioned before, the logical connection is peer-to-peer, which means that once the connection is established, it will only can send and receive data from the remote peer device. In this case, even device 3 can basically received the data between device 1 and 2, the messages will however be filtered in the stack and will not be forwarded to the application.
lhend You can have only one active Token at a time (Token is implemented as single variable in the stack - look for sLinkToken and sJoinToken in the stack code), but of course you can change it at run time by using SMPL_Ioctl() function with the object IOCTL_OBJ_TOKEN.
Unfortunately I can not find anywhere something like IOCTL_OBJ_TOKEN.I mean it is not declared anywhere.When I compiling code (I try to use this: http://yawing.googlecode.com/svn/trunk/yawing/Projects/Examples/Applications/main_AP_RE.c ) I get an error: identifier "IOCTL_OBJ_TOKEN" is undefinedI found the function SMPL_Ioctl and indeed it has no support IOCTL_OBJ_TOKEN:
smplStatus_t SMPL_Ioctl(ioctlObject_t object, ioctlAction_t action, void *val){ smplStatus_t rc; switch (object) { case IOCTL_OBJ_CONNOBJ: rc = nwk_connectionControl(action, val); break; case IOCTL_OBJ_ADDR: if ((IOCTL_ACT_GET == action) || (IOCTL_ACT_SET == action)) { rc = nwk_deviceAddress(action, (addr_t *)val); } else { rc = SMPL_BAD_PARAM; } break; case IOCTL_OBJ_RAW_IO: if (IOCTL_ACT_WRITE == action) { rc = nwk_rawSend((ioctlRawSend_t *)val); } else if (IOCTL_ACT_READ == action) { rc = nwk_rawReceive((ioctlRawReceive_t *)val); } else { rc = SMPL_BAD_PARAM; } break; case IOCTL_OBJ_RADIO: rc = nwk_radioControl(action, val); break;#ifdef ACCESS_POINT case IOCTL_OBJ_AP_JOIN: rc = nwk_joinContext(action); break;#endif#if defined( FREQUENCY_AGILITY ) case IOCTL_OBJ_FREQ: rc = nwk_freqControl(action, val); break;#endif case IOCTL_OBJ_FWVER: if (IOCTL_ACT_GET == action) { memcpy(val, nwk_getFWVersion(), SMPL_FWVERSION_SIZE); rc = SMPL_SUCCESS; } else { rc = SMPL_BAD_PARAM; } break; case IOCTL_OBJ_PROTOVER: if (IOCTL_ACT_GET == action) { *((uint8_t *)val) = nwk_getProtocolVersion(); rc = SMPL_SUCCESS; } else { rc = SMPL_BAD_PARAM; } break; case IOCTL_OBJ_CRYPTKEY: default: rc = SMPL_BAD_PARAM; break; } return rc;}
Do I have inappropriate SimpliciTI code?
I use code from this module: http://www.ti.com/tool/ez430-rf2500-seh
EDIT.
Ok, i found new SimpliciTI code where is token service.
I swapped "Components" directory in the project "SEH Sensor Monitor" but then I have this error when compiling: #error "Failed to match a default include file" SEH Sensor Monitor line 251
In the console I have a fuller description of the error:
"C:/Program Files/Texas Instruments/ccsv4/msp430/include/msp430.h", line 251: fatal error: #error "Failed to match a default include file"1 fatal error detected in the compilation of "C:/Texas Instruments/eZ430-RF2500-SEH_Sensor_Monitor-v1.5/CCE_Source/Projects/Examples/peer_applications/Applications/SEH_ED_v1.5.c".Compilation terminated.I have no idea what's going on with this error.Does anyone have any ideas?
I have a similar situation, which is to figue our which ED is connected to the AP and send the message to the ED with this particular address.
On your ED side, you can assign a address , for example, 0x55AA0001, to the ED
lAddr.addr[0] = 0x55;
lAddr. addr[1] = 0xaa;
lAddr. addr[2] = 0x00;
lAddr. addr[3] = 0x01;
/* Tell network stack the device address */
SMPL_Ioctl(IOCTL_OBJ_ADDR, IOCTL_ACT_SET, &lAddr);
//----------------------------//
On your AP side, once the link is estibilshed, the ED address can be figured out using the API nwk_getConnInfo:
if (SMPL_SUCCESS == SMPL_Receive(sLID[i], msg, &len))
{
connInfo_t *pCInfo = nwk_getConnInfo(sLID[i]);
address1 = pCInfo-> peerAddr[0];
address2 = pCInfo-> peerAddr[1];
address3 = pCInfo-> peerAddr[2];
address4 = pCInfo-> peerAddr[3];
...
}