I'm able to send and receive serial data from my Windows7 PC to the TM4C12GXL by using the Texasdisplay. It is quite a basic and easy program, and it works: The launchpad waits for an unsigned char input. If r button is pressed on keyboard, it displays red light, and similar for other buttons etc. etc.
Now I want to do a similar thing by using my Ubuntu 15.04 PC, by directly sending outputs of my C++ code in the PC. Connecting launchpad to the PC, but I can't even open the serial port.
first I check the ports:
dmesg | grep tty
gives the output:
[ 0.000000] console [tty0] enabled
[10097.475939] cdc_acm 2-1.3:1.0: ttyACM0: USB ACM device
[10397.346325] cdc_acm 2-1.3:1.0: ttyACM0: USB ACM device
This is the C++ code in my Ubuntu PC:
#include <SerialStream.h>
#include <iostream>
#include <unistd.h>
#include <cstdlib>
#include <string>
using namespace LibSerial;
using namespace std;
int main(void)
{
SerialStream my_serial_stream;
my_serial_stream.Open("/dev/ttyACM0"); //opening the port
if(!my_serial_stream.good())
{
std::cerr << "[" << __LINE__ << "]" << " , Port open error." << "\n";
}
my_serial_stream.SetBaudRate(SerialStreamBuf::BAUD_115200);
if(!my_serial_stream.good())
{
std::cerr << "[" << __LINE__ << "]" << " , Baudrade error." << "\n";
}
}
How I compile:
g++ uart.cpp -o uart -L/usr/lib -lserial
Output is:
[20] , Port open error.
[26] , Baudrade error.
It can't even open the serial port. What am I missing? Thank you.