Hi Miguel
uname -a gives
Linux beaglebone 3.8.13 #1 SMP Thu Sep 12 10:27:06 CEST 2013 armv71
GNU/Linux
UART1 is enabled by
echo BB-UART1 > /sys/devices/bone_capemgr.*/slots
which makes /dev/ttyO1 appear. I am connecting to that via open(
"/dev/ttyO1", O_RDWR|O_NOCTTY );
Switching to /dev/ttyUSB0 improved things, but as I said, I only saw
alternate characters. However when I stopped doing select() and just used
read(), data was correctly transferred, so I am assuming that there are no
voltage-level issues.
On Wednesday, 24 September 2014 14:41:11 UTC+1, Miguel Aveiro wrote:
>
> Well, which kernel are you using? Type "uname -a" on the terminal.
>
> I don't think it is a kernel issue. One thing you did not said on the
> previously thread is how are you connecting the UART1 to your computer.
>
> If the code is permanently blocking, and depending how you set up the
> serial port, this means that no data is received. You need to check the
> connections and remember that all those pins are 3.3V or you will burn
> them...
>
> Miguel
>
> On 24-09-2014 08:42, Julian Gold wrote:
>
> So I have been trying to write code to read data asynchronously from a
> serial port. I have tried it with /dev/ttyO1 (using UART1), and also with
> /dev/ttyUSB0 (using an FTDI USB cable in the USB port).
>
> Here is a snippet of code. This fails on both serial ports, but in
> different manners:
>
>
>
> void readSerial( int fd )
> {
> fd_set readfs;
> FD_ZERO( &readfs );
> FD_SET( fd, &readfs );
> while( 1 )
> {
> select( fd+1, &readfs, 0, 0, 0 );
> if (FD_ISSET( fd, &readfs ))
> {
> char buffer[32];
> int n = read( fd, buffer, 32 );
> printf( buffer ); fflush( stdout );
> }
> }
> }
>
>
> On /dev/ttyO1, the select() call blocks permanently, with no input being
> acknowledged. On /dev/ttyUSB0, the function prints EVERY OTHER character,
> so if I type "connect" into my PC terminal program, I will get either
> "cnet" or "onc" depending on what came before. Either way, it appears
> select() is broken because if I replace this with
>
> while((n= read(fd,buffer,32)) > 0)
> {
> printf(buffer); fflush(stdout);
> }
>
> Then I get "connect" as expected on /dev/ttyUSB0 (untried as yet on
> /dev/ttyO1). This seems like a fundamental problem with the Angstrom kernel?
> --
> 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 [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.