Testing serial port

I would like to send some test data from the Yun to my PC. I've have a USB to serial adapter in the Yun and female/female cable connecting to the PC with another serial to USB adapter.

I've set the PC baud rate to 19200, I'm listening with Putty on the PC, I want to send something to the Yun serial port, but first how do I set the baud rate on the Yun ? stty isn't available.

I plan to do something like ls -l >/dev/ATH0

Thank you

You can install it: coreutils-stty; the /dev/ATH0 device runs at 250000 baud.

kind regards,

Jos

Thank you, will take a look

I think this is what you are hooking up:
Yun USB host port <-> USB serial adapter <-> serial USB adapter <-> PC USB port
Correct?

If so the device you want will probably be on /dev/ttyUSB0 on the yun side, that’s were a ftdi adapter shows up on my Ubuntu box, I haven’t plugged it into the yun. In any case /dev/ATH0 is the connection to the 32u4.

If you ls /dev/tty* before and after you plug the adapter in whatever is new is the one you are looking for.

Before connecting:

crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS13
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyATH0
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS15
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS14
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS12
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS11
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS10
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS9
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS8
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS7
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS6
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS5
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS4
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS3
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS2
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS1
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS0
crw-rw-rw-    0 0        0               0 Jan  1  1970 tty

Then connected USB to Serial adapter and power cycled Yun, after:

crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS11
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyATH0
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS15
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS14
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS13
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS12
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS10
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS9
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS8
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS7
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS6
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS5
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS4
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS3
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS2
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS1
crw-rw-rw-    0 0        0               0 Jan  1  1970 ttyS0
crw-rw-rw-    0 0        0               0 Jan  1  1970 tty

18 tty devices before and 18 after…I’ve tried 3 different USB to Serial adapters and the result is the same everytime.

DOH!, I should have known you need kmod-usb-serial-ftdi (if you have a ftdi adapter). No need to cycle power, the device file will appear and disappear when (un)plugging. You can watch what happens with dmesg.

So here is what I see with a device that uses a FT232 :

root@Arduino:~# ls /dev/tty*
/dev/tty      /dev/ttyS1    /dev/ttyS12   /dev/ttyS15   /dev/ttyS4    /dev/ttyS7
/dev/ttyATH0  /dev/ttyS10   /dev/ttyS13   /dev/ttyS2    /dev/ttyS5    /dev/ttyS8
/dev/ttyS0    /dev/ttyS11   /dev/ttyS14   /dev/ttyS3    /dev/ttyS6    /dev/ttyS9
root@Arduino:~# opkg update
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/attitude_adjustment.
Downloading http://downloads.arduino.cc/openwrtyun/1/packages/Packages.sig.
Signature check passed.
root@Arduino:~# opkg install kmod-usb-serial-ftdi
Package kmod-usb-serial-ftdi (3.3.8-1) installed in root is up to date.
root@Arduino:~# ls /dev/tty*
/dev/tty      /dev/ttyS1    /dev/ttyS12   /dev/ttyS15   /dev/ttyS4    /dev/ttyS7    /dev/ttyUSB0
/dev/ttyATH0  /dev/ttyS10   /dev/ttyS13   /dev/ttyS2    /dev/ttyS5    /dev/ttyS8
/dev/ttyS0    /dev/ttyS11   /dev/ttyS14   /dev/ttyS3    /dev/ttyS6    /dev/ttyS9
root@Arduino:~#

For testing:

echo "one, two, three, testing, one, two, three" >/dev/ttyUSB0 will send a string out on serial

echo "one, two, three, testing, one, two, three" >/tmp/teststring
cat /tmp/teststring >/dev/ttyUSB0

will send the contents of a file out on serial

Consider installing picocom on the Yun, then you should be able connect to a terminal session (PuTTY?) on the Windows box on the other end of the cable with something like:picocom -b 19200 /dev/ttyUSB0

Thank you, will give it a try and repeat tests now....it worked :slight_smile:

ttyUSB0 now appears.

I am trying to install stty can you help me.
or picocom