Support for Xiaomi Mi 3C

For build OpenWrt 19.07.05

git clone -b openwrt-19.07 --single-branch https://github.com/openwrt/openwrt.git
cd openwrt/
git reset --hard c37eb9a9f9d43aa3231a607387754479886edf0d

./scripts/feeds update -a
./scripts/feeds install -a

1 Like

Dear @eduardo010174
thanks for compiling and sharing.
But ... I see that the port assignment is still wrong :frowning:
It hasn't changed in your last three builds.

ok i try now with --hard option
its have 3 options of reset.
i don't think what its best

i try now with --hard

https://drive.google.com/file/d/1KYYFHKByX6ijflcEUDKjVJJv0ykigSth/view?usp=sharing
@minax007

if not work i don't think more ...

1 Like

i'm wait for you feedback when you have time. @minax007

1 Like

I am testing :slight_smile: It will take a while. But this one looks good. I will write more as soon as I have the results.

2 Likes

Dear @eduardo010174,
your last build is excellent! :+1:
I have figured out that I have to reset the firmware and to reconfigure all settings, because the original Nano-build configuration file which I was reusing (with the wrong port assignments) had led to a bug.
After reconfiguring all settings it works perfectly.
I have checked the port assignments and see that those are shown correctly under "Switch" settings.
Furthermore I did some extensive WiFi testings and see that everything works correctly.
Not a single disconnection or signal loss.
Everything works like in the stock firmware.
The datarate reaches the maximum possible of my ISP.
The jitter in WiFi is higher than with the R2100, which I am using as my home router, but at the same level as the stock Xiaomi firmware with the Mi-3C.
Furthermore the WiFi range test shows that in 10 meters distance with two walls in between I still have 70% of maximum datarate, but the jitter goes up. Still not critical and not worse than stock firmware.
At 15 meters distance with three walls in between it does still connect to my smartphone but the datarate is very low. But that is exactly the configuration where also the Xiaomi stock firmware reaches with its suspect "wall penetration" feature its limit.
Final conclusion: Excellent work!
Please continue to make the naming adaptions to Mi-3C.
And if God wills, we will be able to see the pull request soon :+1:
Kind regards to Portugal :slight_smile:

2 Likes

thanks.
humm i try add LNA enable in dts if its gen diff

I confirm for read OEM bootlog which router have external LNA on board.

[04040D08][04040C0A]
DDR Calibration DQS reg = 0000878A

U-Boot 1.1.3 (Jun  6 2017 - 17:00:22)

Board: Ralink APSoC DRAM:  64 MB
Power on memory test. Memory size= 64 MB...OK!
relocate_code Pointer at: 83fa8000
RT2880_RSTSTAT_REG 0xc0030000
***************************
Board power on Occurred
***************************
flash manufacture id: ef, device id 40 18
find flash: W25Q128BV
Enable eLNA
env is right!
============================================
Ralink UBoot Version: 4.3.0.0
--------------------------------------------
ASIC 7628_MP (Port5<->None)
1 Like

Dear @anjmis04,
please try the latest build of @eduardo010174.
I have tested it and it works fine.

1 Like

If possible send my the full dmesg of ssh
I need read the log for search for lna.

1 Like

@eduardo010174 and @minax007
Kudos to you guys, you did it.
Getting Stable connection with wifi.
Port issue solved on all the ports.
Everything working good.
They should now officially support it.

1 Like
login as: root
root@192.168.1.1's password:


BusyBox v1.30.1 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 19.07.5, r11257-5090152ae3
 -----------------------------------------------------
root@OpenWrt:~# dmesg
[    0.000000] Linux version 4.14.209 (omen@OMEN-HP) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r11257-5090152ae3)) #0 Sun Dec 6 07:31:03 2020
[    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: MediaTek MT7628AN ver:1 eco:2
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
[    0.000000] MIPS: machine is MiWiFi Nano
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    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] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 804a3350, node_mem_map 81000040
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] random: get_random_bytes called from start_kernel+0x90/0x47c with crng_init=0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00020d60
[    0.000000] Readback ErrCtl register=00020d60
[    0.000000] Memory: 58700K/65536K available (3710K kernel code, 174K rwdata, 868K rodata, 1192K init, 200K bss, 6836K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] intc: using register map from devicetree
[    0.000000] CPU Clock: 580MHz
[    0.000000] timer_probe: no matching timers found
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000011] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.015373] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.087595] pid_max: default: 32768 minimum: 301
[    0.096942] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.109901] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.129481] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.148857] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.160964] pinctrl core: initialized pinctrl subsystem
[    0.172233] NET: Registered protocol family 16
[    0.206111] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.217310] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.228438] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.243891] clocksource: Switched to clocksource MIPS
[    0.254986] NET: Registered protocol family 2
[    0.264361] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.278064] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.290587] TCP: Hash tables configured (established 1024 bind 1024)
[    0.303298] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.314765] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.327378] NET: Registered protocol family 1
[    0.335923] PCI: CLS 0 bytes, default 32
[    0.339213] Crashlog allocated RAM at address 0x3f00000
[    0.351057] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.369517] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.380960] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.410574] io scheduler noop registered
[    0.418247] io scheduler deadline registered (default)
[    0.429168] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.442860] console [ttyS0] disabled
[    0.449886] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
[    0.467716] console [ttyS0] enabled
[    0.474750] bootconsole [early0] disabled
[    0.484182] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    0.495759] m25p80 spi0.0: gd25q128 (16384 Kbytes)
[    0.500668] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.507159] Creating 4 MTD partitions on "spi0.0":
[    0.512028] 0x000000000000-0x000000030000 : "u-boot"
[    0.517989] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.524249] 0x000000040000-0x000000050000 : "factory"
[    0.530222] 0x000000050000-0x000001000000 : "firmware"
[    0.539152] 2 uimage-fw partitions found on MTD device firmware
[    0.545233] Creating 2 MTD partitions on "firmware":
[    0.550279] 0x000000000000-0x000000185947 : "kernel"
[    0.556209] 0x000000185947-0x000000fb0000 : "rootfs"
[    0.562023] mtd: device 5 (rootfs) set to be root filesystem
[    0.569325] 1 squashfs-split partitions found on MTD device rootfs
[    0.575674] 0x0000003e0000-0x000000fb0000 : "rootfs_data"
[    0.582751] libphy: Fixed MDIO Bus: probed
[    0.597849] rt3050-esw 10110000.esw: link changed 0x00
[    0.604044] mtk_soc_eth 10100000.ethernet: generated random MAC address 26:c7:34:8c:66:f6
[    0.613061] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.623267] NET: Registered protocol family 10
[    0.631816] Segment Routing with IPv6
[    0.635721] NET: Registered protocol family 17
[    0.640281] 8021q: 802.1Q VLAN Support v1.8
[    0.655083] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    0.668731] Freeing unused kernel memory: 1192K
[    0.673325] This architecture does not have kernel memory protection.
[    1.835838] init: Console is alive
[    1.839536] init: - watchdog -
[    2.375490] random: fast init done
[    3.085602] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.176861] usbcore: registered new interface driver usbfs
[    3.182521] usbcore: registered new interface driver hub
[    3.188085] usbcore: registered new device driver usb
[    3.199367] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    3.207837] ehci-platform: EHCI generic platform driver
[    3.223470] phy phy-10120000.usbphy.0: remote usb device wakeup disabled
[    3.230298] phy phy-10120000.usbphy.0: UTMI 16bit 30MHz
[    3.235630] ehci-platform 101c0000.ehci: EHCI Host Controller
[    3.241489] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[    3.249661] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[    3.283935] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[    3.291285] hub 1-0:1.0: USB hub found
[    3.295545] hub 1-0:1.0: 1 port detected
[    3.302822] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    3.310831] ohci-platform: OHCI generic platform driver
[    3.316461] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
[    3.323379] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[    3.331549] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[    3.409005] hub 2-0:1.0: USB hub found
[    3.413197] hub 2-0:1.0: 1 port detected
[    3.421648] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    3.439563] init: - preinit -
[    4.811170] rt3050-esw 10110000.esw: link changed 0x00
[    4.998516] random: procd: uninitialized urandom read (4 bytes read)
[    8.221177] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[    8.256369] urandom-seed: Seed file not found (/etc/urandom.seed)
[    8.437785] procd: - early -
[    8.440833] procd: - watchdog -
[    8.659720] rt3050-esw 10110000.esw: link changed 0x01
[    9.160563] procd: - watchdog -
[    9.164176] procd: - ubus -
[    9.411905] random: ubusd: uninitialized urandom read (4 bytes read)
[    9.491442] random: ubusd: uninitialized urandom read (4 bytes read)
[    9.498528] random: ubusd: uninitialized urandom read (4 bytes read)
[    9.506062] procd: - init -
[   10.301414] kmodloader: loading kernel modules from /etc/modules.d/*
[   10.480816] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   10.515002] Loading modules backported from Linux version v4.19.137-0-gc076c79e03c6
[   10.522776] Backport generated by backports.git v4.19.137-1-0-g60c3a249
[   10.546726] ip_tables: (C) 2000-2006 Netfilter Core Team
[   10.572664] nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
[   10.697759] xt_time: kernel timezone is -0000
[   10.837191] mt76_wmac 10300000.wmac: ASIC revision: 76280001
[   10.854897] mt76_wmac 10300000.wmac: Invalid MAC address, using random address 7a:da:db:06:42:f0
[   10.864642] urngd: v1.0.2 started.
[   11.063017] random: crng init done
[   11.066527] random: 6 urandom warning(s) missed due to ratelimiting
[   11.876186] mt76_wmac 10300000.wmac: Firmware Version: 20151201
[   11.882206] mt76_wmac 10300000.wmac: Build Time: 20151201183641
[   11.903938] mt76_wmac 10300000.wmac: firmware init done
[   12.070249] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   12.099520] PPP generic driver version 2.4.2
[   12.123540] NET: Registered protocol family 24
[   12.147217] kmodloader: done loading kernel modules from /etc/modules.d/*
[   35.780233] rt3050-esw 10110000.esw: link changed 0x00
[   39.609385] rt3050-esw 10110000.esw: link changed 0x01
[   41.265670] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   41.272694] jffs2_build_filesystem(): unlocking the mtd device...
[   41.279910] done.
[   41.288208] jffs2_build_filesystem(): erasing all blocks after the end marker...
[   41.813552] br-lan: port 1(eth0.2) entered blocking state
[   41.826881] br-lan: port 1(eth0.2) entered disabled state
[   41.832729] device eth0.2 entered promiscuous mode
[   41.837644] device eth0 entered promiscuous mode
[   41.902311] br-lan: port 1(eth0.2) entered blocking state
[   41.907866] br-lan: port 1(eth0.2) entered forwarding state
[   41.913732] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   42.958985] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   88.893351] done.
[   88.895390] jffs2: notice: (1144) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   89.114250] overlayfs: upper fs does not support tmpfile.
[   91.323404] rt3050-esw 10110000.esw: link changed 0x00
[   94.479140] rt3050-esw 10110000.esw: link changed 0x04
[  117.204261] rt3050-esw 10110000.esw: link changed 0x05
[  191.260314] rt3050-esw 10110000.esw: link changed 0x01
[  194.159139] rt3050-esw 10110000.esw: link changed 0x11
[  291.301981] rt3050-esw 10110000.esw: link changed 0x00
[  292.004756] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  292.020987] br-lan: port 2(wlan0) entered blocking state
[  292.026467] br-lan: port 2(wlan0) entered disabled state
[  292.032237] device wlan0 entered promiscuous mode
[  292.094427] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[  292.101096] br-lan: port 2(wlan0) entered blocking state
[  292.106555] br-lan: port 2(wlan0) entered forwarding state
[  294.295535] rt3050-esw 10110000.esw: link changed 0x01
[  295.196142] rt3050-esw 10110000.esw: link changed 0x11
root@OpenWrt:~#

Dear @anjmis04
thank you very much for confirming :slight_smile:
Now we have almost reached our goal with the support of @eduardo010174 of having OpenWrt support for the Xiaomi Mi-3C router :+1:

1 Like

humm I need
fix mac's

[    0.604044] mtk_soc_eth 10100000.ethernet: generated random MAC address 26:c7:34:8c:66:f6
[    0.613061] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[   10.837191] mt76_wmac 10300000.wmac: ASIC revision: 76280001
[   10.854897] mt76_wmac 10300000.wmac: Invalid MAC address, using random address 7a:da:db:06:42:f0
[   11.876186] mt76_wmac 10300000.wmac: Firmware Version: 20151201
[   11.882206] mt76_wmac 10300000.wmac: Build Time: 20151201183641
[   11.903938] mt76_wmac 10300000.wmac: firmware init done

fix eLNA

and need more work

it's possible send my screen from breed for macs

1 Like

One Issue that I found with wireless is that after long hours of connection, there is no internet access on wifi and at the same time I am unable to access OpenWrt Page through wifi, I have to disconnect and reconnect. but on ethernet, it works fine. I guess it must have something to do with DHCP lease expiration?

hey guys, does anybody have the stock bootloader of the mi router 3c.
I want to go back to stock rom is there any guide to go back

need the original mtd backup

Hi @Kale , do you have breed bootloader installed?

I have the dump file with stock rom. You can flash it by breed programmers firmware
https://drive.google.com/file/d/16SknRdbqLUawoWrJzDwzKjob02KtWKFi/view?usp=sharing

thanks i will try it and yes i have breed installed

is this a full backup or I just need to flash the rom part in breed bootloader

Dear @Kale
the file shared by @anjmis04 is a full flash file.
Flashing only the stock bootloader does not provide you the option to flash a stock firmware.
I had tested this intesively but it doesn't work even though it provides a web interface for flashing the stock firmware. But it doesn't work.
The only way to return to stock is to flash a full flash file.
Either by BREED, or via SPI flasher.
In case you want to flash only the stock bootloader then take the file from @anjmis04 and create a bootloader.img file out of it by cutting off everything which comes after the bootloader in a HEX editor.
But as mentioned this will lead you to a situation, by which you cannot flash the stock firmware and also not BREED anymore.
The result is a brick, which can only be resolved by SPI flasher.

1 Like