EmbDev.net

Forum: ARM programming with GCC/GNU tools programing to read USB-GPS for SBC2440-IV Single Board Computer


von Luu M. (Company: MEMSLAB) (kennyha85)


Rate this post
useful
not useful
I have an USB-GPS receiver (Haicom 204E) and a SBC2440-IV Single Board
Computer. I have written a C program to read my GPS receiver on Unbutu
8.10 for testing. It has worked well. On my PC, I have created a file
asserted for usb port by using command " $ sudo mknod /dev/ttyUSB0 c 188
0". so I"ve treated my device as a file named "/dev/ttyUSB0".

However, on SBC2440-IV Single Board Computer, when I plug the GPS 
receiver
in the USB host port1, I see a message on the terminal: 
"[root@arm-linux]#
usb 1-1: new full speed USB device using s3c2410-ohci and address 2". 
then
I create /dev/ttyUSB0 file by using command "$ mknod /dev/ttyUSB0 c 188
0". I see a file "ttyUSB0" in root/dev folder, but I can"t open it like 
the
way on Unbutu. It"s seem to be that /dev/ttyUSB0 is not asserted for the 
USB host1.

Could someone help me to read the GPS receiver on SBC2440-IV Single 
Board
Computer?
this is my C code to read the file.
/*********************************************************************** 
*********
*****/
int main(void)

{

int status,n;

char *port = "/dev/ttyUSB0";

printf("GPS receiver\n");

open_port (port);

configure_port(1);
pthread_create(&GPS_READ_ID, NULL, GPSreceiver, 0);
pthread_create(&GPS_SHOW_ID, NULL, GPSshow, 0);


while(1){

}

/* close the device file */

close(GPS_handle);

}



void open_port(char *port)

{

/* open the serial port device file

* O_NDELAY - tells port to operate and ignore the DCD line

* O_NOCTTY - this process is not to become the controlling

* process for the port. The driver will not send

* this process signals due to keyboard aborts, etc.

* O_NONBLOCK- tells port to be nonblocking (read will return immediatly)

*/

GPS_handle = open(port, O_RDWR | O_NDELAY | O_NOCTTY | O_NONBLOCK);

if (GPS_handle == -1)

{

perror("open_port: Unable to open");

exit(1);

}

else

tcgetattr(GPS_handle, &tio);

fcntl(GPS_handle, F_SETOWN, getpid());

fcntl(GPS_handle, F_SETFL, FASYNC);
//////////////////////////////////////////////////////////////////////// 
//////////////////////////////////////////////////////////////////////// 
/
USB GPS Haicom204E is a device which has USB output port; baud-rate 
4800,8,N,1;
NMEA108 standard.
My problem is that I don"t know how to make the file asserted for USB 
hostport1 of
SBC2440-IV Single Board Computer.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.