Hi Mike,

On Fri, Nov 29, 2013 at 9:56 AM, Mikester <mikester...@gmail.com> wrote:
>
>
> I have a USB FTDI serial device that connects to the BBB and it shows up
under /dev/ttyUSB0.
>
> After bootup If I try connecting to the device via a c program I get an
error "11 - Resource temporarily unavailable".
>
> However, if I first connect to the device using something like "screen"
or "minicom" then kill the process, I am able to use my c program to access
the serial device without any problems.
>
> Is there some sort of initialization script I need to run in order to
access the USB serial device?
>
> If I use stty -F /dev/ttyUSB0 -a I get
>
> speed 230400 baud; rows 0; columns 0; line = 0;
> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
> rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
> -parenb -parodd cs8 -hupcl -cstopb -cread -clocal -crtscts
> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon
-ixoff -iuclc -ixany -imaxbel -iutf8
> opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0
vt0 ff0
> isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop
-echoprt echoctl echoke

I seem to recall that modemmanager and/or brltty (on your host computer)
may cause access problems.
So one of the first things I do is to uninstall those 2 packages (this may
not be what you're running into, but I've been burned by it several times,
so I figured I'd mention it).

It looks like CLOCAL is turned off, which means that it expects modem
control lines to take effect (including carrier detect).

I've written a small sample program I call sertest which you can find here:
https://github.com/dhylands/projects/blob/master/host/sertest/sertest.c

It opens a serial port and takes any characters you type and sends them to
the serial port, and prints any received characters to stdout.

If you short RxD and TxD on your USB serial dongle, then you should be able
to see what you type.

Opening the serial port using O_NONBLOCK is desirable (otherwise you may
hang if the carrier detect isn't asserted), but it will cause the error
that you're seeing when you try to read data from the serial port.

You'll see here:
https://github.com/dhylands/projects/blob/master/host/sertest/sertest.c#L225
that I turn off the non-blocking behaviour after opening the serial port,
which means that the read will block instead of returning EAGAIN.

If you're still having issues, it would be useful if you could post the
code that you're using. You didn't mention which exact call was returning
the EAGAIN error.

--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to