最近新买的MT7620a开发板,看芯片的资料,发现有uartlite和uart两个串口,默认的boot口是uartlite,想扩展uart口用于串口通信,根据文档修改了mt7620a.dtsi和MT7620a.dts两个文件,发现boot打印出来的信息好像已经正常将io/uart复用口使能为uart了,但是通过测试还是不能使用,用示波器测量,发现一直为高电平,求大神指导!!
附上我的mt7620a.dtsi文件:
我的dts文件:
/dts-v1/;
/include/ "mt7620a.dtsi"
/ {
compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc";
model = "Ralink MT7620a + MT7610e evaluation board";
palmbus@10000000 {
uart@500{
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&uartf_gpio_pins>;
};
spi@b00 {
status = "okay";
m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "en25q64";
reg = <0 0>;
linux,modalias = "m25p80", "en25q64";
spi-max-frequency = <10000000>;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "u-boot-env";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
label = "firmware";
reg = <0x50000 0x1fb0000>;
};
};
};
};
pinctrl {
state_default: pinctrl0 {
gpio {
ralink,group = "i2c";
ralink,function = "gpio";
};
};
};
ethernet@10100000 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
ralink,port-map = "llllw";
};
wmac@10180000 {
ralink,mtd-eeprom = <&factory 0>;
};
gsw@10110000 {
ralink,port4 = "gmac";
};
sdhci@10130000 {
status = "okay";
};
pcie@10140000 {
status = "okay";
};
gpio-keys-polled {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
poll-interval = <20>;
s2 {
label = "S2";
gpios = <&gpio0 1 1>;
linux,code = <0x100>;
};
s3 {
label = "S3";
gpios = <&gpio0 2 1>;
linux,code = <0x101>;
};
};
ehci@101c0000 {
status = "okay";
};
ohci@101c1000 {
status = "okay";
};
};
我的boot打印出来的信息:
Starting kernel ...
[ 0.000000] Linux version 3.10.49 (openwrt@localhost.localdomain) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r43770) ) #38 Sun Jan 31 14:01:05 CST 2016
[ 0.000000] Board has DDR2
[ 0.000000] Analog PMU set to hw control
[ 0.000000] Digital PMU set to hw control
[ 0.000000] SoC Type: Ralink MT7620A ver:2 eco:6
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU revision is: 00019650 (MIPS 24KEc)
[ 0.000000] MIPS: machine is Ralink MT7620a + MT7610e evaluation board
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 08000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x00000000-0x07ffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x00000000-0x07ffffff]
[ 0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[ 0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
[ 0.000000] Kernel command line: console=ttyS1,57600 rootfstype=squashfs,jffs2
[ 0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Writing ErrCtl register=0005d98f
[ 0.000000] Readback ErrCtl register=0005d98f
[ 0.000000] Memory: 126488k/131072k available (2380k kernel code, 4584k reserved, 592k data, 224k init, 0k highmem)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:256
[ 0.000000] CPU Clock: 580MHz
[ 0.000000] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[ 0.060000] pid_max: default: 32768 minimum: 301
[ 0.060000] Mount-cache hash table entries: 512
[ 0.070000] pinctrl core: initialized pinctrl subsystem
[ 0.080000] NET: Registered protocol family 16
[ 0.450000] PCIE0 no card, disable it(RST&CLK)
[ 0.460000] bio: create slab <bio-0> at 0
[ 0.470000] rt2880_gpio 10000600.gpio: registering 24 gpios
[ 0.480000] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[ 0.490000] PCI host bridge to bus 0000:00
[ 0.500000] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
[ 0.510000] pci_bus 0000:00: root bus resource [io 0x10160000-0x1016ffff]
[ 0.520000] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[ 0.530000] Switching to clocksource MIPS
[ 0.540000] NET: Registered protocol family 2
[ 0.540000] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.550000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.560000] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.580000] TCP: reno registered
[ 0.580000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.600000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.610000] NET: Registered protocol family 1
[ 0.620000] rt-timer 10000100.timer: maximum frequncy is 2441Hz
[ 0.650000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.660000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 0.680000] msgmni has been set to 247
[ 0.690000] io scheduler noop registered
[ 0.690000] io scheduler deadline registered (default)
[ 0.710000] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[ 0.720000] 10000500.uart: ttyS0 at MMIO 0x10000500 (irq = 13) is a 16550A
[ 0.730000] 10000c00.uartlite: ttyS1 at MMIO 0x10000c00 (irq = 20) is a 16550A
[ 0.750000] console [ttyS1] enabled, bootconsole disabled
[ 0.750000] console [ttyS1] enabled, bootconsole disabled
[ 0.780000] m25p80 spi32766.0: found w25q256, expected en25q64
[ 0.790000] m25p80 spi32766.0: w25q256 (32768 Kbytes)
[ 0.800000] 4 ofpart partitions found on MTD device spi32766.0
[ 0.810000] Creating 4 MTD partitions on "spi32766.0":
[ 0.820000] 0x000000000000-0x000000030000 : "u-boot"
[ 0.830000] 0x000000030000-0x000000040000 : "u-boot-env"
[ 0.840000] 0x000000040000-0x000000050000 : "factory"
[ 0.860000] 0x000000050000-0x000002000000 : "firmware"
[ 0.870000] 0x0000001569d3-0x000002000000 : "rootfs"
[ 0.880000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[ 0.900000] mtd: device 4 (rootfs) set to be root filesystem
[ 0.920000] mtd: partition "rootfs_data" created automatically, ofs=0x380000, len=0x1c80000
[ 0.930000] 0x000000380000-0x000002000000 : "rootfs_data"
[ 0.950000] ralink_soc_eth 10100000.ethernet (unregistered net_device): port 0 link up (100Mbps/Full duplex)
[ 0.970000] ralink_soc_eth 10100000.ethernet: loaded mt7620 driver
[ 0.980000] ralink_soc_eth 10100000.ethernet eth0: ralink at 0xb0100000, irq 5
[ 1.000000] rt3xxx-usbphy usbphy.3: loaded
[ 1.010000] rt2880_wdt 10000120.watchdog: Initialized
[ 1.020000] TCP: cubic registered
[ 1.020000] NET: Registered protocol family 17
[ 1.030000] 8021q: 802.1Q VLAN Support v1.8
[ 1.050000] VFS: Mounted root (squashfs filesystem) readonly on device 31:4.
[ 1.070000] Freeing unused kernel memory: 224K (802e8000 - 80320000)
procd: Console is alive
procd: - watchdog -
[ 4.390000] usbcore: registered new interface driver usbfs
[ 4.400000] usbcore: registered new interface driver hub
[ 4.410000] usbcore: registered new device driver usb
[ 4.420000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 4.440000] ehci-platform: EHCI generic platform driver
[ 4.650000] rt3xxx-usbphy usbphy.3: remote usb device wakeup disabled
[ 4.660000] rt3xxx-usbphy usbphy.3: UTMI 16bit 30MHz
[ 4.670000] ehci-platform 101c0000.ehci: EHCI Host Controller
[ 4.680000] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[ 4.700000] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[ 4.730000] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[ 4.740000] hub 1-0:1.0: USB hub found
[ 4.750000] hub 1-0:1.0: 1 port detected
[ 4.760000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 4.770000] ohci-platform 101c1000.ohci: Generic Platform OHCI Controller
[ 4.780000] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[ 4.800000] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[ 4.870000] hub 2-0:1.0: USB hub found
[ 4.880000] hub 2-0:1.0: 1 port detected
procd: - preinit -
[ 5.070000] usb 1-1: new high-speed USB device number 2 using ehci-platform
[ 5.380000] hub 1-1:1.0: USB hub found
[ 5.380000] hub 1-1:1.0: 4 ports detected
[ 5.400000] 8021q: adding VLAN 0 to HW filter on device eth0
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
jffs2 is not ready - marker found
procd: - early -
procd: - watchdog -
procd: - ubus -
procd: - init -
Please press Enter to activate this console.
[ 10.110000] NET: Registered protocol family 10
[ 10.130000] nf_conntrack version 0.5.0 (1979 buckets, 7916 max)
[ 10.150000] ip6_tables: (C) 2000-2006 Netfilter Core Team
[ 10.170000] Loading modules backported from Linux version master-2014-05-22-0-gf2032ea
[ 10.190000] Backport generated by backports.git backports-20140320-37-g5c33da0
[ 10.200000] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 10.250000] xt_time: kernel timezone is -0000
[ 10.290000] cfg80211: Calling CRDA to update world regulatory domain
[ 10.300000] cfg80211: World regulatory domain updated:
[ 10.310000] cfg80211: DFS Master region: unset
[ 10.320000] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 10.340000] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 10.350000] cfg80211: (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 10.370000] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[ 10.390000] cfg80211: (5170000 KHz - 5250000 KHz @ 160000 KHz), (N/A, 2000 mBm), (N/A)
[ 10.400000] cfg80211: (5250000 KHz - 5330000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[ 10.420000] cfg80211: (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[ 10.430000] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[ 10.450000] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[ 10.520000] PPP generic driver version 2.4.2
[ 10.530000] NET: Registered protocol family 24
[ 10.570000] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 5390, rev 0500 detected
[ 10.590000] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620 detected
[ 17.050000] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[ 17.080000] jffs2_build_filesystem(): unlocking the mtd device... done.
[ 17.090000] jffs2_build_filesystem(): erasing all blocks after the end marker... [ 19.040000] 8021q: adding VLAN 0 to HW filter on device eth0
[ 19.070000] device eth0.1 entered promiscuous mode
[ 19.080000] device eth0 entered promiscuous mode
[ 19.110000] br-lan: port 1(eth0.1) entered forwarding state
[ 19.120000] br-lan: port 1(eth0.1) entered forwarding state
[ 21.120000] br-lan: port 1(eth0.1) entered forwarding state
通过在secureCRT上的测试:
root@OpenWrt:/# dmesg | grep ttyS
[ 0.000000] Kernel command line: console=ttyS1,57600 rootfstype=squashfs,jffs2
[ 0.720000] 10000500.uart: ttyS0 at MMIO 0x10000500 (irq = 13) is a 16550A
[ 0.730000] 10000c00.uartlite: ttyS1 at MMIO 0x10000c00 (irq = 20) is a 16550A
[ 0.750000] console [ttyS1] enabled, bootconsole disabled
root@OpenWrt:/#
root@OpenWrt:/#
root@OpenWrt:/#
root@OpenWrt:/# ls /dev/ttyS*
/dev/ttyS0 /dev/ttyS1
root@OpenWrt:/#
root@OpenWrt:/#
root@OpenWrt:/# echo hello > /dev/ttyS1
hello
root@OpenWrt:/#
root@OpenWrt:/#
root@OpenWrt:/# echo hello > /dev/ttyS0
root@OpenWrt:/#
root@OpenWrt:/#
root@OpenWrt:/# echo hello > /dev/ttyS0
root@OpenWrt:/#
在下真的不知道问题处在哪里,使用示波器测量的时候,一直是高电平,不知道有没有哪位朋友做过相关的串口扩展,希望能够指点在下!!!谢谢
看你们模组的电路图,电路图那里说明了uartf是从哪个gpio引出的,你们要按照你们的gpio引出去配置。
我也遇到这个问题,后面排查是因为我使用的模组,它的uartf是要配置成"i2s uartf",所以用百度过来的配置,配置成
gpio uartf是不顶用的,因为一般的板子都是引出"gpio uartf"
gpio uartf 和i2s uartf,他们使用gpio口是不一样的,前者使用GPIO 7 8 9 10,后者使用GPIO 11 12 13 14
在mt7620a.dtsi 里面有个chosen是默认使用哪个串口作为输出, 默认波特率为多少。