UART 2 Issue in Pocket Beagle Bone

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Rohi123
 
Posts: 1
Joined: Wed Dec 06, 2017 5:31 am

UART 2 Issue in Pocket Beagle Bone

Post by Rohi123 »

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 .
Attachments
bboard_pocketbeagle_pinout.jpg
bboard_pocketbeagle_pinout.jpg (141.68 KiB) Viewed 803 times

User avatar
drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: UART 2 Issue in Pocket Beagle Bone

Post by drewfustini »

Please check the pin mode for those pins with config-pin utility.

Also, please try the latest Debian 9 ("Stretch") image if possible:
https://elinux.org/Beagleboard:BeagleBo ... tBeagle.29

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”