BBB UART2 Write Issue (C/C++)

Hi,

I’m currently using the BBB to control a rover robot for a project at my university. I’m currently having an issue using the UART file /dev/ttyOx to write an array of characters to a smart servo using c/c++.
More specifically, I’ve opened the file using
fopen("/dev/ttyO2", "wb")

which should open it in binary mode. I’ve also tried the c++ equivalent with
ofstream file("/dev/ttyO2", ios::out|ios::binary)

For the most part these have worked fine. I have been using the UART tool for the PicKit 2 to verify what I’ve been receiving. But, despite having opened the file in binary mode, if I try to write 0x0A it will still append 0x0D to form CRLF, or newline.

For example, if I create a character array:
`
char c[] = {0xFF,0xFF,0x0A,0x01,…}

`

This is seen on the UART tool:
`
FF FF 0D 0A 01 …

`

If anyone knows a fix, or can offer any insight (should I be approaching it incorrectly), I would greatly appreciate it.

Hi Michael,

I'm currently using the BBB to control a rover robot for a project at my
university. I'm currently having an issue using the UART file /dev/ttyOx to
write an array of characters to a smart servo using c/c++.
More specifically, I've opened the file using
fopen("/dev/ttyO2", "wb")

which should open it in binary mode. I've also tried the c++ equivalent with
ofstream file("/dev/ttyO2", ios::out|ios::binary)

For the most part these have worked fine. I have been using the UART tool
for the PicKit 2 to verify what I've been receiving. But, despite having
opened the file in binary mode, if I try to write 0x0A it will still append
0x0D to form CRLF, or newline.

For example, if I create a character array:
char c = {0xFF,0xFF,0x0A,0x01,..}

This is seen on the UART tool:
FF FF 0D 0A 01 ...

If anyone knows a fix, or can offer any insight (should I be approaching it
incorrectly), I would greatly appreciate it.

I believe you have to properly configure your serial port (baud rate,
line discipline, etc).

See this wiki page:

http://en.wikibooks.org/wiki/Serial_Programming/termios