一次关于 TP-LINK TL-WR340G+ 失败的 DIY

这台 WR340G+ 是 @liuhk388 同学的,据说长期当砖使,这次拿出来是想看看还能不能折腾点东西出来。结果折腾之后果然只能当砖使了。

P1130467

机器外观,以前玩过 11g 路由器的同学们应该很熟悉了,但是我还是第一次接触这类机器。

P1130409

硬件版本 V4.0 ,这是悲剧的开始。

P1130402

拆开并焊好 TTL UART 线。原机自带 1M×4bank×16bit 7ns SDRAM 和 2MB 的 SPI NOR Flash ,没啥折腾的余地,遂以 4M×4bank×16bit 的 32MB 6ns SDRAM EM63A165TS-6G 和 16MB 的 MX25L12835F 替代之。原机跑的 VxWorks ,默认 baud rate 是 38400bps ,跟大部分同类机器的 9600bps 略不同。

P1130410

换下来的部件是 ESMT 的 M12L64164A-7T 和 Eon 的 EN25F16 。

P1130403

SoC 是 Atheros 的 AR2317 ,MIPS32 4Kc 核心,184MHz ,从今天的角度看运算能力比较有限。值得一提的是在 11g 的时代 Atheros 就实现了片上集成完整的 RF (类似于 Ralink 的 RT5350 ),以及直接映射到内存地址空间的 SPI Flash 访问( Ralink 到现在都是只提供硬件 SPI 接口,Flash 的驱动和读写均由软件完成,引导时就靠 ROM Code )。

P1130404

这个是一切 headache 的根源—— Atheros S26 系列 AR8236 交换机。网上改机成功的 WR340G+ 都是用 Marvell 88E6060 交换机的版本,它有详细的手册可供查询,但是 Atheros S26 交换机是找不到多少资料的。

P1130405

供电部分由一只 34063 负责。

P1130406

供电部分的功率 BJT 用的 B772 。

P1130408

板子背面,没啥内容。

硬件说完了,说软件部分吧。由于机器出厂的系统是 VxWorks ,所以机器里面是没有可用的 bootloader 的,网上也找不到现成的。据查跑 Linux 的 AR231x 一般用 redboot (上次跟这玩意打交道还是在玩 Intel NPFamily SoC 的时候),所以下载了一份源码。编译的时候倒是没啥问题,但是烧入系统之后发现交换机不能初始化:上电后会卡住几十秒,然后 athrs26 驱动报错说和交换芯片通信超时。这不是主要的问题,如果烧入系统后 Linux 能正确初始化 AR8236 的话也没啥问题。于是用 zmodem 把编译好的 OpenWRT 通过串口送进去了(重新享受一把拨号上网时代下载 MP3 的感觉!)。结果 OpenWRT 启动后无线正常,找不到有线 PHY (交换芯片),LAN 口 WAN 口通通没有,这让人咋用?

由于没有现成的资料,那就只好瞎折腾了。不幸的是,在折腾了几次 bootloader 并且仍然一头雾水以后,SPI Flash 的焊盘光荣牺牲了。考虑到这台机器本身比较鸡肋,所以也就没有继续修理了。

附上机器健在时调试过程中的内核输出一段以供参考。

RedBoot> fis load vmlinux
RedBoot> go
[    0.000000] Linux version 3.3.8 (blogic@Debian-60-squeeze-64-minimal) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Sat Mar 23 17:43:48 UTC3
[    0.000000] gpiochip_add: registered GPIOs 0 to 21 on device: ar2315-gpio
[    0.000000] ar2315-gpio: registered 22 GPIOs
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 00019064 (MIPS 4KEc)
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 01000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x00001000
[    0.000000] Movable zone start PFN for each node
[    0.000000] Early memory PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00001000
[    0.000000] Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 4064
[    0.000000] Kernel command line:  console=ttyS0,9600 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 64 (order: -4, 256 bytes)
[    0.000000] Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Primary instruction cache 16kB, VIPT, 4-way, linesize 16 bytes.
[    0.000000] Primary data cache 16kB, 4-way, VIPT, no aliases, linesize 16 bytes
[    0.000000] Memory: 12920k/16384k available (2285k kernel code, 3464k reserved, 353k data, 168k init, 0k highmem)
[    0.000000] NR_IRQS:128
[    0.000000] console [ttyS0] enabled, bootconsole disabled
[    0.000000] console [ttyS0] enabled, bootconsole disabled
[    0.010000] Calibrating delay loop... 183.70 BogoMIPS (lpj=918528)
[    0.110000] pid_max: default: 32768 minimum: 301
[    0.120000] Mount-cache hash table entries: 512
[    0.130000] NET: Registered protocol family 16
[    0.200000] bio: create slab  at 0
[    0.220000] Switching to clocksource MIPS
[    0.250000] NET: Registered protocol family 2
[    0.300000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.390000] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[    0.470000] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[    0.550000] TCP: Hash tables configured (established 512 bind 512)
[    0.620000] TCP reno registered
[    0.660000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.730000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.800000] NET: Registered protocol family 1
[    0.860000] WARNING: broken board data detected
[    0.920000] Fixing up empty mac addresses
[    0.960000] Radio config found at offset 0x10000(0x100)
[    1.030000] Radio MAC is blank; using board-data
[    1.110000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    1.180000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    1.290000] msgmni has been set to 25
[    1.340000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[    1.430000] io scheduler noop registered
[    1.480000] io scheduler deadline registered (default)
[    1.540000] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    1.640000] serial8250: ttyS0 at MMIO 0xb1100003 (irq = 37) is a 16550A                       
[    1.750000] gpiodev: gpio device registered with major 253                                    
[    1.830000] Searching for RedBoot partition table in spiflash at offset 0x3d0000              
[    1.970000] Searching for RedBoot partition table in spiflash at offset 0x3e0000              
[    2.110000] 5 RedBoot partitions found on MTD device spiflash
[    2.180000] Creating 5 MTD partitions on "spiflash":
[    2.240000] 0x000000000000-0x000000030000 : "RedBoot"
[    2.310000] 0x000000030000-0x0000002ed65c : "vmlinux"
[    2.370000] mtd: partition "vmlinux" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[    2.540000] 0x0000003e0000-0x0000003ef000 : "FIS directory"
[    2.610000] 0x0000003ef000-0x0000003f0000 : "RedBoot config"
[    2.690000] 0x0000003f0000-0x000000400000 : "boardconfig"
[    2.840000] eth0: Atheros AR231x: 26:3f:79:54:e2:53, irq 4
[    3.170000] ar231x_eth_mii: probed
[    3.230000] eth0: Atheros AR8236 switch driver attached.
[    4.430000] eth0: attached PHY driver [Atheros AR8216/AR8236/AR8316] (mii_bus:phy_addr=0:00)
[    4.550000] TCP cubic registered
[    4.590000] NET: Registered protocol family 17
[    4.640000] Bridge firewalling registered
[    4.690000] 8021q: 802.1Q VLAN Support v1.8
[    4.740000] VFS: Cannot open root device "(null)" or unknown-block(0,0)
[    4.820000] Please append a correct "root=" boot option; here are the available partitions:
[    4.920000] 1f00             192 mtdblock0  (driver?)
[    4.980000] 1f01            2805 mtdblock1  (driver?)
[    5.040000] 1f02              60 mtdblock2  (driver?)
[    5.110000] 1f03               4 mtdblock3  (driver?)
[    5.170000] 1f04              64 mtdblock4  (driver?)
[    5.230000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

最后,我去掉了交换芯片的所有 boot strapping 电阻,并且切断了晶体和 SoC 间的一处连接,让这块砖头彻底变成了一台 5 端口以太网交换机。

《一次关于 TP-LINK TL-WR340G+ 失败的 DIY》上的6个想法

  1. 博主的博文很有意思额
    之前实习的公司是做光纤路由的,看pcb原理图有一个51单片机(F330的)感觉很奇怪,注释是spi,但是看板子上又没有这个单片机,估计是那博主说的升级到软件实现flash读写了。

回复 K 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据