The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: Re: CRC16



--------------090204050601030403050208
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I did the same with some PIC's a while back and used the RS485 4 wire
approach with a master at the PC, though I've since replaced them with
Ethernet connected devices.

The thing that took the most time was the code for the master to
recognise which devices were on the '485 bus and filter accordingly and
the ring buffer for thexAP  messages. The broadcast nature of many xAP
messages is both a blessing and a curse! The 'on the wire' was native
xAP. It seems a shame if there's lots of people developing for RS485 but
using a coded message structure that there'll be no interoperability.

If I was looking at 2 wire again, I'd go CAN BUS with a coded structure,
probably based on J1739/14 and not VSCP - which seems to be in the
doldrums from what I can see of the webpages but I may be wrong.

Lehane





On 07/11/2011 02:27, hillbillies@xxxxxxx wrote:
>
>
>  Hi Neil, My current thoughts are to send the whole xAP message across
>  the RS485 link. RS485 does not do a very good job of detecting bus
>  activity so I'm using the electrical specs from J1708. This then
>  allows me to use the code from the YASP project to do Carrier Sense
>  Multiple Access / Collision Detection (got the hint from Paul's
>  www.bazautomation.com site). The xAP message decoding comes from
>  DBZoo's Arduino project. Hopefully this will all fit in a ATmega32U4.
>  The prototype board I'm working on is a Teensy from www.pjrc.com.
>
>  Currently I have the J1708 interface working and the xAP decode
>  working. Hopefully in the next couple of days the transit side will
>  be working. Then I need a bridge - based on Patrick's serial bridge
>  that will interface to one of my boards to do the half duplex message
>  translation from ethernet.
>
>  I decided that putting full xAP protocol over the wire was going to
>  be easier as then the PC end does not have to do any conversions. I
>  think that the bridge will only stop heartbeats, but everything else
>  will get through. The AVR can then decide what it wants to do with
>  the message. At the moment I think that I can limit the AVR TX
>  message length to 256 bytes and the receive length to 512 bytes
>  (maybe longer once all the code is in the AVR).
>
>  Cheers Alan NZ --- In xAP_developer@xxxxxxx
>  <mailto:xAP_developer%40yahoogroups.com>,
"Neil Wrightson"
>  <neilw@...> wrote:
> >
> > Hi Alan,
> >
> >
> >
> > What RS485 protocol are you referring to?
> >
> >
> >
> > I'm also doing some xAP stuff using AVR's. I'm creating a gateway
> > that converts between the Ethernet and the RS485 network.
> >
> > It uses a AVR (Mega128) as the go between. From here it then
talks
> > to the RS485 AVR slaves using my own protocol.
> >
> > I found it easier to implememnt this way. Less xAP actually on
the
> > RS485 network.
> >
> >
> >
> > Regards,
> >
> > Neil Wrightson.
> >
> > Australia.
> >
> > From: xAP_developer@xxxxxxx
> > <mailto:xAP_developer%40yahoogroups.com>
> > [mailto:xAP_developer@xxxxxxx
> > <mailto:xAP_developer%40yahoogroups.com>]
On Behalf Of
> > hillbillies@... Sent: Monday, 7 November 2011 11:20 AM To:
> > xAP_developer@xxxxxxx
> > <mailto:xAP_developer%40yahoogroups.com>
Subject: [xAP_developer]
> > CRC16
> >
> >
> >
> >
> >
> > Hi Everybody,
> >
> > New to the group, I only started looking xAP about a month ago.
> >
> > I'm developing a RS485 style network with AVR devices. The wire
> > protocol should allow me to detect collisions but I would like to
> > put CRC16 error checking into the devices. Although the Protocol
> > definition talks about CRC16, it doesn't state which polynomial
is
> > the preferred one.
> >
> > The AVR libraries have have already coded:
> >
> > Optimized CRC-16 calculation. Polynomial: x^16 + x^15 + x^2 + 1
> > (0xa001) Initial value: 0xffff
> >
> > Optimized CRC-CCITT calculation. Polynomial: x^16 + x^12 + x^5 +
1
> > (0x8408) Initial value: 0xffff
> >
> > Optimized Dallas (now Maxim) iButton 8-bit CRC calculation.
> > Polynomial: x^8 + x^5 + x^4 + 1 (0x8C) Initial value: 0x0
> >
> > Optimized CRC-XMODEM calculation. Polynomial: x^16 + x^12 + x^5 +
1
> > (0x1021) Initial value: 0x0
> >
> > Can anyone give me a pointer on which way to go?
> >
> > Thanks
> >
> > Alan
> >
>
>



--------------090204050601030403050208
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit





<head>

<style type="text/css">
<!--

/* start of attachment style */
.ygrp-photo-title{
clear: both;
font-size: smaller;
height: 15px;
overflow: hidden;
text-align: center;
width: 75px;
}
div.ygrp-photo{
background-position: center;
background-repeat: no-repeat;
background-color: white;
border: 1px solid black;
height: 62px;
width: 62px;
}

div.photo-title
a,
div.photo-title a:active,
div.photo-title a:hover,
div.photo-title a:visited {
text-decoration: none;
}

div.attach-table div.attach-row {
clear: both;
}

div.attach-table div.attach-row div {
float: left;
/* margin: 2px;*/
}

p {
clear: both;
padding: 15px 0 3px 0;
overflow: hidden;
}

div.ygrp-file {
width: 30px;
valign: middle;
}
div.attach-table div.attach-row div div a {
text-decoration: none;
}

div.attach-table div.attach-row div div span {
font-weight: normal;
}

div.ygrp-file-title {
font-weight: bold;
}
/* end of attachment style */
-->
</style>
</head>
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">


<!-- **begin egp html banner** -->

<br><br>

<!-- **end egp html banner** -->



I did the same with some PIC's a while back and used the RS485 4
wire approach with a master at the PC, though I've since replaced
them with Ethernet connected devices.<br>
<br>
The thing that took the most time was the code for the master to
recognise which devices were on the '485 bus and filter accordingly
and the ring buffer for thexAP&nbsp; messages. The broadcast nature of
many xAP messages is both a blessing and a curse! The 'on the wire'
was native xAP. It seems a shame if there's lots of people
developing for RS485 but using a coded message structure that
there'll be no interoperability.<br>
<br>
If I was looking at 2 wire again, I'd go CAN BUS with a coded
structure, probably based on J1739/14 and not VSCP - which seems to
be in the doldrums from what I can see of the webpages but I may be
wrong.<br>
<br>
Lehane<br>
<br>
<br>
<br>
<br>
<br>
On 07/11/2011 02:27, <a class="moz-txt-link-abbreviated"
href="mailto:hillbillies@xxxxxxx";>hillbillies@xxxxxxx</a>
wrote:<br>
<span style="white-space: pre;">&gt; <br>
&gt; <br>
&gt; Hi Neil, My current thoughts are to send the whole xAP
message across<br>
&gt; the RS485 link. RS485 does not do a very good job of
detecting bus<br>
&gt; activity so I'm using the electrical specs from J1708. This
then<br>
&gt; allows me to use the code from the YASP project to do Carrier
Sense<br>
&gt; Multiple Access / Collision Detection (got the hint from
Paul's<br>
&gt; <a class="moz-txt-link-abbreviated" href="http://www.bazautomation.com";>www.bazautomation.com</a>
site). The xAP message decoding comes
from<br>
&gt; DBZoo's Arduino project. Hopefully this will all fit in a
ATmega32U4.<br>
&gt; The prototype board I'm working on is a Teensy from
<a class="moz-txt-link-abbreviated" href="http://www.pjrc.com";>www.pjrc.com</a>.<br>
&gt; <br>
&gt; Currently I have the J1708 interface working and the xAP
decode<br>
&gt; working. Hopefully in the next couple of days the transit
side will<br>
&gt; be working. Then I need a bridge - based on Patrick's serial
bridge<br>
&gt; that will interface to one of my boards to do the half duplex
message<br>
&gt; translation from ethernet.<br>
&gt; <br>
&gt; I decided that putting full xAP protocol over the wire was
going to<br>
&gt; be easier as then the PC end does not have to do any
conversions. I<br>
&gt; think that the bridge will only stop heartbeats, but
everything else<br>
&gt; will get through. The AVR can then decide what it wants to do
with<br>
&gt; the message. At the moment I think that I can limit the AVR
TX<br>
&gt; message length to 256 bytes and the receive length to 512
bytes<br>
&gt; (maybe longer once all the code is in the AVR).<br>
&gt; <br>
&gt; Cheers Alan NZ --- In <a
class="moz-txt-link-abbreviated" href="mailto:xAP_developer@xxxxxxx";>xAP_developer@xxxxxxx</a><br>
&gt; <a class="moz-txt-link-rfc2396E" href="mailto:xAP_developer%40yahoogroups.com";>&lt;mailto:xAP_developer%40yahoogroups.com&gt;</a>,
"Neil
Wrightson"<br>
&gt; <a class="moz-txt-link-rfc2396E" href="mailto:neilw@...";>&lt;neilw@...&gt;</a>
wrote:<br>
&gt;&gt; <br>
&gt;&gt; Hi Alan,<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; What RS485 protocol are you referring to?<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; I'm also doing some xAP stuff using AVR's. I'm creating a
gateway<br>
&gt;&gt; that converts between the Ethernet and the RS485
network.<br>
&gt;&gt; <br>
&gt;&gt; It uses a AVR (Mega128) as the go between. From here it
then talks<br>
&gt;&gt; to the RS485 AVR slaves using my own protocol.<br>
&gt;&gt; <br>
&gt;&gt; I found it easier to implememnt this way. Less xAP
actually on the<br>
&gt;&gt; RS485 network.<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; Regards,<br>
&gt;&gt; <br>
&gt;&gt; Neil Wrightson.<br>
&gt;&gt; <br>
&gt;&gt; Australia.<br>
&gt;&gt; <br>
&gt;&gt; From: <a class="moz-txt-link-abbreviated"
href="mailto:xAP_developer@xxxxxxx";>xAP_developer@xxxxxxx</a><br>
&gt;&gt; <a class="moz-txt-link-rfc2396E"
href="mailto:xAP_developer%40yahoogroups.com";>&lt;mailto:xAP_developer%40yahoogroups.com&gt;</a><br>
&gt;&gt; [<a class="moz-txt-link-freetext"
href="mailto:xAP_developer@xxxxxxx";>mailto:xAP_developer@xxxxxxx</a><br>
&gt;&gt; <a class="moz-txt-link-rfc2396E"
href="mailto:xAP_developer%40yahoogroups.com";>&lt;mailto:xAP_developer%40yahoogroups.com&gt;</a>]
On Behalf
Of<br>
&gt;&gt; hillbillies@... Sent: Monday, 7 November 2011 11:20 AM
To:<br>
&gt;&gt; <a class="moz-txt-link-abbreviated"
href="mailto:xAP_developer@xxxxxxx";>xAP_developer@xxxxxxx</a><br>
&gt;&gt; <a class="moz-txt-link-rfc2396E"
href="mailto:xAP_developer%40yahoogroups.com";>&lt;mailto:xAP_developer%40yahoogroups.com&gt;</a>
Subject:
[xAP_developer]<br>
&gt;&gt; CRC16<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; Hi Everybody,<br>
&gt;&gt; <br>
&gt;&gt; New to the group, I only started looking xAP about a
month ago.<br>
&gt;&gt; <br>
&gt;&gt; I'm developing a RS485 style network with AVR devices.
The wire<br>
&gt;&gt; protocol should allow me to detect collisions but I would
like to<br>
&gt;&gt; put CRC16 error checking into the devices. Although the
Protocol<br>
&gt;&gt; definition talks about CRC16, it doesn't state which
polynomial is<br>
&gt;&gt; the preferred one.<br>
&gt;&gt; <br>
&gt;&gt; The AVR libraries have have already coded:<br>
&gt;&gt; <br>
&gt;&gt; Optimized CRC-16 calculation. Polynomial: x^16 + x^15 +
x^2 + 1<br>
&gt;&gt; (0xa001) Initial value: 0xffff<br>
&gt;&gt; <br>
&gt;&gt; Optimized CRC-CCITT calculation. Polynomial: x^16 + x^12
+ x^5 + 1<br>
&gt;&gt; (0x8408) Initial value: 0xffff<br>
&gt;&gt; <br>
&gt;&gt; Optimized Dallas (now Maxim) iButton 8-bit CRC
calculation. <br>
&gt;&gt; Polynomial: x^8 + x^5 + x^4 + 1 (0x8C) Initial value:
0x0<br>
&gt;&gt; <br>
&gt;&gt; Optimized CRC-XMODEM calculation. Polynomial: x^16 + x^12
+ x^5 + 1<br>
&gt;&gt; (0x1021) Initial value: 0x0<br>
&gt;&gt; <br>
&gt;&gt; Can anyone give me a pointer on which way to go?<br>
&gt;&gt; <br>
&gt;&gt; Thanks<br>
&gt;&gt; <br>
&gt;&gt; Alan<br>
&gt;&gt; <br>
&gt; <br>
&gt; </span><br>
<br>
<br>




<!-- **begin egp html banner** -->

<br>



<br>

<!-- **end egp html banner** -->


<div width="1" style="color: white; clear:
both;"/>__._,_.___</div>

<!-- Start Recommendations -->
<!-- End Recommendations -->



<!-- **begin egp html banner** -->

<img src="http://geo.yahoo.com/serv?s=97476590/grpId=9629476/grpspId=1705007709/msgId=2217/stime=1320661866";
width="1" height="1"> <br>

<!-- **end egp html banner** -->


<!-- **begin egp html banner** -->

<br>
<div style="font-family: verdana; font-size: 77%; border-top: 1px
solid #666; padding: 5px 0;" >
Your email settings: Individual EmailTraditional <br>
<a href="http://groups.yahoo.com/group/xAP_developer/join;_ylc=X3oDMTJmZ3Q3bzY3BF9TAzk3NDc2NTkwBGdycElkAzk2Mjk0NzYEZ3Jwc3BJZAMxNzA1MDA3NzA5BHNlYwNmdHIEc2xrA3N0bmdzBHN0aW1lAzEzMjA2NjE4NjY-";>Change
settings via the Web</a> (Yahoo! ID required) <br>
Change settings via email: <a href="mailto:xAP_developer-digest@xxxxxxx?subject=Email
Delivery: Digest">Switch delivery to Daily Digest</a>  <a
href = "mailto:xAP_developer-fullfeatured@xxxxxxx?subject=Change
Delivery Format: Fully Featured">Switch to Fully Featured</a>
<br>
<a href="http://groups.yahoo.com/group/xAP_developer;_ylc=X3oDMTJkOTM4dHEwBF9TAzk3NDc2NTkwBGdycElkAzk2Mjk0NzYEZ3Jwc3BJZAMxNzA1MDA3NzA5BHNlYwNmdHIEc2xrA2hwZgRzdGltZQMxMzIwNjYxODY2";>
Visit Your Group
</a>
<a href="http://docs.yahoo.com/info/terms/";>
Yahoo! Groups Terms of Use
</a>
<a href="mailto:xAP_developer-unsubscribe@xxxxxxx?subject=Unsubscribe";>
Unsubscribe
</a>
<br>
</div>
<br>

<!-- **end egp html banner** -->


<div style="color: white; clear:
both;"/>__,_._,___</div>
</body>
</html>

--------------090204050601030403050208--

  • References:
xAP_Development Main Index | xAP_Development Thread Index | xAP_Development Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.