Serial ports in Linux - linux

So I need to read some streaming data from /dev/ttyACM0 in Ubuntu.
However I'm a Windows guys so I'm looking for something like PuTTY so I can point, click and make my problem go away.
How do I get streaming data from a com port, or in this case /dev/ttyACM0 which is a USB cable working as CDC? I just want to confirm that the device is sending what I think it should be sending.

Apparently putty is available on Ubuntu https://apps.ubuntu.com/cat/applications/saucy/putty/ . So, if you installed that you may get the same user experience you are used to from Windows. Alternatively minicom is probably one of the most common alternative ( http://processors.wiki.ti.com/index.php/Setting_up_Minicom_in_Ubuntu ).

Related

LittleBits Arduino doesn't work on Linux

I recently received a LittleBits Arduino Coding Kit and thought the Arduino IDE would immediately recognize it.
I noticed that when I choose the "Arduino Leonardo" on the Tools -> Board as the instruction video said to do, the Tools -> Serial Port menu is grayed out.
I have already added myself to the "dialout" and "uucp" groups, ran the "arduino" program as root, ran a whole bunch of commands dealing with permissions, restarted the computer, plugged it into all the ports, reinstalled the drivers, and tried everything else I came across. For some reason, I can't figure out how to get this to work.
I use Xubuntu on an i686 architecture by the way, if that even matters.
I think you don't have permissions to read/write the serial port device. Even running Arduino application as root, it's running on a Java JVM, and calls other programs to compile sketches and burn the board... it's hard to figure out what's happening in the background. Also, is not a good idea to run programs as roout unless necessary.
Try this. First list your serial port devices.
ls -l /dev/tty*
There's should be one called /dev/ttyUSB0 or /dev/ttyACM0 or something like that (not /dev/ttySx). That one is your Arduino. Add read/write permissions for every user to that device file.
sudo chmod 666 /dev/ttyUSB0
Use the device you have. Now run the Arduino IDE, if the issue is with permissions, then it's done. Unfortunately, you'll have to do this every time you unplug the board or reboot the system.

Serial port comms only working in one direction

I am working with a SOM mounted on a carrier board running Ubuntu 14.04 with the generic 3.13 kernel.
While testing out the peripherals, I hit a problem with serial communication.
Basically, I can transmit data from the custom platform to an external Linux machine, but I can not properly receive data from the external Linux machine to the custom platform.
Through my research I have messed with all sorts of BIOS settings, baud rates, hardware flow control, parity, etc. Nothing has worked. Most info I have found online just says "Make sure your baud rates and other settings match", and they do. It is not my first time working with Linux serial ports. But it is my first time encountering a problem like this.
Does anyone have any suggestions, recommendations, or has anyone ever seen an issue like this before?
More info: We are running a quad-core Intel Atom micro with a custom serial breakout interface. The serial port is at /dev/ttyS0.
EDIT (clarification):
If I set up a session in Picocom or Minicom, I can send characters from our custom platform (running Ubuntu 14.04) to another Linux PC (also running Ubuntu 14.04). However, if I try to send characters from the Linux PC to our custom board, I sometimes get nothing, and other times get unrecognized characters (they show up as bubbles with question marks in them).
I can also simply echo a string to /dev/ttyS0 on the custom platform and receive it on the Linux PC. I just can't get it to work the other way around.

Bluetooth for ARM embedded linux

I'm struggling now for a few days to setup bluetooth services on an ARM embedded device running Linux. I'm using a bluetooth dongle connected via USB.
Let's start with the beginning. I had to compile myself all the required packages, and that means expat, dbus, zlib, libffi, glib, bluez-3.36-libs and bluez-3.36-utils (yeah 3.36, I know they're old but so is my cross-compiler), libopenobex-1.3, obexd-0.3, obexftp. Then I put the binaries and libs on the device. Also, bluetooth is enabled in kernel.
I'm able to activate the bluetooth using hciconfig hci0 up command, I can perform scan using hcitool scan, I can even ping with l2ping previously discovered devices.
What I want is to be able to transfer files between that ARM device and another bluetooth device using ftp protocol and here my problems begin.
Are these the only tools that I need?
After putting everything on the device, I turn on bluetooth using hciconfig hci0 up, then I start dbus daemon using dbus-launch and after these I try to start obexd. When I run dbus-launch, it prints the values for DBUS_SESSION_BUS_ADDRESS and some pid and next when I try to start obexd it asks me to set the DBUS_SESSION_BUS_ADDRESS. Is this normal because I read that you have to set this only for test purposes? What is the default (real) dbus session bus address? How should I properly configure dbus?
I tend to think that the problem is in the pairing process, when the two bluetooth devices are trying to authenticate. How can I do this from command line as this is all that I have (no GUI)?
Could you please present me the detailed step to follow in order to achieve my goal. I tried to learn more about them from the Internet and also I tried to find these steps online but I could not find what I need.
Could you please explain me the difference between obexd, obexd-client, obexd-server, obex-data-server, obexftp? Are they meant to be used together or they offer the same functionalities? I could not clarify this from their man pages.
I know this is a really long post with a lot of questions, but I don't have experience with bluetooth and I'm under time pressure to solve this. Any help would be kindly appreciated.
Many questions you raised, but will try to answer them :
Thatz pretty much everything you will need.
Why are you starting session bus ? Will not starting system bus help and hcid uses system bus( as far as i know ). You need to execute the cross-compiled obexd ( or any other utility) with correct parameters.
you can use simple-agent ( it is in tools dir in 3.36 release if i am not wrong ). In a non-gui mode ( simple-agent --default [ follower by your pincode ] ) will work.
Basically you will need to find a device ( do scan ), authenticate ( pair ) and then proceed with file transfer which will involve obex level request / response ( to put in simple words).
As much i know, initially obexftp / obex-push were the only standalone utilities that worked on top of openobex for file transfer. Obex-data-serer was developed as part of GSOC competition, which got included in major distros. obexd is the slimmer version of obex-data-server specifically designed for embedded usage and is closely integrated with hcid ( and bluetoothd later). Please use only one of the utilities and not all at same time.

Ada GNAT.Serial_Communications behavior on Linux

I have an Ada program that communicates with an Intellibox Basic(a box that allows you to control trains) that is connected via USB.
Under Windows, I had to install a specific Serial driver (CP210x USB to UART Bridge VCP). With that driver I can communicate perfectly with the box. That means sending commands to the box.
Under Linux I'm communicating via /dev/ttyusb0 and I'm able to get messages from the box, but I can't send commands to the box. Nothing happens. I don't get an error or something.
Is the behavior of GNAT.SerialCommunication differently on Linux ? The program is the same. Do I have to setup certain things to get it to work on Linux ?
For example: A typical 2-byte command has the Command as the first Byte and the CRC check as the second one.
I had trouble with Serial_Communication at some point, where it turned out to be a problem with hardware-handshake being enabled in Linux. It's hard-coded in g-sercom.adb, look for "CRTSCTS". If your Intellibox does not use hardware handshake, Write() will block.
I believe I solved it by removing the CRTSCTS mask from the flags.

Get two Linux (virtual) boxes talking over a serial port

What is the best way to setup one Linux box to listen on its serial port for incoming connections? I've done a lot of googling but I can't find the right combination of commands to actually get them to talk!
My main objective is to provide a serial interface to running instances of kvm/qemu VMs. They currently only have a VNC interface (they are on headless servers, no X). I can get the VM to create a serial device by starting it with the -serial file: flag, but how to talk to it, is a whole other problem. Both boxes are running Ubuntu 8.04.
The Linux Serial HOWTO has a lot of detailed information about serial communication in general. The more-specific Linux Remote Serial Console HOWTO is what you're really looking for if you want to be able to log into your virtualized systems using the serial port as if you were at the console. As Hein indicated, you'll need a null modem cable and need to run minicom on the remote terminal.
The Linux console is used in two ways, each of which must be configured separately for serial use. You can configure the kernel to copy its messages over the serial port, which is occasionally interesting for watching the system boot and nearly indispensable if you're doing kernel debugging. (This requires kernel support and updating the boot parameters so the kernel knows you want serial output; see chapter 5 of the second howto.) You're probably more interested in logging in via the serial port, which requires running getty on the serial port after boot (just like your system already runs getty on the virtual terminals after boot), which is described in detail in chapter 6 of the howto.
I assume you connect the two serial ports using a "null modem" cable.
Use a program like minicom to talk to remote system -- you probably need to set up the communication parameters and possibly turn off hardware flow control (if your cable doesn't have the flow-control lines connected).
Say you're doing this on /dev/tty1.
in the shell
chown *youruser* /dev/tty1
then in a Perl script called example.pl
open PORT, "</dev/tty1" || die "Can't open port: $!";
while (defined ($_ = <PORT>))
{
do_something($_);
}
close PORT;
Obviously there is more to do if you want this to start automatically, and respawn on error, and so on. But the basic idea is to read from the serial port like a file.

Resources