cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
7055
Views
1
Helpful
13
Replies
Highlighted
Enthusiast

IR 809 - how to use RS-485 serial port?

Hi guys,

I'm looking for some tips regarding how to properly use RS-485 serial port on IR 809

to connect to the MODBUS RTU sensor.

I followed the guides I've found, but the configs focused on RS-232. I've changed the media-type

to rs485 for the async 0 interface and set it to half-duplex.

I was not sure about the pinout for RS485. I followed this guide. According to the Table 8

PIN 1 should be RX/TX+  and PIN 2 should be RX/TX-.

http://www.cisco.com/c/en/us/td/docs/routers/access/800/809/hardware/install/guide/809hwinst/pview.html#70574

With this configuration my python app based on minimalmodbus module shows random garbage whenever

I try to read anything from /dev/ttyS1. Funny thing is that it reads random garbage from /dev/ttyS1 even when

there's no connection at all.

I verified the modbus sensor in my previous project based on 819, thus I'm sure that sensor works good.

<code>

import minimalmodbus

import serial

import time

instrument = minimalmodbus.Instrument('/dev/ttyS1', 1)

instrument.serial.baudrate = 9600

instrument.serial.bytesize = 8

instrument.serial.parity   = serial.PARITY_NONE

instrument.serial.stopbits = 2

instrument.serial.timeout  = 1

instrument.mode = minimalmodbus.MODE_RTU

temperature = instrument.read_register(5,2,4)

</code>

<error>

ValueError: Checksum error in rtu mode: '\x04\x00' instead of 'e\xc1' . The response is: '\x00\x00\x04\x00\x00\x04\x00' (plain response: '\x00\x00\x04\x00\x00\x04\x00')

</error>

13 REPLIES 13
Highlighted
Beginner

Hi gkujawsk,

with the pins and the interface you are fine. Which version of IOS/GOS do you have installed? It did not work for me  until I had ir800-universalk9-bundle.SSA.156-1.0.08.GB installed.

Also check the config in IOS if you have the following: (I am not so familiar with it though)

interface Async0

no ip address

encapsulation relay-line

half-duplex

media-type rs485

Hope this helps,

Marcos.

Highlighted

Hi Marcos,

I assume that configuration wise l'm ok.

The newest IOS and the newest GOS.

Mine setup of async is the same as you suggest.

Since I have rs485 bus I use half-duplex. According to docs in physical layer I use pins 1 and 2 of s0 port.

I enabled service internal and have test ir800 line 1 command available.

My basic python script use minimalmodbus module. When async 0 is set to half-duplex whenever I write a modbus command to /dev/ttyS1 in response I receive some garbage (not the modbus response for sure). Funny thing is that I get more or less the same garbage when serial 0 is not wired up at all. This makes me feel that rs485 need some specific handling in python code than rs232.

I'm lost. Any suggestions are more than welcome.

Sent from my iPhone

Highlighted

Hi, it should work for IR829 with RS485 for Python (pyserial and MinimalModbus). Actually we did some test and it works well.  Hope it helps. Thanks.

Highlighted

Hi Steve

Can you supply a copy of the device configuration and Python code that you used for your tests please?

Many thanks

Nathan

Highlighted

Hi,

After a couple of weeks I tried again with newest IR 809 software on board.

Here's my python script

http://pastebin.com/0RvNXBDL

Here's my config:

http://pastebin.com/v9J9QmeJ

And the script works only for 30-60 seconds. Then transmission stalls.

If I shut/no shut the async 0 interface it works again for another 30-60 seconds

or longer. I looks like IOS do not flush data because output counters for bytes

on async 0 interface increments, but there's no transmission on physical interface.

I've check it out by connecting my Mac and the modbus device to async 0 interface.

Only thing that helps for a moment or two is async 0 interface restart.

Here's the output from the script:

http://pastebin.com/qArsXXbG

Any suggestions? I found the ugliest hack that works for me.

It's a script below that restarts the async 0 interface, but really is this the only way?

tclsh

while {1} {

after 2000

ios_config "int async 0" "shut" "no shut"

}

PS. I'm sure that queried modbus device works correctly. I've checked many times

reading it from my Mac.

Highlighted

The configuration should be correct. (Accessing Serial Interface on IR829 through GOS)

Is there some problem for your code? It works well to access Modbus RTU at my side. Here are some codes for your reference. And for the troubleshooting, you may check the status of the Async 0with the IOS command of "show interfaces async 0" to see package input and output.

instrument = minimalmodbus.Instrument('/dev/ttyS1', 1)

instrument.serial.baudrate = 9600

instrument.serial.timeout = 1.0

while True:

    temp = instrument.read_register(0, 0)

    time.sleep(1)

Highlighted

Hi Steve,

The issue is not with the python script. The script works correctly and queries the modbus device in 5 sec interval.

The only caveat is that it works for some time and then fails to read the device. According to mine troubleshooting

session script fails because the router stops to TX data on async 0 interface. I used the topology below to verify

this. I've connected mine Mac, IR 809 and modbus device to RS485 bus. This way I can sniff RS485! Using this setup

I've verified that when script fails, IR 809 stops to TX data at all. Despite there's no TX data on the bus,

the counters for output bytes shown in "show interface async 0" still increments with every instrument.read_register.

This all seems a little strange and I cannot find the reason why IR 809 behaves this way. Any other ideas how to

troubleshoot this issue further?

Mac -> RS485 <- async 0 IR 809

               |

        modbus device

Can you share with me your IR 809 config? Maybe there's something missing I cannot find.

--

/G

Highlighted

Hi Gabriel,

I am using an IR829. And I am sending you a mail for the config offline.

Highlighted

Hello,

 

Have you managed to resolve this problem? I am trying to troubleshoot the same behavior and you will help me with any information you have about this.

 

Thank you,
Andrei

Highlighted

Hi,

I am trying to access the serial port RS485 with  modbus. I have used the same python script as yours except that I have changed the baudrate to 19200. I have also configured the media-type to rs485 for async0.

I have used the RJ45 to DB9 cable. Can someone please verify whether this cable will work with IR809 or not. If it does, can you tell me the pin configuration.I have attached the cable pic here.

But when I run the program,I can only see some garbage values.

download.jpg

Highlighted

No. It is NOT the Cisco Blue Cable. The Cisco RJ45-to-DB9 Serial Console Cable (blue cable) does NOT follow the EIA-561 standard, and is not compatible with CGR1240 and IR829 RJ45 serial ports. For details, please refer to Accessing Serial Interface on IR829 through GOS.

Highlighted

Thank you for the reply Steve.

I checked your link but I am still unable to receive data on serial port. I am using the BABY BLUE colored cable in IR809.

Can you please guide me regarding which cable to use and details regarding the connection. It would be better if you could provide a picture regarding the same. Also, can I make the cable using RJ45 or DB9 cable in-house?

Highlighted

Two RJ45 serial ports are provided to control and monitor RS232 or RS485 equipment. Serial port 0 can be configured for either RS232 DCE or RS485. Serial port 1 can be configured for RS232 DTE only.

The RJ45 serial ports of the IR809 match the RJ45 serial ports for the IR829 router. There is a complete section in the IR829 Hardware Installation Guide that covers port characteristics, cabling, pinouts and much more. Go to the following URL for additional information:https:/​/​www.cisco.com/​c/​en/​us/​td/​docs/​routers/​access/​800/​829/​hardware/​install/​guide/​829hwinst/​pview.html#85723

Content for Community-Ad

This widget could not be displayed.