Hello All,

I am able to transmit data in UART4 (P2_5 , P2_7)

Now i am trying to transmit data in UART 2 (P1.8, P1.10)  in Pocket beagle 
Bone. I can not see anything  coming out .



Here is the steps i followed.

Version : 

debian@beaglebone:~$ cat /etc/debian_version
9.1


Enabled UART2 in uEnv.txt

debian@beaglebone:~$ cd /boot
debian@beaglebone:/boot$ sudo nano uEnv.txt

cape_enable=bone_capemgr.enable_partno=BB-UART1,BB-UART4,BB-UART5,BB-UART2
cape_disable=bone_capemgr.disable_partno=


debian@beaglebone:~$ ls -al /dev/ttyS*
crw--w---- 1 root tty     4, 64 Sep 21 21:01 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 Sep 21 21:01 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 Sep 21 21:01 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 Sep 21 21:01 /dev/ttyS3
crw-rw---- 1 root dialout 4, 68 Sep 21 21:01 /dev/ttyS4
crw-rw---- 1 root dialout 4, 69 Sep 21 21:01 /dev/ttyS5


Here is the code,

Code : 

#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>


void main (void)
{
    int file, i;
    unsigned char receive[100]; // declare a buffer for receiving data
    char buf[20];
    size_t nbytes;
    ssize_t bytes_written;
    printf("UART: Transmission Started.\n");
    if ((file = open("/dev/ttyS2", O_RDWR))<0)
    {
        printf("UART: Failed to open the file.\n");
        return;
    }

    //
    struct termios options; // the termios structure is vital
    tcgetattr(file, &options); // sets the parameters associated with file

    // Set up the communications options:
    // 9600 baud, 8-bit, enable receiver, no modem control lines
    options.c_cflag = B9600 | CS8 | CREAD | CLOCAL;
    options.c_iflag = IGNPAR | ICRNL; // ignore partity errors, CR -> 
newline
    tcflush(file, TCIFLUSH); // discard file information not transmitted
    tcsetattr(file, TCSANOW, &options); // changes occur immmediately

    strcpy(buf, "This is a test\n");
    nbytes = strlen(buf);

    while (1)
    {
        bytes_written = write(file, buf, nbytes);
        sleep(10);
    }
    close(file);





I hope someone can help me .



-- 
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 beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/e8e94e3d-92d0-4230-b272-3e6aca3b92f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to