Hi I have a problem with setting the baud rate on the on board serial port on a TL-WR703N (ttyATH0).
I bought the ultra low cost and compact router in china. I plan to interface a PIC 16F628 with it using serial communication@9600 8N1. Everything works great except the fact that the serial port is transmitting in 115200 instead of 9600. I guess that the main problem is that I can’t get stty to work on the device. (it’s included in the ipkg, but not the opkg that the device is using). I have searched forum for days, but most solutions seems to be for USB2serial converters (FTDI)
This is the device I’m using:
http://wiki.openwrt.org/toh/tp-link/tl-wr703n
This is what I have done:
1. installed this version of openwrt http://downloads.openwrt.org/snapshots/ … actory.bin
2. disabled serial console by adding “#” to /etc/inittab
3. installed the following packages:
a. opkg install picoterm empty
b. opkg install coreutils
c. opkg install microcom
d. opkg install setserial
4. I also manually copied stty to usr/sbin, but it does not seem to work… (http://www.jbprojects.net/projects/wifirobot/stty.tgz)
I’m testing it with the following command:
echo "hello" > /dev/ttyATH0
This works, I can receive the message on a pc running terminal program and hardware voltage level conversion. But it is with the wrong baud rate (still 115200).
I have tried the following commands:
empty -f picocom -b 9600 -p n -f n -l -r /dev/ttyATH0 -> (nothing happens)
empty -f picocom -b 9600 -p e -l -r /dev/ttyATH0 -> (nothing happens)
setserial /dev/ttyATH0 baud_base 9600 -> (Cannot set serial info: Invalid argument)
If I just run setserial I get this message:
root@OpenWrt:~# setserial /dev/ttyATH0 -> (/dev/ttyATH0, UART: undefined, Port: 0x0000, IRQ: 11)
During boot I have seen this message:
Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11) is a AR933X UART
So I tried the following command:
root@OpenWrt:~# setserial /dev/ttyATH0 port 0x18020000 irq 11 ->(Cannot set serial info: Device or resource busy)
I guess that getting a stty that works might solve the problem, but I can’t find it as a install package, and my manual install attempt didn’t work (was built for fonera kamikaze). Does anyone have any idea for how to proceed?
(Last edited by konow on 9 Dec 2011, 10:14)