Hi,
i am trying with c program for Uart peripheral like this :
#include<termios.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include<stdlib.h>
void main (void)
{
int file;
char buf[20];
size_t nbytes;
ssize_t bytes_written;
struct termios oldtio, newtio;
if ((file = open("/dev/ttyS1", O_RDWR | O_NOCTTY))<0)
{
printf("UART: Failed to open the file.\n");
return;
}
//save the current serial settings
tcgetattr(file, &oldtio);
//clear the structure for new port settings
bzero(&newtio, sizeof(newtio));
newtio.c_cflag = B9600 | CS8 | CREAD | CLOCAL;
newtio.c_iflag = IGNPAR | ICRNL;
tcflush(file, TCIFLUSH);
tcsetattr(file, TCSANOW, &newtio);
strcpy(buf, "This is a test\n");
nbytes = strlen(buf);
while (1)
{
bytes_written = write(file, buf, nbytes);
sleep(10);
}
close(file);
}
i am running the code in to one terminal using ./uart1.0 and checking the
output into one more terminal using
debian@beaglebone:~$ minicom -D /dev/ttyO1 -b 9600
minicom is opening but not able to see the data, here i not did any
hardware connection on board.
what is problem , where is the mistake please tell me...
suggest me any hardware connections i need to connect..
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/c0812f82-7833-443f-a294-8df37f36fa68%40googlegroups.com.