Second UART

deshipu
 
Posts: 21
Joined: Wed Nov 19, 2014 5:10 pm

Second UART

Thu Nov 20, 2014 11:01 am

I want to use the second UART to talk to another device. I have connected the G#8 and G#10 pins, as well as ground. But every time I try to use /dev/ttyS1, I'm getting Input/Output error. That includes:

Code: Select all
# cat /dev/ttyS1
# stty -F /dev/ttyS1 -a
# screen /dev/ttyS1 9600


Do I need to do anything special to enable the second UART?

Vonger
 
Posts: 762
Joined: Sun Oct 19, 2014 6:00 am

Re: Second UART

Fri Nov 21, 2014 4:40 am

Hi,
You need change the dts and recompile openwrt. I have a blog http://vonger.cn/?p=1409 for this

deshipu
 
Posts: 21
Joined: Wed Nov 19, 2014 5:10 pm

Re: Second UART

Sat Nov 22, 2014 5:23 pm

Thank you, that works.

I switched the console to use /dev/ttyS1, and have /dev/ttyS0 free for my use.

I couldn't use /dev/ttyS1, because I'm getting some weird binary data in there randomly. Any idea what that may be?

darksoul
 
Posts: 45
Joined: Fri Nov 14, 2014 2:29 am

Re: Second UART

Tue Nov 25, 2014 1:12 am

deshipu wrote:
I couldn't use /dev/ttyS1, because I'm getting some weird binary data in there randomly. Any idea what that may be?


Same here, if you solved the problem, please reply.

darksoul
 
Posts: 45
Joined: Fri Nov 14, 2014 2:29 am

Re: Second UART

Tue Nov 25, 2014 2:38 am

Can some one PLEASE write a step by step guide how to enable the second UART and move the console to the second UART??

deshipu
 
Posts: 21
Joined: Wed Nov 19, 2014 5:10 pm

Re: Second UART

Thu Nov 27, 2014 2:26 am

The weird binary data was just kernel messages written in different speed.

I will describe what I did when I have a moment.

darksoul
 
Posts: 45
Joined: Fri Nov 14, 2014 2:29 am

Re: Second UART

Thu Nov 27, 2014 6:56 pm

deshipu wrote:The weird binary data was just kernel messages written in different speed.

I will describe what I did when I have a moment.




i will be very thankful for that.

deshipu
 
Posts: 21
Joined: Wed Nov 19, 2014 5:10 pm

Re: Second UART

Fri Nov 28, 2014 11:49 am

Ok, so there are basically four different things being written to the UART:
  • das uboot bootloader messages
  • kernel booting messages
  • kernel "printk" messages (aka dmesg)
  • console

Disabling the console is the easiest: just edit /etc/inittab and comment out (with #) or delete the line that has "askconsole" in it. On the next boot no console will be started.

You can disable the "printk" messages in two ways, either just disable them in the "Global Build Settings" in the menuconfig when you are building the image, or add a line saying "kernel.printk = 0 4 1 7" to the /etc/sysctl.conf

The kernel booting messages can be disabled by changing the kernel boot parameters. If you look at target/linux/ramips/dts/VOCORE.dts you can see that it includes file rt5350.dtsi, which in turns has this:

Code: Select all
   chosen {
      bootargs = "console=ttyS0,57600";
   };


You can copy it to VOCORE.dts and change to:
Code: Select all
   chosen {
      bootargs = "console=null";
   };


You can't do anything about the bootloader, without compiling your own version. And I think you really don't want -- because you want to have some emergency way of flashing a different image when something goes wrong. My solution is to just ignore anything on the serial line until a handshake sequence appears.

See http://wiki.openwrt.org/doc/recipes/ter ... .on.serial for another way.

If instead of disabling it you want to redirect it to the second UART, you can do that. Do what is described in http://vonger.cn/?p=1409 and change the bootargs line above to point to ttyS1 instead of ttyS0. All the rest will switch over automatically, I think.

darksoul
 
Posts: 45
Joined: Fri Nov 14, 2014 2:29 am

Re: Second UART

Mon Dec 01, 2014 4:05 am

deshipu wrote:Ok, so there are basically four different things being written to the UART:



You rock man!!!
thank you for your help!
I will do your steps tomorrow and reply the results!

blark
 
Posts: 1
Joined: Tue Feb 24, 2015 7:11 pm

Re: Second UART

Tue Feb 24, 2015 7:15 pm

I'd like to echo the request of a previous poster. If someone could do a quick step by step instruction to enable the second UART I'd really appreciate it.

The whole blob of source code on the linked page isn't very helpful for me as I'm not intimately familiar with OpenWRT. Also, there seems to be an alternate solution mentioned in the comments.. patching pinctrl-rt2880.c. Again, help a noob out and explain where this file is and what the best way to apply the patch is, please?

Thanks very much

Next
Return to VoCore & VoCore+Dock

Who is online

Users browsing this forum: No registered users and 2 guests