Xiaomi mi wifi 3 support

I'm using @ptpt52's build for production. WiFi is not working, when using 2.4 and 5 GHz in parallel. Besides from that, I'm happy. Too bad, it won't be officially supported.

1 Like

I think I just successfully bricked my r3 by accidentally trying to flash a 3g kernel1 / rootfs0 to a 3 device:
Now immediately after the LAN/WAN port leds flash, the status LED just glows orange. Holding the reset button and connecting a USB stick with a miwifi.bin does nothing.

Hooking up a serial connection via rx/tx/ground shows this (what I would not even call "gibberish", I used 115200 8 1)
▒@▒▒>▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ H▒▒▒~q▒▒▒▒▒`▒▒▒p▒▒▒▒▒▒<▒▒>▒▒▒▒▒▒@▒▒▒▒▒▒▒▒ ▒▒▒▒8▒▒~▒▒▒▒▒▒▒▒▒~▒>▒▒~~>>~>▒~▒▒▒▒▒▒▒▒▒▒▒

Any idea? If not I am willing to send this brick to anyone who wants to try his/her luck.

u need a cp2102 or pl2303 usb to ttl converter..regular serial won't work and it's recoverable, don't worry

OK, I guess you were right: I tried with a pl2303, now I get this:

U-Boot 1.1.3 (Oct 31 2016 - 17:12:26)

Board: Ralink APSoC DRAM:  128 MB
Power on memory test. Memory size= 128 MB...OK!
relocate_code Pointer at: 87fb8000
enable ephy clock...done. rf reg 29 = 5
SSC disabled.
!!! nand page size = 2048, addr len=4
..============================================
Ralink UBoot Version: 4.2.S.1
--------------------------------------------
ASIC 7620_MP (Port5<->None)
DRAM_CONF_FROM: Auto-detection
DRAM_TYPE: DDR2
DRAM component: 1024 Mbits
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: NAND Flash
Date:Oct 31 2016  Time:17:12:26
============================================
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768

 ##### The CPU freq = 580 MHZ ####
 estimate memory size =128 Mbytes

Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   9: Load Boot Loader code then write to Flash via TFTP.


3: System Boot system code via Flash.
Booting System 2
..ranand_erase_write: offs:40000, count:20000
.Done!
done
## Booting image at bc600000 ...
   Image Name:   MIPS OpenWrt Linux-4.14.61
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1961601 Bytes =  1.9 MB
   Load Address: 80001000
   Entry Point:  80001000

Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
commandline uart_en=0 factory_mode=0 mem=128m
No initrd
## Transferring control to Linux (at address 80001000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

Thats all, its stuck.
Between the "choose operation" and the "3" is like 100ms, I keep hitting 1 or 4 or 9 ... looks like I went into the serial-write-disabled trap: The tutorial I followed never mentioned "nvram set uart_en=1", it only had "nvram set flag_last_success=1" before the commit. Hmpf

Check out my post history. I explain the needed steps in details.

Hey, all miwifi-r3 owners
We know that latest kernel (probably 4.17/18) will break the nand driver and unless someone come up with a solution we r not seeing new builds very soon. By the time we can use PandoraBox that was taken down by the Chinese Govt. in last year. It looks like they r back again with new builds and new address https://downloads.pangubox.com/ .Those who don't know PandoraBox is basically the chinese version of openwrt which uses closed source ralink drivers to get better wifi performance. Ya, the wifi performance is even better than stock firmware. I'm gonna post the flash and recovery process with details so hang tight cause this will be a big post. All necessary files r linked here https://mega.nz/#F!WY0FiTIS!Cl_Dzm4yhzrQZFazYG3i8Q

Flash instructions:

  1. get ssh access via dev firmware https://wiki.openwrt.org/toh/xiaomi/mir3
  2. we need the pandorabox bootloader and flash it, transfer/get the necessary files to cd /tmp
  3. in ssh:
cd /tmp
mtd write pb-boot-xiaomi3-20180726-0d8505f.img Bootloader
reboot

wait until the led turns into blue

  1. switch off the router through plug then hold the reset button and switch on the router, release the reset button. router will flashing breath style yellow led
  2. now go to 192.168.1.1, u will see a PandoraBox firmware upgrade page. select ur pandorabox firmware and upload it.
  3. access the PandoraBox openwrt by 192.168.1.1, default password is "admin". This has english language, just select the auto in language option.

Revert to stock:
So, we changed the bootloader and pandorabox firmware messed our kernel0 partition. We have to flash our stock bootloader and kernel0 partition back to their initial state. But there is a catch, the bootloader partition is locked in pandorabox firmware or any other normal openwrt firmware, u can't flash the bootloader back. We need a special version of lede/openwrt firmware for miwifi-r3 that compiled with unlocked bootloader option. I already added it in my mega link.

  1. access the pandorabox firmware upgrade page like before (see 4,5 above)
  2. select the firmware "lede-ramips-mt7620-miwifi-r3-squashfs-sysupgrade.bin" and upload it.
  3. login to the router 192.168.1.1, no password, just press login, configure password and enable ssh
  4. transfer/get ur necessary files (Bootloader.bin & kernel0.bin) to cd /tmp
  5. in ssh:
cd /tmp
mtd write Bootloader.bin Bootloader
mtd write kernel0.bin kernel0_rsvd
reboot
  1. access ssh again
fw_setenv flag_try_sys2_failed 1
reboot
  1. shortly after reboot router will start blinking red (means it's in recovery mode)
  2. insert a usb stick fat32 formatted with stock firmware renamed to miwifi.bin
  3. press the reset button for 1~2 sec until the red blinking turns into yellow.
  4. now chill the eff down for 4-5min and login to the router 192.168.31.1

If u have any ques just shoot it.

3 Likes

Are the steps the same if I am currently running Padavan? I have SSH access, so am I correct in assuming I can start from step 3?

If the bootloader/u-boot is unlocked then it's possible. can u post the cat /proc/mtd from padavan?, want to see the partition map @bbbenji

hi, i'm in the same situation of bbbenji. i'm on padavan firmware and i want to try pandorabox. this is my partition layout

dev:    size   erasesize  name
mtd0: 00040000 00020000 "Bootloader"
mtd1: 00080000 00020000 "BootEnv"
mtd2: 00540000 00020000 "Factory"
mtd3: 00140000 00020000 "Kernel"
mtd4: 00ec0000 00020000 "RootFS"
mtd5: 00080000 00020000 "Config"
mtd6: 00080000 00020000 "Storage"
mtd7: 06900000 00020000 "RWFS"
mtd8: 01000000 00020000 "Firmware_Stub"

also mtd command not work in padavan shell, it say command not found.
any help would be appreciated. thanks

The mtd command is "mtd_write" in padavan. I tried to flash the pandorabox bootloader but the .img file don't load in padavan. Probably have to erase the block, I wouldn't risk this. I checked prometheus script, that script is a mess, he did some nasty things to support that device. @notthesun

wait, it actually works..rename the .img to .bin like pb-boot-xiaomi3-20180726-0d8505f.bin then

cd /tmp
mtd_write write pb-boot-xiaomi3-20180726-0d8505f.bin Bootloader
reboot

wait until the led turns into blue then follow from step 4. @bbbenji @notthesun

Thanks @bakemono, I got it working. As a note, I didn't have change .img to .bin.

Anyway, I have PandoraBox up and running, but no internet. How can I troubleshoot this?

To go into some detail, I have two WAN interfaces showing. Both are red, have the same MAC and are without IP address.

u have to configure the first wan, 2nd one is for ipv6, select edit for the first wan interface then switch protocol to whatever u have, pppoe or static ip, u have to put ur isp given internet config there @bbbenji

I have regular cable broadband and WAN set to DHCP Client. I am assuming this is correct for my protocol. However, not working. There is no config for my ISP. @bakemono

is ur router's MAC address bind to ur isp ? try this, use the lan mac address to wan and wan mac address to lan..there is a option to change mac address

My router's MAC is not bound to my ISP. However, just tried it, still nothing.

did u use the regular openwrt firmware from here beside padavan ?

I used PandoraBox-ralink-mt7620-xiaomi-r3-2018-07-26-git-e717545-squashfs-sysupgrade from your Mega hosted archive.

no no, i'm just asking beside padavan did u ever use the normal openwrt firmware from here ? is the prblm happened with openwrt ?

Ok, sorry. Yes, I have used an OpenWRT build from this thread a few months ago. Internet worked just fine. I had other issues, wireless connectivity, which made me go back to Padavan.