Page 1 of 1
Serial Communications over USB with ArchLinuxARM
Posted: Wed Jan 11, 2017 9:11 am
by mglass
Can anyone help me get started with Serial Communications over USB with ArchLinuxARM?
I have serial output streaming from a USB device at 9600 baud. How can I read this data into the Pi?
How do I setup the USB serial link and then how to I grab the serial data from the USB serial port?
Re: Serial Communications over USB with ArchLinuxARM
Posted: Wed Jan 11, 2017 12:31 pm
by topguy
Are you going to plug the USB device into the Raspberry Pi ?
If yes then you have to check if the device is recognized by the kernel as a USB2Serial converter and will give you a "/dev/ttyUSB0" device. ( alternativly "/dev/ttyACM0")
Re: Serial Communications over USB with ArchLinuxARM
Posted: Thu Jan 12, 2017 1:43 am
by mglass
Yes - that's right. I'll plug the USB cable into the Pi, and presumably a USB port device will appear in /dev (eg /dev/ttyUSB0) as you say.
But how do I set the baud rate (eg 9600)?
Then, how do I open a file and store the data stream coming off the USB port?
Any help or clues ?
Re: Serial Communications over USB with ArchLinuxARM
Posted: Thu Jan 12, 2017 1:45 am
by mglass
BTW I'm seeking bash/sh command lines, as I'm using ArchLinuxARM, as the operating system.
Re: Serial Communications over USB with ArchLinuxARM
Posted: Thu Jan 12, 2017 12:21 pm
by topguy
Set baudrate: ( but 9600 is already default baudrate in linux )
Dump serialport parameters:
Test output if its text ( like a GPS )
Test output if its binary:
Code: Select all
dd if=/dev/ttyUSB of=test.bin count=1024
od -t x1 test.bin
Re: Serial Communications over USB with ArchLinuxARM
Posted: Thu Jan 12, 2017 2:13 pm
by mglass
Many thanks. That's just what I need.
I'll have a go and I expect I'll be able to take it from there.
Cheers,
Martin