2

I know there are similar posts on this topic, but I've scoured them all and haven't been able to figure this out. I'm trying to control my projector via a R232 port. I have a USB to R232 cable, specifically this one.

That's using the PL2303 chipset for RS232. I can't seem to get it to register anything on my Pi.

pi@raspberrypi:~ $ dmesg | grep tty
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:25:6C:54 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=f991b5bc-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
[    0.001276] console [tty1] enabled
[    1.062493] 20201000.serial: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2
[    1.070613] 20215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud = 31250000) is a 16550
[   16.242115] usb 1-1: pl2303 converter now attached to ttyUSB0

I've copied some python scripts to write to ttyS0 and read from ttyUSB0. I'm apparently able to write to ttyS0 but cannot read anything from ttyUSB0.

Even if I do

echo "hi" > /dev/ttyUSB0
cat /dev/ttyUSB0

I get nothing.

I have serial login disabled.

Is there a way I can determine if, for example, this device is defective?

tlfong01
  • 4,847
  • 3
  • 12
  • 24
ledhed2222
  • 141
  • 4

2 Answers2

2

OK I've realized what the issue is: mostly that I wasn't familiar enough with the strangeness of RS-232

Thanks @tlfong01 for linking me out to some sites that helped me understand a bit more.

First off, here is a generic description of all BenQ RS232 requirements. Comparing that generic pinout to the one shown in the Amazon product description it did seem like the cable is correctly wired for this port (with a crossover, if I understand this correctly). I figured I would just try and send some commands to the port and see what happened and...yes it works. Turns out that just sending plain strings to the serial port obviously wasn't doing anything, but if I sent a valid command that worked just fine.

So why didn't I just try my original application of this? Turns out on deeper investigation the system user I had configured to access /dev/ttyUSB0 for me did not have permissions to read from that port, which is why it didn't work all along.

Doh!

Thank you all for your help

ledhed2222
  • 141
  • 4
1

if you want to send the data from usb to rs232 in pi. Go for programming language. and it is easy to do it in python. import pyserial ser = serial.Serial('/dev/ttyUSB0', baudrate=19200, parity=serial.PARITY_NONE, stopbits=1, timeout=5) ser.write(b'enter your command') #for write ser.read(b'enter your command') #for read