Lemos International, Inc.
Telegesis Home Automation
Digilent
Development Kit
www.lemosint.com
Cerebot MX3cK
www.digilentinc.com
void formNetwork(void)
{
txBuf[0] = 0x0D; //preamble
txBuf[1] = 0x0A; //preamble
txBuf[2] = ‘A’; //command
txBuf[3] = ‘T’;
txBuf[4] = ‘+’;
txBuf[5] = ‘E’;
txBuf[6] = ‘N’;
txBuf[7] = ‘:’;
txBuf[8] = ‘1’; //channel
txBuf[9] = ‘1’;
txBuf[10] = ‘,’;
txBuf[11] = ‘3’; //power
txBuf[12] = ‘,’;
txBuf[13] = ‘2’; //PANID
txBuf[14] = ‘4’;
txBuf[15] = ‘6’;
txBuf[16] = ‘8’;
txBuf[17] = 0x0D; //postamble
txBuf[18] = 0x0A; //postamble
void leaveNetwork(void)
{
txBuf[0] = 0x0D; //preamble
txBuf[1] = 0x0A; //preamble
txBuf[2] = ‘A’; //command
txBuf[3] = ‘T’;
txBuf[4] = ‘+’;
txBuf[5] = ‘D’;
txBuf[6] = ‘A’;
txBuf[7] = ‘S’;
txBuf[8] = ‘S’;
txBuf[9] = ‘L’;
txBuf[10] = 0x0D; //postamble
txBuf[11] = 0x0A; //postamble
xmitPkt(19); //send it
Screenshot 3 says it all. The Combined Interface
device is blank as far as PAN establishment is concerned.
The Combined Interface device does not belong to any
particular PAN and it has not established a PAN to its
knowledge. The Combined Interface artillery is primed to
In structure, the AT=EN: command is no different than
the previous AT commands we’ve issued. Along with the
base establish network AT command, we can specify a
desired channel, power level, and PANID. It may take up
to 16 seconds to build the network. So, we’ll mark time
until network establishment response characters begin to
flow into the UART2 receive buffer.
The ETRX357 is configured to echo the incoming
command. We can see that in the top-most line of the
network establishment response message captured in
Screenshot 4. We have requested that the Combined
Interface device build a PAN with a PANID of 2468 on
channel 11 with a power factor of three. A success
response follows, confirming the requested channel and
PANID. The 64-bit EPANID is also revealed.
With the PAN established, the Combined Interface
device is instructed to allow nodes to join the newly
formed PAN:
void permitJoining(BYTE duration)
{
txBuf[0] = 0x0D; //preamble
txBuf[1] = 0x0A; //preamble
txBuf[2] = ‘A’; //command
txBuf[3] = ‘T’;
txBuf[4] = ‘+’;
txBuf[5] = ‘P’;
txBuf[6] = ‘J’;
txBuf[7] = ‘O’;
txBuf[8] = ‘I’;
txBuf[9] = ‘N’;
txBuf[10] = ‘:’;
txBuf[11] = duration; //join window
txBuf[11] = 0x0D; //postamble
txBuf[13] = 0x0A; //postamble
■ Screenshot 3. The OK is a signal that the local
disassociate command completed successfully.
xmitPkt(14);
delayms(1000);
}
The LeftPAN response is a signal to our firmware
that we’re ready to establish a new PAN.
The AT+PJOIN: AT command can be issued without
62 September 2013