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 CCS Technical Support

CCS Modbus RTU Slave Lib.

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



Joined: 08 Dec 2006
Posts: 125
Location: Texas

View user's profile Send private message

CCS Modbus RTU Slave Lib.
PostPosted: Mon Aug 27, 2012 10:31 am     Reply with quote

I must be overlooking it, but I'm looking at the CCS Modbus library and I can see where the RTU messages coming in calculate the CRC for the inbound RTU messages but I do not see anywhere where the CCS lib is comparing the crc's and exiting if it's not valid. I just see the modbus_calc_crc called and that is all.


I see where the CRC is calculated and added to returning messages and that part is fine.

Richard
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Aug 27, 2012 12:49 pm     Reply with quote

CRC checking is done in the timer interrupt.
rwskinner



Joined: 08 Dec 2006
Posts: 125
Location: Texas

View user's profile Send private message

PostPosted: Wed Nov 14, 2012 4:56 pm     Reply with quote

I see timer2 interrupt which is nothing to do with it and I see the incoming_modbus_serial function that is pretty much a state machine.

In the incoming_modbus-Serial for RTU Slave, I see
GetAddy
GetFunct
GetData

Then modbus_calc_crc(c) which takes each char and
calculates crc and updates modbus_serial_crc.b

I still do not see where it compares the crc attached to the end of the rtu string versus the calculated crc from each char actually received.

Richard
rwskinner



Joined: 08 Dec 2006
Posts: 125
Location: Texas

View user's profile Send private message

PostPosted: Wed Nov 14, 2012 5:14 pm     Reply with quote

Okay, what I am after is some diagnostic output of a device we are bench testing. When 3 or 4 devices get on the line, the device with the CCS Modbus RTU slave quits responding.

The customer has some added protection on his 485 device that causes these errors and when we remove them, all is fine so I think it's causing some timing issues but it is not apparent on the scope. We can't just remove them and leave them off because of CSA certification.

The scope on the 485 chip shows good data coming into the 485 chip and leaving the 485 chip so that is okay and the message timing is pretty much dead on.

I guess the best way for me to do this is print each character received out another serial port if I have the pins so I can see what is seen versus what is sent.

The CCS code is hard to read because of a million #if statements and such and it's hard to wrap my head around what the programmer was thinking.


Richard
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Nov 15, 2012 12:49 am     Reply with quote

First comment, I didn't use yet the "new" modular CCS MODBUS library with TCP support. Thus I'm not aware
of possible problems involved. The old library is pretty straightforward.

Quote:
Okay, what I am after is some diagnostic output of a device we are bench testing. When 3 or 4 devices get on the line, the device with the CSS Modbus RTU slave quits responding.


I wonder what this means. Either your hardware is ignoring the RS-485 requirements or there's a specific
problem with the CCS MODBUS PHY layer. In any case, you should narrow down the fault and found
out at which phase of the MODBUS transaction it occurs.
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