Hi all!
On custom board, based on DM816x EVM, I have UART1 connected to the ADM3078EARZ (http://pdf1.alldatasheet.net/datasheet-pdf/view/164508/AD/ADM3078EARZ.html). I wrote test application to check that data is transmitted. I see (by oscilloscope) data on UART1_TXD line, but I can not see what RTS line is driven (RTS connected to the DE on ADM3078) and data not be transmitted. I use default linux kernel and MUX settings for UART1 from EZSDK_5_04_00_11.
Please tell me how I can drive RTS line to enable DE signal on ADM3078EARZ?
May be I have error in test application, or need additional MUX settings for CTS/RTS pins?
Thank you.
Application File: 5008.main.cpp
usage: ./app /dev/ttyO1
My application code:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <termios.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/signal.h>
#include <sys/types.h>
//-----------------------------------------------------------------------------
#define BUF_SIZE 4
//-----------------------------------------------------------------------------
volatile int exit_flag = 0;
//-----------------------------------------------------------------------------
void exit_app(int sig)
{
exit_flag = 1;
}
//-----------------------------------------------------------------------------
int main(int argc, char *argv[])
{
int err = 0;
signal(SIGINT, exit_app);
if(argc == 1) {
printf("usage: %s <device name>\n", argv[0]);
return -1;
}
printf("Start testing device %s\n", argv[1]);
int fd = open(argv[1], O_RDWR | O_NOCTTY | O_NDELAY);
if(fd < 0) {
fprintf(stderr, "%s(): Error open device %s\n", __FUNCTION__, argv[1]);
return fd;
}
printf("Open device %s\n",argv[1]);
struct termios options;
tcgetattr(fd, &options);
cfsetispeed(&options, B115200);
cfsetospeed(&options, B115200);
options.c_cflag &= ~PARENB;
options.c_cflag &= ~CSTOPB;
options.c_cflag &= ~CSIZE;
options.c_cflag |= CS8;
options.c_cc[VMIN] = 0;
options.c_cc[VTIME] = 1;
options.c_cflag |= (CLOCAL | CREAD | CRTSCTS);
if(tcsetattr(fd, TCSANOW, &options)!= 0) {
printf("Error setup serial port\n");
close(fd);
return -1;
}
unsigned char outBuf[BUF_SIZE];
unsigned char inBuf[BUF_SIZE];
for(int i=0; i<BUF_SIZE; i++) {
outBuf[i] = i;
inBuf[i] = 0;
}
do {
printf("Press Enter to write data\n");
getchar();
if(exit_flag) {
break;
}
err = write(fd, outBuf, sizeof(outBuf));
if(err < 0) {
printf("Error write device: %s\n", strerror(errno));
break;
} else {
printf("Write %d bytes\n", err);
}
} while (1);
close(fd);
return err;
}