View previous topic :: View next topic |
Author |
Message |
rwskinner
Joined: 08 Dec 2006 Posts: 125 Location: Texas
|
CCS Modbus RTU Slave Lib. |
Posted: Mon Aug 27, 2012 10:31 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Aug 27, 2012 12:49 pm |
|
|
CRC checking is done in the timer interrupt. |
|
![](templates/subSilver/images/spacer.gif) |
rwskinner
Joined: 08 Dec 2006 Posts: 125 Location: Texas
|
|
Posted: Wed Nov 14, 2012 4:56 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
rwskinner
Joined: 08 Dec 2006 Posts: 125 Location: Texas
|
|
Posted: Wed Nov 14, 2012 5:14 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Nov 15, 2012 12:49 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
|