Re: Getting Contiki and Tmote Connect toworktogether
Hello David,
thank you for spotting that there was an extra two bytes. Turns out that this was indeed the CRC (sequence numbers are not actually turned on by default). I have now managed to replicate the computation of the CRC across the data bytes.
So when I run my little hello World example, with the mote connected to the Connect, the packets get accepted and I can listen to the output via the network!
I am very grateful for your help, and can now move forward with my project.
Thanks,
Jerome Bucka
I can't find the exact documentation for that protocol but it is similar to
http://www.tinyos.net/tinyos-2.x/doc/html/tep113.html:
<quote>
F P S D Payload CR F
F = Framing byte, denoting start of packet: HdlcTranslateC
P = Protocol byte: SerialP
S = Sequence number byte: SerialP
D = Packet format dispatch byte: SerialDispatcherC
Payload = Data payload (stored in SerialDispatcherC): SerialDispatcherC
CR = Two-byte CRC over S to end of Payload: SerialP
F = Framing byte denoting end of packet: HdlcTranslateC
</quote>
Note the sequence number and CRC, both probably have to be correct for the
packet to be accepted. However the example given there does not show the
CRC:
<quote>
Payload is a contiguous packet that SerialDispatcherC reads in. Note that
any data bytes (P - CR) equal to 0x7e or 0x7d will be escaped to 0x7d 0x5e
or 0x7d 0x5d accordingly. For example, a platform independent AM packet of
type 6, group 0x7d, and length 5 to destination 0xbeef with a payload of 1 2
3 4 5 would look like this:
7e 40 09 00 be ef 05 7d 5d 06 01 02 03 04 05 7e
</quote>
Your packets do seem to have an extra two bytes somewhere, that might be a
CRC at the end and if so you would have to generate it properly.
Contiki has a similar slip protocol that could be easily modified, but
serial PPP seems to have been chosen for a recent compatibilty test
http://hinrg.cs.jhu.edu/joomla/images/stories/TinyRPL.pdf
The real issue is what is the payload - ip4, ip6, 6lowpan, 802.15.4, zigbee,
etc. Contiki uses standard ip4 or ip6 network packets.
Most of the contiki configuration parameters are in the platform
contiki-conf.h file. If you built the default hello world example that would
probably be ip4 with a contiki slip connection.
-----Original Message-----
From: Gabriel-Jerome Bucka
Sent: Monday, October 31, 2011 6:46 AM
To: Contiki developer mailing list
Subject: Re: [Contiki-developers] Getting Contiki and Tmote Connect
toworktogether
Hello David,
thank you for your reply. I will try to explain in a little more detail what
I have done so far.
The program I am trying to run is the Contiki hello world example. When the
mote is attached to the Connect, I get no output whatsoever over the
network.
However I also have another mote that is running a TinyOS Basestation, which
does send things to its serial port that then get forwarded to the network.
So, I connected the TinyOS mote locally to my computer in order to inspect
what it sends to the serial port (using a serialdump).
It looks something like:
connecting to /dev/com9 (115200) [OK]
7E4500FF FF00011C 00930000 01000001 00640F51 ~E...............d.Q
0F5B0F5A 0F5A0F60 0F5D0F5D 0F610F5D 0F5A4D3A .[.Z.Z.`.].].a.].ZM:
7E7E4500 FFFF0001 1C009300 00010000 0100650F ~~E...............e.
5D0F540F 550F520F 550F530F 550F510F 520F53C9 ].T.U.R.U.S.U.Q.R.S.
B17E
.~
So I had a look at the tinyOS source and documentation, to figure out what
this meant.
The 0x7E (~) character is a HDLC flag, and is the delimiter at the start and
the end of each message. 0x45 (E), is used to indicate a NAK.
This is then followed by further header information, such as message type
(00), receiver address(ff ff), sender address (00 01), message payload
length (1C), group id (00) and handler type (93).
Finally the next 28 bytes are the actual payload, before the closing HDLC
flag, and then the next packet looks exactly the same.
So I thought I would modify the HelloWorld Example, to produce the same kind
of serial output, by manually sending the necessary bytes to the serial
port, using putchar().
In the Contiki sky main.c file I commented out any output to the serial
line, such as the messages "Contiki 2.4 started etc", to get as close a
match to what the TinyOS program does.
Again using serial dump I get the following output:
connecting to /dev/com10 (115200) [OK]
007E4500 FFFF0001 05009348 656C6C6F 7E7E4500 .~E........Hello~~E.
FFFF0001 05009348 656C6C6F 7E7E4500 FFFF0001 .......Hello~~E.....
05009348 656C6C6F 7E7E4500 FFFF0001 05009348 ...Hello~~E........H
656C6C6F 7E7E4500 FFFF0001 05009348 656C6C6F ello~~E........Hello
etc. (Note that I have changed the payload size header byte to indicate a
payload of 5 bytes.)
However when I now plug the mote running this program into the Connect, The
SerialForwarder does not seem to recognise the packets, and consequently
does not forward them onto the network.
With regards to the baud rates, I am pretty confident that they are both
running at 115200, even when connected to the TmoteConnect.
In case you are interested, the source of my rather crude modification of
the hello_world example can be found here: http://pastebin.com/wVAusbxf
If you have any further suggestions or ideas, I would be happy to hear from
you.
Thank you very much,
Jerome
On 29 October 2011 23:58, David Kopf <dak664-2p+qKb8Fl0QN+BqQ9rBEUg@public.gmane.org> wrote:
What program did you flash to the sky, and is there any serial debug output
when it boots up? The first step would be getting the baud rates to match,
then you would have to match the slip protocols or whatever the connect is
using for the ip4 sockets.
-----Original Message-----
From: Gabriel-Jerome Bucka
Sent: Saturday, October 29, 2011 2:03 PM
To: Contiki-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [Contiki-developers] Getting Contiki and Tmote Connect to
worktogether
Dear all,
I am wondering if any of you have ever tried or succeeded in getting a
Contiki program on a Tmote Sky to talk with a Tmote Connect unit. I have
managed to upload a Contiki programm in ihex format to a Tmote connected to
the USB Port of the TmoteConnect via the network, unfortunately I can not
get any mote output back.
What I would like to do, is to be able to get the mote data which is printed
to the serial line, forwarded back via the network using the
SerialForwarder(which seems quite tailored to TinyOS) built into the
TmoteConnect, so I can then receive the data via packets and store/analyse
it.
I am using Contiki 2.4 and the TmoteConnect has the original Moteiv 1.2.0
firmware on it. If you need any further information about my setup, please
let me know!
I am fairly new to Contiki and Tmotes, and only just joined the developers
mailing list today, so I hope this hasn't been covered before.
Many thanks
Jerome
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook
in minutes. BlackBerry App World™ now supports Android™ Apps
for the BlackBerry® PlayBook™. Discover just how easy and simple
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Contiki-developers mailing list
Contiki-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/contiki-developers
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook
in minutes. BlackBerry App World™ now supports Android™ Apps
for the BlackBerry® PlayBook™. Discover just how easy and simple
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Contiki-developers mailing list
Contiki-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/contiki-developers
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook
in minutes. BlackBerry App World™ now supports Android™ Apps
for the BlackBerry® PlayBook™. Discover just how easy and simple
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Contiki-developers mailing list
Contiki-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/contiki-developers
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook
in minutes. BlackBerry App World™ now supports Android™ Apps
for the BlackBerry® PlayBook™. Discover just how easy and simple
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Contiki-developers mailing list
Contiki-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/contiki-developers
------------------------------------------------------------------------------ RSA® Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________ Contiki-developers mailing list Contiki-developers@... https://lists.sourceforge.net/lists/listinfo/contiki-developers
RSS Feed