Xiaomi WiFi Router 3G

What is the difference between Xiaomi mi wifi 3G and mi wifi 3?
I have the wifi 3, tried to flash the firmware as described (using mtd) and the router no longer boots.
I'll attempt to connect using serial console later, but I'd like to know what are my options...

They are not the same thing.
3G uses MT7621 SOC while Router 3 uses MT7620.
You cant mix those images.
If you have access to serial console you should be able to recover to stock.
If you deleted the kernel0 partition then best approach is to boot from TFTP kernel image for Router 3 and from it you can flash my kernel0 partition backup with mtd.
Then copy stock image to usb and rename to miwifi.bin,after that instert USB into router and while booting hold reset button until you that LED is flashing orange and you should alse be able to see failsafe working in console

Wow, thanks for the detailed how-to!
Is there some image for Router 3 then? I failed to find one :frowning:

I have been working on it,but it is still not functional.
Since mine R3 is currently bricked I cant test images.
I have published new images that uses @dissent1 work to preserve kernel0 for recovery purposes

hello,
Please can you explain better for noobs like me :sweat_smile:
What i understood :

  1. flash the developper firmware to enable SSH: http://bigota.miwifi.com/xiaoqiang/rom/r3g/miwifi_r3g_firmware_c2175_2.25.122.bin
  2. login with SSH (admin/admin) ???
  3. type these commands to flash kernel and rootfs :

mtd write lede-ramips-mt7621-mir3g-squashfs-kernel1.bin kernel1
mtd write lede-ramips-mt7621-mir3g-squashfs-rootfs0.bin rootfs0
mtd erase kernel0
reboot

and then what to do with this file:
https://downloads.lede-project.org/snapshots/targets/ramips/mt7621/lede-ramips-mt7621-mir3g-squashfs-sysupgrade.tar
how to flash it ??

Thank you for your help in a step by step procedure...:anguished:

This is how I got LEDE installed. Some of the steps can be done differently. I used this for inspiration https://www.youtube.com/watch?v=CSHNyo5QxaQ

  1. Unbox router
  2. Connect to the router using WiFi
  3. Goto http://192.168.31.1
  4. Go through the wizard to set passwords for the router + wifi
  5. Reconnect to the router using WiFi
  6. Goto http://192.168.31.1
  7. Logon and find the page where you can upgrade the firmware look for a big yellow dot with an "i" inside. You will see the version number of the router and there is a button below where you can browse for a file. Flash miwifi_r3g_firmware_c2175_2.25.122.bin (developer firmware) and wait a few minutes.
  8. Download https://play.google.com/store/apps/details?id=com.xiaomi.router to your phone/tablet (there is also an iOS app)
  9. Open "Mi Wi-Fi" app (and sign-up) and sign-in to your account. Router will be detected and added to your account (assuming you are connected to the WiFi on the router and the routers WAN port is connected to Internet).
  10. On a PC, visit http://d.miwifi.com/rom/ssh and sign-in to you account. You will get to a page that should display your router, the root password and a download button. Hit the button to get miwifi_ssh.bin
  11. Format USB drive using FAT32 and copy miwifi_ssh.bin, lede-ramips-mt7621-mir3g-squashfs-kernel1.bin and lede-ramips-mt7621-mir3g-squashfs-rootfs0.bin to the USB drive
  12. Cut the power the router, put the USB drive in the router, press and hold "reset" button (with a paper-clip), power on the router (while holding reset). When the router starts flashing yellow release the reset button. Wait until router has rebooted and you should (finally...) have SSH access.
  13. Login to the router using SSH using the "root" as username and the (root) "password" from http://d.miwifi.com/rom/ssh
  14. In SSH console
    cd /extdisks/sda1 (can be different if you remove and reinsert the usb stick)
    mtd write lede-ramips-mt7621-mir3g-squashfs-kernel1.bin kernel1
    mtd write lede-ramips-mt7621-mir3g-squashfs-rootfs0.bin rootfs0
    nvram set flag_last_success=1
    nvram commit
    reboot
  15. LEDE should be installed and available at 192.168.1.1 (with WiFi disabled I assume)
  16. Upgrading to a newer snapshot can be done using the regular methods (from the command-line using sysupgrade or through LuCI) using lede-ramips-mt7621-mir3g-squashfs-sysupgrade.tar

Thanks @dissent1 for adding the router to LEDE. Both WiFi radios seems to work (2.4Ghz on 20Mhz, 5Ghz on 80MHz) and I have also tested USB3 port with success. I have not tested 40MHz for 2.4Ghz as it does not make sense for me (very crowded WiFi). 5Ghz radio does not seem to like DFS channels (I get "DFS start_dfs_cac() failed, -1" in the log). The channels seems to work nicely when disabling DFS (by removing the requirement from regdb.txt for the selected country before building firmware) so this is likely "just" a DFS issue.
I can't say anything about stability yet. I'll probably try to replace my TP-Link Archer C5 with the Xiaomi router within the next week and then I will have to see how well it performs and how stable it is.

5 Likes

THANK YOU VERY MUCH :heart_eyes: :heart_eyes:

@hammer

Thanks a lot! Just ordered two devices - current price is 33,34€ ATM!

Hardware seems to bee the same as build in DIR-860L.... the OpenWrt wiki contains some promising features :wink:

Performance - Software

OpenVPN 2.3.10 (mbedTLS, AES-192-CBC, no compression), 24.8 Mbits/sec (one-way) - r48717 (same switches as above)

wireguard - 0.0.20170810-1: I have made wireguard performance tests on this device on a 150Mbit cable connection. Iperf 1 stream - 600s of traffic. Powerfull server with 1Gbit » Wireguard » DIR 860L » powerfull PC in DIR 860Ls lan. So 860L is a vpn Gateway for that lan.

[ 3] 0.0-600.1 sec 9.93 GBytes 142 Mbits/sec

Its the best VPN result i have ever seen last 5 years on a openwrt device, so i shared it here.

Is there any way to revert back to stock firmware after deleting the kernel0 partition, I do not have a backup either

Well,I am sure that someone has backup of original kernel0 partition.
That is only way

@das1969 here is the extracted kernel0 from my router. I have never tried this before so it would be nice with feedback if my method is correct and the backup is usable.

I did this (/home is my usb drive):

  • root@LEDE_Mi_Router_3G:~# cat /proc/mtd
    dev: size erasesize name
    mtd0: 00080000 00020000 "Bootloader"
    mtd1: 00040000 00020000 "Config"
    mtd2: 00040000 00020000 "Bdata"
    mtd3: 00040000 00020000 "Factory"
    mtd4: 00040000 00020000 "crash"
    mtd5: 00040000 00020000 "crash_syslog"
    mtd6: 00040000 00020000 "reserved0"
    mtd7: 00400000 00020000 "kernel_erase"
    mtd8: 00400000 00020000 "kernel"
    mtd9: 07580000 00020000 "ubi"
  • root@LEDE_Mi_Router_3G:~# cat /dev/mtd7 > /home/kernel0.bin

Here is the result: kernel0.bin

1 Like

Dont use that method.
It would be better to use dd.
So you can use dd if=/dev/mtdx of=/tmp/kernel0.bin

Change x in mdt with partition number.
But he needs stock kernel, not one that ships with LEDE

2 Likes

Oh dear. I think I've bricked my router. Router boots with orange light solid, which flickers once every ten seconds or so. With an ethernet cable attached to PC, get constant cycle of identifying network and then disconnected.

Tried 30-30-30 reset already. reset button seems to have no effect

Yes,that means that it tries to load kernel and then after failure reboots.
You can recover it,but serial connection is needed.

Sorry to hear about the bricked router. I just tried the dd method

  • root@LEDE_Mi_Router_3G:~# dd if=/dev/mtd7 > /home/kernel0_org.bin

and tried a compare

  • root@LEDE_Mi_Router_3G:/# cmp /home/kernel0.bin /home/kernel0_org.bin

fortunately the files are identical. I did not run "mtd erase kernel0" when I installed LEDE but used "nvram set flag_last_success=1" + "nvram commit" so I assume the partition is the stock partition (just renamed from kernel0 to kernel_erase). A quick look in the file also shows the text "MIPS OpenWrt Linux-3.10.14" near the top.

If the usb recovery doesn’t work for you know then check this
https://lede-project.org/docs/user-guide/failsafe_and_factory_reset

But if you flashed that dump into kernel partition, then usb recovery should work

1 Like

Well that is different since you didnt delete the kernel.
I am saying that it is much better to use appropriate tools like dd that standard output append.

1 Like

Ordered a USB TTL UART adapter, should be here in a few days. Thanks for your help guys, I'll check back when I've (hopefully) got it going again.

1 Like

AFAIK most router hardware uses 3.3v logic so be sure the USB adapter uses 3.3v too

I've had some USB adapters that claim to be 3.3v but actually use 5v so test it with a multimeter first

Thanks @hammer for the detailed procedure, it worked for me!

Some issues I had, hope my experience could help others who are facing the same issues:

1st I tried to enable the ssh without flashing miwifi_r3g_firmware_c2175_2.25.122.bin, I just followed the procedure to flash miwifi_ssh.bin and not only it didn't enable SSH, but after that I tried to flash c2175_2.25.122.bin and the router stopped responding for 10 min, resetting the router (pressing the reset button while the router is on until there is a led indication) solved that issue for me.
I didn't need to re-flash the miwifi_ssh.bin again, ssh was already enabled at that point.

The 2nd issue I faced was the router IP set to 192.168.1.1 (DHCP: 192.168.1.x) which is same as my existing router, this means I was not able to get it connected to the internet when connecting the WAN port to the LAN of my existing router.
to resolve this I had to change the mir3g default IP address, I typed the following $> vi /etc/config/network
searched for:

config interface 'lan'
         .....
         option ipaddr '192.168.1.1'

and changed 192.168.1.1 to 192.168.2.1 , after that I executed: $> reboot

3rd issue was the development LEDE FW does not have GUI (LUCI) installed.
to install LUCI (after I solved the DHCP issue), I followed the regular procedure:
$> opkg update
$> opkg install luci

Last issue was enabling radio0 WIFI AP (2.4GHz) on LUCI, it appears that we have to set radio0 channel to some number and not leaving it set to auto, leaving it set to auto will not allow enabling the radio0 AP. Same issue doesn't occur with radio1 (5GHz)

1 Like