Xiaomi Mi Router 4A Gigabit Edition (R4AG/R4A Gigabit) -- fully supported and flashable with OpenWRTInvasion

Edited:

nvm i used the wrong socket for the SOIC8 clip. now im getting a "No EEPROM/flash device found" soo it seems that i really need to plug the CH341a 3.3.v to the Router. oh well going to order a dupont cable

It's because I pulled rogerpueyo's PR and the earlier builds were based on a different patch. The switch layout is slightly different.

I also fell for the 3.3 volts, but they're not necessary. If you get the no EEPROM-error, something is wrong with the connection. Try to reattache the clip.
When flashing, one can see erase-errors - their root cause also is a clip that's not properly attached.

ahhh i see, i'll try it again later

Ok i was able to flash the edited .bin file to my router via CH341a spi, softbricked my router while doing it as well LOL because the spi flasher keeps on disconnecting had to switch it to my other USB port and it worked.

It got bricked when the flasher was done erasing the chip and was about to write the edited bin then suddenly the USB disconnected.

Anyway i got it back up and working, only step left is the serial port. Can anyone show me a picture on how you guys connect the USB serial port to the router?? also i've read that the black Ch341a programmer has a UART mode can anyone shed some light on how to us it so i dont have to get a USB to serial port adapter LOL!

Thanks!

Usually there is a jumper connector on the flasher to switch between flasher mode and TTL UART adapter mode. If I'm not mistaken, in mine, short pins 1-2 for flasher mode and short pins 2-3 for TTL UART adapter mode. If in doubt, please post pictures of your flasher (from the top and from below).

And yes, the USB port you connect it may make a big difference (for example some may not have enough power for some reason but others do).

Heres my Ch341a mini programmer. By jumper connector you mean the yellow sleeve?


once i switch the jumper connector to pins 2-3 what should i do next to connect it to the router?

Thanks!

Looks like It's the same as mine (see the pictures I put earlier on the thread).

Yes, the yellow connector, to switch to TTL UART mode you need to switch it to jumpers 2-3. When you connect it back to the computer, on Linux you should see a new /dev/ttyUSB(something) device, on windows you should see a new COM port appear.

Then you'll need some cables with "dupont" connectors, like these:
Selection_20191023(002)

Connect them to connect to the TXD, RXD and GND pins on that same row, to (respectively) the RXD, TXD and GND UART pins on the router's board. They are shown in the first posts, these are the ones:
https://forum.openwrt.org/uploads/default/original/2X/0/083791d2baf442f1fbc8ae18e5d99fa0b9cb0c66.jpeg

Unless you want to do some soldering, you'll probably need something like these pin headers (for me, they came with the flasher):
Selection_20191023(003)

You shouldn't need to solder them, as usually just placing this piece with 4 pins on top of the router's UART port holes just fits and makes enough contact (it did for me). Then use dupont (female to female) cables to connect the flasher to these pin headers, and thus to the router's UART port. This is how I did it, but you should be able to get the general idea should you want to do some other way.

Important:

  • do NOT connect the VCC pin, you only need to connect the other 3
  • GND connects to GND on the other side
  • TX from one side should connect to RX on the other side and vice versa

Finally use a terminal emulator (like putty on windows, or like minicom or screen on Linux, or equivalent on Mac) connected to the COM / ttyUSB port of the TTL adapter with baud rate 115200, and when you power on the router you should see its console and be able to interact with it like described in the first posts.

thanks! i'll purchase dupont connectors today.

1 Like

@araujorm thanks for the help! was able to successfully flash the router to Openwrt! the 4 pin that came with my flasher didn't fit the holes for the TX and RT port had to grab the 4 pin that came with my faulty CH341a programmer.

1 Like

There is a report at https://www.ise.io/whitepaper/sohopelessly-broken-2/ about how to get shell access on a Mi Router 3. Maybe something like that is present on 4A too? Or not, it was reported to Xiaomi late 2018 so it might be already fixed in the oldest available firmware.

nah that has been fixed the Mi Router 3 was released like 2016 and at that time they still offer Dev roms the newer routers offered by Xiaom doesn't have Dev roms. You need to install the dev rom to use the exploit to access the SSH.

If you use official dev firmware, you don't need to use exploit, just download the unlock key and flash it to your router, it will enable SSH access.

you can't download the unlock key anymore before i bought my 4A giga edition i had the Xiaomi Mi Router 3. With the recent update on the app and because the dev webpage is buggy you have to downgrade to a lower Dev rom then use the STOK exploit to get SSH.

I just downloaded mine for my mi wifi r3g v1.

Just make sure you are on HTTPS and not HTTP. The webpage will try to redirect you to HTTP, and if it did, change it to HTTPS, it will proceed to download.

Since commit 522d5ff42835f7ad01c090b9ea1863f5d56b91d3 (ramips: add support for Xiaomi Mi Wi-Fi Router 3G v2), the Xiaomi Mi Router 4A Gigabit edition is also supported by OpenWrt. Both devices have the same hardware and share the flashing procedure.

3 Likes

can we use the MiR3v2 snapshots on the Mi Router 4A? when i tried updating it via luci it gave me an error saying image check failed.

Force Flash

1 Like

Roger,

Do you know why the portmap layout was changed compared to your PR and how does it affect the functionality of the router?

Stock/Your PR:
mediatek,portmap = "llllw";

Master branch:
mediatek,portmap = "lllwl";

Someone should confirm this, but I think it is the default config for the internal switch. Given the fact that the network config (see file 02_network ) is:

"2:lan:2" "3:lan:1" "4:wan" "6@eth0"

I'd say my PR (mediatek,portmap = "llllw";) is wrong, as it sets the blue "Internet" port (i.e., port 4) as LAN (together with the other two ports) by default, which might lead to a traffic leak between them right after boot while OpenWrt still has not configured the whole network stack.

2 Likes