OpenWrt Forum Archive

Topic: AR9331 disable serial console

The content of this topic has been archived on 17 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello,

I am using SOM9331 having AR9331 processor having 1 UART port and by default it is used for serial console.

Now my application need UART communication with the external device. Now I have to disable the serial console and use the UART port for the application.
Do I have to do any changes in kernel source or can be done on the command line?
Or is there any method to use the virtual com port for the same UART port?

Does anyone tried the method to use the UART port for the application?
Thanks in advance.

Regards,
Sowmya

Thank you for the link. I did the following and the console is disabled. Thank you.
Now how can I configure the UART for my requirement? Like setting the baudrate, flow control?
Do I have to modify in kernel ? or do I have to write an application to read the uart data in C and cross-compile?


Regards,
Sowmya

Use stty(coreutils-stty) for that.
For example:

stty -F /dev/ttyATH0 9600

where 9600 - port speed

stty -F  /dev/ttyATH0 crtscts

where crtscts - hardware flow control (RTS/CTS)

stty -F /dev/ttyATH0 4:0:18b2:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

reset terminal for RAW data/Modem data

Try to find man for stty.

Thank you very much. It is working smile
Can I know what are the data definition of the following command:

stty -F /dev/ttyATH0 4:0:18b2:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
sowmyabr wrote:

Can I know what are the data definition of the following command:

stty -F /dev/ttyATH0 4:0:18b2:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

Its copy settings (default) from UsbToUART dongle connected to the router.

root@OpenWrt:~# stty -a < /dev/ttyUSB0
speed 115200 baud; rows 0; columns 0; line = 0;
intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = <undef>;
eol = <undef>; eol2 = <undef>; swtch = <undef>; start = <undef>; stop = <undef>;
susp = <undef>; rprnt = <undef>; werase = <undef>; lnext = <undef>;
flush = <undef>; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt
-echoctl -echoke
root@OpenWrt:~# 

You can compare it with your settings:

stty -a < /dev/ttyATH0

(Last edited by Deoptim on 16 Apr 2016, 12:09)

Thank you for the information.
I am trying to copy the uart received data to a file. And when I open the logged file, it is always missing the first character.
Ex: If I send data qwerty from terminal, the data in the file is: werty. And the writing is randomly jumbled with previous data received.

Is there any other best method to write the received data to a file?

Update: The issue is fixed. Thank you for the quick reply.

(Last edited by sowmyabr on 16 Apr 2016, 13:26)

The discussion might have continued from here.