AB Serial DF1 CRC Check

Nitay

Member
Join Date
Dec 2011
Location
Israel
Posts
14
Hello Everyone,

I'm trying to communicate with the SLC500 through Serial DF1 and I'm having some difficulties:
1st: I didn't quite get the difference between the Half Duplex and Full Duplex mode - When do i use one and when do i use the other? How do i know which one I'm using? I'm communicating through RS232.

2nd: I'm trying to implement CRC for communication, and I can't figure out what does this algorithm supposed to get me - It seems to converge on 0xFFFF when I have enough bits. I've attached the algorithm I found on the Serial DF1 manual (DF1 Protocol and Command Set Reference Manual)

Any help will be greatly appreciated!

Thank You
Nitay

Capture.jpg
 
Hello,

Half and full duplex in DF1 are the same as for plain serial communications. Look up the terms on the web or look in the manual on page 2-2 to 2-4.

As for the CRC, you failed to include the next portion of the page. The validation frame.

Use this frame to validate the CRC
10 02 07 11 41 00 53 B9 00 00 00 00 00 00 00 00 00 00 00 00 10 03 6B 4C

The manual provides a frame with the correct CRC. If your code does not produce the same CRC, you have an error in your code.
 
Hello Mark, and thanks for your answer,

The CRC, if I understood the document correctly, is supposed to run on the data bytes + the DLE, ETX, right?

Attached are the bytes I'm supposed to run CRC on

Did i get it right?

Thanks
Nitay

Capture.PNG
 
Hi,

No.

Per the manual, page 5-3:

The BCC/CRC field contains ...all application layer data bytes between the DLE STX and the DLE ETX
 
Hello again Mark,

On the algorithm (attached on the first post) it is stated that:
"all link layer data, ETX"
But as you said, on 5-3 they say differently.

Anyway - Just to make sure:

The bytes that should be included in the CRC test should be these:
07 11 41 00 53 B9 00 00 00 00 00 00 00 00 00 00 00 00

And the CRC should be
6B 4C

Is that correct?

Thanks for your help,
Nitay
 
Hi,

No. They both are the same. You are confusing the link layer frame and the link layer data. The data is between the dle stx and the dle etx. The dle stx and dle etx are the frame, not the data.

>The bytes...

Yes, just the data.
 
Hi again,

Sorry for the ignorance - But the algorithm states "right" and "left" bits. Is the SLC little-endian or big-endian? When they say "rightmost" bits - Does it mean the lsbit on the LSByte? or the lsbit on the MSByte?

Thanks
Nitay
 
Hi,

I entered 'right' in the PDF and searched for whole words only and found your answer.
 
Hello,

I've been all over this document... And implemented as described in it.

I'm getting the right results (Same as several CRC calculators I found on the net) - But they are not the same as the SLCs.

Did anyone manage to do implement the CRC properly? Could you please share the code?

Thank You
Nitay
 
Hi,

OK, the CRC generator is good. Are you handling the protocol correctly? For example, are you handling a DLE DLE?
 
The part that always got me was in Publication 1770-RM516 on page 5-6, right at the top: "using the value of the link layer data bytes and the ETX byte"

The reference manual has just finished repeating "the data link layer bytes between DLE STX and DLE ETX" several times, and then they drop that little hint in there that you add ETX to the end of the data link layer bytes for the CRC calculation.

07 11 41 00 53 B9 00 00 00 00 00 00 00 00 00 00 00 00 CRC is incorrect, 0xEBED
07 11 41 00 53 B9 00 00 00 00 00 00 00 00 00 00 00 00 03 CRC is correct 0X4C6B


I can't even take credit for noticing this; Lynn Linse (of Digi and Lantronix fame) pointed it out to me.


The CRC generator I use for reference is this one: http://www.lammertbies.nl/comm/info/crc-calculation.html
 
YES - That was it. I didn't include the ETX on the end.

Tricky one!

Thanks for your help Ken & Mark! And thanks to Lynn Linse!
 
Hi,

Sorry I missed that.

I am using a lookup table and I looked at the code and it was only using the data bytes (passing just the data bytes to the CRC function). I just went and looked at the CRC code and it adds in the ETX for the CRC calc.
 

Similar Topics

Hi Guys. On a location, I have an L33ER running an Oil Battery. one of the ethernet is for HMI, programming connections. the other is being used...
Replies
4
Views
2,458
problem in communication between micrologix 1200 & Panel View 600 Plus by serial DF1 Hello Friends i have to do communication between micrologix...
Replies
6
Views
6,612
Hi All, Does anyone know of any simple utilities for testing DF1 comms? I have a remote site several hundred kms away where a 3rd party...
Replies
2
Views
2,169
We have an HMI that when an application is loaded the HMI it asks if you want to change the terminal configuration settings to match the...
Replies
4
Views
3,157
Hi, I have a project using a panel view plus 1000 communicating using kepware over Modbus RTU serial. Initially I was getting a com1 OS 12 error...
Replies
5
Views
2,467
Back
Top Bottom