CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Is checksum a good idea for a single master RS 485 network ?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

Is checksum a good idea for a single master RS 485 network ?
PostPosted: Wed Jul 25, 2007 11:40 pm     Reply with quote

Hi,
MCU: 16F648A,16F877A
PCM 3.228

I am trying to implement a RS 485 network system, which contains one master and several slaves, (using SN 75LBC184 ). The network is 3 wire (including ground).

In the above network there can be only one master that initiates all conversations, all communications is between the master and the slave(s).

My question is do I need to send a checksum along with the data ?, I believe checksum are useful only when there are several masters in the network, as the chances of collisions are greater then...

Please advise...

I would also like to know if there is there is any industrial standard for the RS 485 network (apart from MODBUS) , I have seen several equipments on the net, although they mention RS 485- 2 , 3, 4 wire , they do not specify the nitty gritties of transmission like how many bytes a node address is or whether to send the source address first or destination address first.

Example sites: www.westinstruments.com

thanks
arunb
Ttelmah
Guest







PostPosted: Thu Jul 26, 2007 3:04 am     Reply with quote

Depends totally on how important data reliabilty is.
Multi master, _increases the probability of a corupted packet_, but the probability is still present in a single master configuration, depending on the noise levels on the link.
The question then is what you do, if a packet is damaged. If you can request a retransmission, you also need to consider the 'costs' involved in asking for a packet to be sent again. If (for instance), doing this takes significant time (radio links etc.), then it is normally 'better' to instead use an ECC protocol.

Best Wishes
Ken Johnson



Joined: 23 Mar 2006
Posts: 197
Location: Lewisburg, WV

View user's profile Send private message

PostPosted: Thu Jul 26, 2007 7:13 am     Reply with quote

I always use a checksum, even when sending ASCII data (checksum is encoded as 2-byte hex number). That said, I've never seen the "checksum error" flag, except during development, when I didn't calculate it right.

But, I still always use it, just for peace of mind.

Ken
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Thu Jul 26, 2007 8:20 am     Reply with quote

During testing I find it always a setback not to be able to quickly test my serially connected devices with a simple terminal program on a PC because they would require a checksum in the command sequence. I was always too lazy to calculate it by hand during testing, so this scenario has often led to a protocol without a checksum, or a not fully tested operation.

My solution to this is a joker-chekcksum of two ** characters or the EOF/EOL (or whatever marks the end of transmission) character itself for example. Seeing these special characters the device skips the checksum calculation, but seeing a normal checksum value (ie. any other characters) it's got checked.


Last edited by libor on Thu Jul 26, 2007 8:25 am; edited 2 times in total
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

Re: Is checksum a good idea for a single master RS 485 netwo
PostPosted: Thu Jul 26, 2007 8:24 am     Reply with quote

exactly what ken said..
I always use and and I never see an error unless I'm doing something
wrong. In my protocol, my master controls which slave talks, and there
is a defined 5m Sec idle bus time between packets. and 15m Sec between messages. (i define a message as mutiple packets)

pkt0 5ms pkt1 5ms pkt2 15ms
(response)pkt0 15ms
my packet looks like this
Code:

struct  packet{// Header(first 5 bytes), data(up to 26 bytes), chksum
  BYTE DA;     // Desgination address recieved
  BYTE size;   // Number of bytes. NOT counting header and chksum
  BYTE func;   // Function code of packet
  BYTE seq;    // This is the n packet of the total
  BYTE total;  // Total number of packets in message
  BYTE data[MAXDATA];// Data, size is the number of bytes
  BYTE CS;     // A checksum over the entire pkt.
  BYTE calcCS; // This checksum is calculated as data is recieved
  BYTE state;//0=available,1=filling,2=full,3=good
}pkt;
Ttelmah
Guest







PostPosted: Thu Jul 26, 2007 9:29 am     Reply with quote

The answer to the question about people using RS485, 'without giving details of the packet', is that the two things are separate. RS485, just like RS232, is a description of the signalling levels used, not what is being sent in data terms. Modbus, Profibus etc., use RS485 signalling, but are then a description of the packet format used over this. Tens of thousands of bits of kit exist, using RS485 signalling, and most will not tell you what they send, until you either read the data sheet, or in some cases, sign a non-disclosure agreement...
The 'concept' of node addresses, does not inherently exist in RS485 itself.
I have seen significant numbers of checksum errors on a fully working system. However my systems tend to be in high noise enviroments. As an example, some of my systems run in conduit, across airfields, and these will get data corruption fairly repeatably, when the ground radar interrogates the area...

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group