-   Linux - Embedded & Single-board computer (
-   -   485 serial port (

IDEASeth 04-24-2013 04:21 PM

485 serial port
I am trying to get a 485 port on a Manx PC-104 board to work. This is suppose to be COM3 in Windows or TTYS2 in Linux. I have written a C-program to enable the 485 hardware transmitter and dump characters into the UART's transmit buffer. This works. I can see the 458 serial stream on an oscillascope <sic> so I know the hardware is OK.

But when I stop the C-program and then try to output using a Linux driver, it doesn't work -- nothing on the scope.

I have tried 2 approaches to stimulate the output:

--- I have used minicom, setting the device to /dev/ttyS2

--- I have tried this command or variations "echo UUUUUUUUUU > /dev/ttyS2".

setserial reports the device at the correct address with the correct IRQ. (0x3e8 and IRQ4)

"mesg | grep /dev/ttyS [01234] also confirms this.

Do I have to do something special, like "mounting" the device to /dev/ttyS2? If so how? What is the device "type" for the mount command?

jefro 04-24-2013 07:42 PM

No, you don't mount it. Linux has had 485 support for a while and many patches are available for different chips. 485 doesn't really work like 232-c so you have to use other means than a common serial uart setup or posix serial type apps.

This link may offer clues.

IDEASeth 04-25-2013 11:13 AM

If mountng is not required, what is? The article from Moxa goes into detail about the handshaking and need to control precisely when the transmitter turns off after each transmission. At this time, that is not my problem. It may be in the future, but not yet. Right now, I cannot get the transmitter to work at all using a Linux driver. (As I said, it's OK when I load the registers directly.) Simply stated how come the command "echo "UUUUUUUUUUUUU" >/dev/ttyS2" issued after the transmitter is enabled does not produce a stream of pulses on the TXD+/- lines?

theNbomr 04-27-2013 10:41 AM

The standard linux driver is probably hardware agnostic for anything beyond the UART. Whatever means you have employed to enable the transmitter is probably undone by the driver, since it was probably written with the expectation of supporting RS-232. You may be able to suppress this behavior. It may also be caused by the expectation of some modem control line such as CTS or CD to be enabled before it will transmit. This behavior may also be suppressed. It may be helpful to tell us specifially what driver is being used for your system. Since you said PC/104 & Windows, it seems probable that it is a standard 8250 UART family driver, but it is probably worth knowing for sure.
The device nodes '/dev/ttyS*' are created as part of the driver loading. I assume this is the basis of your question about 'mounting' (filesystem partitions on block devices are 'mounted'). That there is a device node for your hardware is pretty much sufficient to confirm that the driver is properly loaded.
May I suggest the use of C-Kermit to diagnose this problem? It has a fair degree of flexibility about how modem control and handshaking is used, and may at least help you determine the cause of your problem. From there, a solution may become evident.
--- rod.

All times are GMT -5. The time now is 06:29 PM.