Hi,
I am using ,
Beagle Board- xm -rev C
File System Details:
#uname -a
Linux arm 3.6.2-x3 #1 SMP Sat Oct 13 10:20:13 UTC 2012 armv7l armv7l armv7l GNU/Linux
And, its ubuntu-12.10-r1-minimal-armhf-2012-10-19
I am trying to access, the serial ports through ‘C’ code. The following is the part of the code.
fd0=open("/dev/ttyS1",0,O_RDWR);
ret = write(fd0,“HiS1”,4)
- the open call get success.
- Write call got failed with error as, “Write Error. Errno:9 Str;Bad file descriptor”
I tried, ttyS2/3/4 also.
Can anyone help?
Thanks,
Well, the uarts are "ttyOx" not ttySx...
Regards,
thanks, But, initailly I tried with, “/dev/tty01” only. I tried from 1-3 also. Same error. So, I give it a try with ttySx.
Thanks Robert, 
Well, that should be an O as in Omap, not 0 as in zero as you typed above…
omg, my bad. Now at work.I will try tonight and post the result. Thanks a lot Robert 
I tried with the “/dev/ttyO1” , [ replaced 1 with 2,3,4 also ] . No luck.
Board : Beagle Board xm - rev C
uname -a : Linux arm 3.6.2-x3 #1 SMP Sat Oct 13 10:20:13 UTC 2012 armv7l armv7l armv7l GNU/Linux
file a.out: a.out: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, BuildID[sha1]=0x82214316c6d4fccb7121e6c6fa1b39b4876e20cd, not stripped
Src:
Well, that should be an O as in Omap, not 0 as in zero as you typed above...
I tried with the "/dev/ttyO1" , [ replaced 1 with 2,3,4 also ] . No luck.
*Board : *Beagle Board xm - rev C
*uname -a :* Linux arm 3.6.2-x3 #1 SMP Sat Oct 13 10:20:13 UTC 2012 armv7l armv7l armv7l GNU/Linux
*file a.out:* a.out: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31,
BuildID[sha1]=0x82214316c6d4fccb7121e6c6fa1b39b4876e20cd, not stripped
*Src:
###########################################################################################*
/#include<stdio.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<errno.h>
int main()
{
int fd0=0;
int ret=0;
errno = 0;
fd0=open("/dev/ttyO1",0);
This should probably read
fd0=open("/dev/ttyO1",O_RDRW);
With a '0' as the second parameter, you are opening the device but not asking
for permission to either read or write from it.
hey, Thanks Gary . Its working now for all 0,1,2,3. Sorry for disturbing mailing list for this silly thing.
Hi, please try this to active your serial port:
opkg install kernel-module-usbserial
opkg install kernel-module-ch341 (or pl2303 or ft232)
echo ch341 >> /etc/modules
echo usbserial >> /etc/modules
update-modules
depmod -a
modprobe ch341
after that, you can use it such as ttyUSB0
Good luck.