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:


|
voidreadSerial(intfd )
{
    fd_set readfs;
    FD_ZERO(&readfs );
    FD_SET(fd,&readfs );
while(1)
{
select(fd+1,&readfs,0,0,0);
if(FD_ISSET(fd,&readfs ))
{
charbuffer[32];
intn =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] <mailto:[email protected]>.
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.

Reply via email to