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

guessing to update keneral in open wrt I have to compile my own build and flash from open WRT.

Ordered a Xiaomi Router 3G and received the new v2 :face_vomiting:, model R3GV2 with no usb port, 16MB SPI flash and 128MB RAM, seems identical to the 4A so I thought I'd post it here.

Cracked it open, captured a bootlog and took a pic.

Bootlog Link

That flash chip sure looks like to be similar, if not the same, as the 4a gigabit edition. Do you have a flasher? If not, they're pretty cheap (mine cost about €3.5 on that big chinese supermarket everyone knows, took about 3 weeks to arrive to Europe). Once you dump the contents of the flash and keep a copy of the original, it's just a matter of experimenting with minimal risks, I'd say...

1 Like

I'll be ordering one ASAP.

Thanks to the folks that took the time to investigate and get OpenWRT supported.

1 Like


As motherboard model, 99% you got the A4 Gigabit Ed.

If you can get the SPI Programmer and modify the bootdelay, you can flash the build that I linked few days ago, or build your own! :wink:

1 Like

Ordered one last night and it has been posted today. Should arrive in a few weeks.

I'll keep an eye on the thread in the meantime.


Someone posted a patch to support the R3G v2 to the OpenWrt mailing list, this might be of interest if indeed the R4A Gigabit is identical.

I'm in no way a go between for the author, so any questions should be directed directly to him.

1 Like

There is a separate topic for the R3Gv2 also: Xiaomi WiFi Router 3G V2


Hello i just ordered the SPIflasher and uart adapter. I was reading about the extra 3.3 v connection, how to connect ?

Looking forward to use wrt in the R4


In this patch : https://patchwork.ozlabs.org/patch/1095406/ , for a different router (4A but 100Mb variant) there are instructions referring about cutting power on a specific erase action. Can anyone try this method on this router, it may work without the need for the programmer.


  1. Connect to the serial port of the router and power it up.
    If you get a prompt asking for boot-mode, go to step 3.
  2. Unplug the router after
    > Erasing SPI Flash...
    > raspi_erase: offs:20000 len:10000
    occurs on the serial port. Plug the router back in.
  3. At the prompt select option 2 (Load system code then
    write to Flash via TFTP.)
  4. Enter as the device IP and as the
  5. Connect your computer to LAN1 and assign it as
  6. Rename the sysupgrade image to test.bin and serve it via TFTP.
  7. Enter test.bin on the serial console and press enter.

Before flashing mine, I tried that but without success. The only way I was able to unlock my bootloader was using a SPI flasher.

You need to see in your flasher which pin is the 3.3v, they should be labeled. Then look at the router's board and identify the UART 4 pins, one of them says 3.3v (it's the one you DON'T use when accessing the console).

Refer to the following picture I took when I flashed mine:

As what happened to Roger, I also needed to connect those 2 pins along with placing the clamp that comes with the flasher on the chip, or else the flasher wouldn't detect the chip. To perform that connection I used a a dupont jumper wire (female to female), which I had to buy separately, but these are also dirt cheap - this along with the male pins that also came with the flasher and that I placed on the board's UART pin holes (didn't need to solder them, as long as they made contact).

Side note: my flasher also has a TTL UART mode, there is a jumper connector in it so I can alternate between TTL UART mode and SPI flashing mode (so I don't need a separate TTL UART adapter to access the router's console). Yours probably will have the same feature, if so then make sure you are in the correct mode for what you are doing.

1 Like

Thanks for fast reply.
I now feel alot more sure of all the steps


@araujorm, was your flasher modified for 3.3v operation?


No, mine has a 3.3V pin, see below in this picture:

I think that the pins in the top row in this image are only usable when in flasher mode, but I could be wrong.

Anyway, this marked pin is the one I connected to the router's TTL UART 3.3V pin. Note that when I connected the clamp to the adapter (via the interface that is on the other side), the pin got covered by it so I had to twist it gently to be able to connect the dupont cable (this is noticeable on the picture that I put on my previous post). This may be the case with your adapter or not, but don't find it strange if it's the same with you (just don't twist it too much so you don't break it).

Also, you may try to connect the flasher without connecting the 3.3V and see if it works for you, but for me (and Roger above), without doing it, ch341prog wouldn't detect the chip. Do a ch341prog -i and it will be obvious if things are ready to go.

I know for sure the following, about the bottom row:

  • pins 1,2 and 3 are used to select the mode: short 1-2 for flasher mode, short 2-3 for TTL UART adapter mode (it comes with the jumper connector on the other side for doing that)
  • the other 4 pins (TXD, RXD, GND, 5V) are for using when in TTL UART mode

Reminders (in case any doubts subsist):

  1. When flashing you do NOT connect the power supply to the router, only the clamp on the chip and the aforementioned 3.3v pin.
  2. However when accessing the router console, in TTL UART mode (baud rate 115200) you need to have the router powered on with it's power supply, and you MUST NOT connect anything to the board's 3.3V pin (or else you may fry the board, the adapter, or both). You should JUST connect:
    • RX pin from the adapter to the TX pin on the board
    • TX pin from the adapter to the RX pin on the board
    • GND pin from the adapter to the GND pin on the board
  3. I heartily recommend that you don't forget to make a backup of the flasher's dump before modifying and flashing it back, should you want to revert things if something's not working.

Hope this helps.

That does not mean that this adapter is designed for 3.3V operation! CH341A chip itself is powered from 5V USB directly, so the voltage on its logical outputs will be around 5V as well. This adapter requires modification to work with 3.3V chips.

For CH341A software i use AsProgrammer_1.4.0

1 Like

Well, I confess that I didn't measure the voltage and just trusted the label... But it worked, could it have been luck?

Well, I picked up my multimeter and checked. The 3.3v pin on my flasher indeed is 3.3v, when measured against the GND pin, and the 5v is 5v as it should. Hope it helps.

you don't understand the problem
I'm talking about the logical outputs of the chip - measure the voltage there, or just find the circuit diagram and check there.