I’m trying to establish a serial communication between my Raspberry PI 3 B+ – running on Raspbian 10 Buster – and a testing machine I have. The normal behavior of the machine is to send test related data via serial as soon as a test is finished.
I managed to establish the communication in Windows 10 through PuttY using a USB to Serial adapter and it worked fine. However, with the Raspberry I didn’t manage to make the communication work.
The setup is as follows: the USB end of the adapter is connected to one of the Raspberry’s USB slots, and the RS232 end is connected to my machine. In the Raspberry’s side, the USB was given the /dev/ttyUSB0 device name. Here is the output of
dmesg | tail:
[ 2702.802083] usb 1-1.1.3: new full-speed USB device number 6 using dwc_otg [ 2702.934357] usb 1-1.1.3: New USB device found, idVendor=067b, idProduct=2303, bcdDevice= 4.00 [ 2702.934373] usb 1-1.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 2702.934383] usb 1-1.1.3: Product: USB-Serial Controller D [ 2702.934393] usb 1-1.1.3: Manufacturer: Prolific Technology Inc. [ 2702.935304] pl2303 1-1.1.3:1.0: pl2303 converter detected [ 2702.939720] usb 1-1.1.3: pl2303 converter now attached to ttyUSB0
I already tried using
minicom, and setting them up with
9600 8N1, but they just hang after establishing the connection. The ttyUSB0 is configured as shown bellow:
pi@raspberrypi:~ $ stty -F /dev/ttyUSB0 speed 9600 baud; line = 0; min = 100; time = 2; -icrnl -imaxbel -opost -onlcr -isig -icanon -echo
After doing a bit of research, i found that I could try doing
cat -v < /dev/ttyUSB0 in one terminal emulator, then opening another one and entering
echo "hello\r" > /dev/ttyUSB0; this didn’t give me anything in the cat terminal, though. Could it be that – because one end of the cable is connected to the Raspberry and the other to the machine – I cannot communicate with myself locally?
Could anyone help me? I’m really stuck here.
How to send a machine’s test results to Rpi3B+ buster USB to serial port (5V TTY) .
Machine can send test results to Win10 PuttY, using WinPC USB to serial (5VTTY) (not RS232 +-12V adapter/cable)
Rpi3B+ buster 5V USB hub USB to serial port (/dev/ttyUSB0 9600 N81) does not seem to get the data from the machine.
The OP’s project development methodology is sort of incremental/continuous test/prototyping based, and consists of 2 steps:
(1) Read machine test results by WinPC PuTTY, using USB to serial cable.
(2) Read machine test results by Rpi buster, also using USB to serial cable, with terminal commands “cat”, and “echo”
I would suggest the OP to do the following:
(1) Write short python test programs instead of bash commands.
(2) Do loop back test for Rpi USB to serial cable setup, to make sure Rpi internal serial hardware and setup is OK.
(3) Put the test machine aside, do the WinPC to Rpi loop back test, to make sure Rpi serial to external
(1) My IR Transceiver (LIRC) Project
These couple of months I have been doing a couple of home automation projects using sensors (temperature, humidity, pressure etc) and actuators (relays and solenoid, and motor etc). I mainly use I2C, SPI, and UART. My basic project development approach is similar to the OP.
The most recent project is IR transceiver. I am using the same approach as the OP.
(a) Use Win10 RealTerm to do loop back test,
(b) Use Rpi UART (on board TxD, and RxD pins, both 3V3 and stepped up 5V0) and two USB to serial cables. All three serial ports can local echo, and also port to port echo.
(c) Win10 RealTerm send/receive to IR transceiver.
(d) Rpi buster pythong serial send/receive to IR transceiver.
.END of Answer
/ to continue, …