Serial port in C++ on BeagleBone Black

Hi
I am writting a serial program in C++ on BeagleBone Black.
I wanted to use /dev/ttyO0 and another serial port.
I think /dev/ttyO0 is serial terminal port.

I opened serial port, /dev/ttyO0, in my program.
and I close my program with Ctrl+C.
then when a key is entered in the serial terminal,
the entered key does not appear in the terminal.
when I pressed ‘Enter’ key, prompt was appeared without line breaks.
Why is this happening?

I want all keys to be displayed normally on the serial terminal.
how can I do?
Please help me~

Regards.

Hi @taek8461,

/dev/ttyO0 is a symlink of the real node: /dev/ttyS0

Correct, this is a legacy and default response for Serial Communication. If you want the ‘Enter’ Key to appear how current application respond to it, you’ll need to send a “Carriage Return” and “Line Feed” instead.

Regards,

Hi.
Thank you for your response.

When I pressed the Enter key before running my program,
a line break occurred on the terminal screen and a prompt appeared

But after running my program, when I terminated the program
and pressed the Enter key,
there is no line break in the terminal screen and a prompt appears.

After the program is terminated, I want the line break and prompt to be displayed when the Enter key is pressed as before the program was executed.

Is there a way to return to the previous state in C++ code or system settings
Please let me know how to do it

Regards.

Hi @taek8461, I’m no expert in C++, as I spend most of my time developing C based projects, and much of that is hacking up modules inside the Linux Kernel. When dealing with Serial Ports, you have to remember, “Enter Key” does not automatically mean “Carriage Return + Line Feed”, so you will have to emulate that call. As to why you are seeing some random line breaks. This might be from your application Connecting/Disconnecting from the terminal and sending an early Line Feed.

But without seeing your C++ project, this is really just a guess on my part.

Honestly, to get a better answer, i would recommend you post your question either to the BeagleBoard mailing list: https://groups.google.com/forum/#!forum/beagleboard/join to get more eye’s for your question. Or just post it on a C++ forum.

Regards,