Disabling UART Debug Serial Port on Linux - linux

I am working on freescale imx8 board, where the we need to use the same UART for multiple purposes. By default this UART is configured as debug port as a console.
I have disabled this by modifying boot args (console = null from console = /dev/ttyLP0). I am checking the UART controller by running basic UART test using SSH, it is failing.
What can be the problem, do i need to do any modifications in kernel like disabling CONFIG_SERIAL_CONSOLE etc.

The Linux kernel boot argument console affects to output of kernel.
So, setting console = null in boot arguments won't prevent programs to use of the UART.
For example your /etc/inittab may contain the following kind of line for enabling logins via the UART:
console::respawn:/sbin/getty -L 115200 ttyLP0 vt100
There are ways to solve the problem:
Don't use the UART from any programs (For example: remove getty line from inittab)
Don't even create the serial device (/dev/ttyLP0).

Related

how to find which serial device is used for terminal output in embedded linux

I am using a i.MX28 board from freescale. I am writing linux applications for this device.
I plan to compile and load gdbserver on it to debug over serial interface. I am able to connect and login to the shell using hyperterminal or minicom but I dont know which tty device is default for terminal. How can I find which /dev/tty is being used?
w or who will tell you the current sessions and which TTY is used for each one.

Display Linux boot messages on tty1 instead of ttyS1

I'm working on an embedded Linux system with a display panel. The system is setup to output boot messages through the serial port on the system /dev/ttyS1. I'm trying to get these messages to show up on the display,tty1, and I'm looking for suggestions on how I go about doing this.
I tried changing the kernel command line from console=ttyS1 to console=tty1; this has no effect. Even with the change above boot messages are sent only to the serial port. I verified that the change to the kernel command line did take effect by querying cat /proc/cmdline
The last step of the boot process spawns getty to tty1 and the login screen does appear on the panel. The panel itself is initialized much earlier in the boot sequence.
EDIT: #artless noise pointed out that sending the console to the virtual terminal requires a change in the kernel config. And indeed it does. Follow the steps below to enable console output on virtual terminal
make menuconfig
and from the displayed GUI select the following
Device Drivers -> Character devices -> Support for console in virtual terminal
When invoking make you may need to provide additional options (ARCH, CROSS_COMPILE etc.) depending on the target you're building for.
Command line options can be provided either by the bootloader (e.g., u-boot bootargs) or hardcoded when configuring the kernel.
I know that on some older versions of the Linxu kernel, hard-coded options erroneously overwrote bootloader options.
So, have a look at the .config file and see if the wrong console has been set there.

In Linux, how to occupy console the std out exclusively?

I am working on embedded Linux, only one serial port, and used to be debug console. However, I need to I/O data by serial port, too. How can I use the console, the serial port, exclusively?
Remove the appropriate argument from the kernel command line and disable any getty that may be started on it by the startup processes.

Ada GNAT.Serial_Communications behavior on Linux

I have an Ada program that communicates with an Intellibox Basic(a box that allows you to control trains) that is connected via USB.
Under Windows, I had to install a specific Serial driver (CP210x USB to UART Bridge VCP). With that driver I can communicate perfectly with the box. That means sending commands to the box.
Under Linux I'm communicating via /dev/ttyusb0 and I'm able to get messages from the box, but I can't send commands to the box. Nothing happens. I don't get an error or something.
Is the behavior of GNAT.SerialCommunication differently on Linux ? The program is the same. Do I have to setup certain things to get it to work on Linux ?
For example: A typical 2-byte command has the Command as the first Byte and the CRC check as the second one.
I had trouble with Serial_Communication at some point, where it turned out to be a problem with hardware-handshake being enabled in Linux. It's hard-coded in g-sercom.adb, look for "CRTSCTS". If your Intellibox does not use hardware handshake, Write() will block.
I believe I solved it by removing the CRTSCTS mask from the flags.

Get two Linux (virtual) boxes talking over a serial port

What is the best way to setup one Linux box to listen on its serial port for incoming connections? I've done a lot of googling but I can't find the right combination of commands to actually get them to talk!
My main objective is to provide a serial interface to running instances of kvm/qemu VMs. They currently only have a VNC interface (they are on headless servers, no X). I can get the VM to create a serial device by starting it with the -serial file: flag, but how to talk to it, is a whole other problem. Both boxes are running Ubuntu 8.04.
The Linux Serial HOWTO has a lot of detailed information about serial communication in general. The more-specific Linux Remote Serial Console HOWTO is what you're really looking for if you want to be able to log into your virtualized systems using the serial port as if you were at the console. As Hein indicated, you'll need a null modem cable and need to run minicom on the remote terminal.
The Linux console is used in two ways, each of which must be configured separately for serial use. You can configure the kernel to copy its messages over the serial port, which is occasionally interesting for watching the system boot and nearly indispensable if you're doing kernel debugging. (This requires kernel support and updating the boot parameters so the kernel knows you want serial output; see chapter 5 of the second howto.) You're probably more interested in logging in via the serial port, which requires running getty on the serial port after boot (just like your system already runs getty on the virtual terminals after boot), which is described in detail in chapter 6 of the howto.
I assume you connect the two serial ports using a "null modem" cable.
Use a program like minicom to talk to remote system -- you probably need to set up the communication parameters and possibly turn off hardware flow control (if your cable doesn't have the flow-control lines connected).
Say you're doing this on /dev/tty1.
in the shell
chown *youruser* /dev/tty1
then in a Perl script called example.pl
open PORT, "</dev/tty1" || die "Can't open port: $!";
while (defined ($_ = <PORT>))
{
do_something($_);
}
close PORT;
Obviously there is more to do if you want this to start automatically, and respawn on error, and so on. But the basic idea is to read from the serial port like a file.

Resources