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?

14
  • 1
    lsusb will show devices connected to USB. lsusb -v will show detail.check /dev/tty* before and after inserting the device, although not all devices identify as tty. Forget /dev/ttyS0 and /dev/ttyAMA0 which are Pi GPIO ports.
    – Milliways
    Commented Nov 12, 2019 at 5:48
  • 1
    Actually you don't need any python program to do loopback tests You can use Rpi miniCom, miniTerm, puTTY, cuteCom etc. I recommend Rpi cuteCom. For Win10, I recommend RealTerm. You might like to see my Rpi USB Serial 0 cuteCom loopback test results: imgur.com/gallery/CiMpie3.
    – tlfong01
    Commented Nov 12, 2019 at 7:31
  • 1
    @tlfong01 lol the most info I can get about the RS232 port on this projector seems to be: "RS-232 serial control9 pin x 1" and that "RS232 DB-9pin" from various data sheets. I can't find a pinout of it anywhere.
    – ledhed2222
    Commented Nov 13, 2019 at 3:19
  • 1
    but FWIW this is a benq W1070 projector. how would I perform a loopback test directly in linux terminal? I tried screen /dev/ttyUSB0 115200 but I receive no output
    – ledhed2222
    Commented Nov 13, 2019 at 3:37
  • 1
    See answer below :) I was being a dummy.
    – ledhed2222
    Commented Nov 13, 2019 at 6:17

2 Answers 2

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

3
  • Ah, I read your answer after I gave my last comments. About /dev/ttyUSB0 etc, usually you can begin with your terminal command with "sudo", then you should get permission to serial things. For python programming, you can read my long program to just to pay attention to the following: (1) try <CR> or <CR> <LF> etc to end a command. (2) flush buffer before sending/receiving byte strings. Good luck and cheers. :)
    – tlfong01
    Commented Nov 13, 2019 at 6:23
  • I read BenQ user guide and found that the power on command is different from Panasonic. It is like this: "<CR>*pow=on#<CR>". Bye.
    – tlfong01
    Commented Nov 13, 2019 at 6:26
  • Please accept your answer with a click on the tick on its left side. This will finish the question and it will not pop up again after months.
    – Ingo
    Commented Nov 22, 2019 at 10:56
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

5
  • 1
    I've written a python script to test this as well. It writes to /dev/ttyS0 and then reads from it after a second. The result is the same, because the issue is more fundamental. If I can't echo and cat from this port I don't see how this would work.
    – ledhed2222
    Commented Nov 12, 2019 at 5:45
  • 1
    First check which usb port occupied by using this command cd /dev/ after insert usb and check whether it is occupied usb0 or usb1. After that install pyserial package. later i will send the code Commented Nov 12, 2019 at 5:54
  • 1
    It's /dev/ttyUSB0 (as you can see above from the output of dmesg). The script I'm using uses pyserial. Feel free to send your code but I don't see how it will result in anything different :)
    – ledhed2222
    Commented Nov 12, 2019 at 6:14
  • yes...this is what i've tried prior to this. it doesn't do anything.
    – ledhed2222
    Commented Nov 12, 2019 at 19:12
  • commands may be different use proper commands then it works Commented Nov 13, 2019 at 5:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.