Skip to content

Instantly share code, notes, and snippets.

@alexhude
Created December 24, 2016 04:01
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexhude/3cd8a3781b1394520fd788afafded905 to your computer and use it in GitHub Desktop.
Save alexhude/3cd8a3781b1394520fd788afafded905 to your computer and use it in GitHub Desktop.
Setting up /dev/uart.debug-console output for DCSD
struct termios tty;
memset (&tty, 0, sizeof tty);
if (tcgetattr (serial_fd, &tty) != 0)
return -1;
// set speed
cfsetospeed (&tty, B115200);
// set control options
tty.c_cflag &= ~CRTSCTS; // disable hardware flow control
tty.c_cflag |= CLOCAL; // local line - do not change "owner" of port
tty.c_cflag &= ~CSIZE; // clean data bits
tty.c_cflag |= CS8; // set 8 data bits
tty.c_cflag &= ~PARENB; // clean parity bit
tty.c_cflag &= ~CSTOPB; // set 1 stop bits by cleaning CSTOPB
// set output options
tty.c_oflag &= ~OPOST; // set raw output
if (tcsetattr (serial_fd, TCSANOW, &tty) != 0)
return -1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment