As you may know, the M365 has a small Bluetooth module in the handlebar assembly (BLE) as well as the main driver board, also called the ESC or DRV, in the footboard. Xiaomi only wants you updating the firmware via Bluetooth, so this comes with restrictions. You've probably tried to flash some custom-cooked firmware only to find that the firmware version remained unchanged afterward and your changes were silently ignored.

The hacking community has come up with a method to hard-flash a stock, modable version. Since so much of the scooter's functionality is dependent on software, resetting everything to defaults can fix more than you might think, like a fresh reinstall of a computer program. The link between the restoration tool and the scooter boards is an inexpensive USB module called an ST-Link. If your scooter is bricked, appears stuck, or behaves strangely, flashing via this route will likely fix it.

ST Links are widely available, and I've found it's hard to go wrong. I used this one from AliExpress.

Flashing the ESC via m365rec

A Russian modder has developed a utility called m365rec. Once connected and ran on your scooter's mainboard (ESC), it hard-resets your firmware to version 1.3.8. A link to download is in his online list of M365 tools, #3 on the list. Unfortunately it currently only works on Windows.

Here's the general process:

  1. Warm up your soldering iron and find some spare pins. You'll want the kind that fit into Dupont jumpers.

  2. The firmware has knowledge of the scooter's serial number, so in order to fully restore it, you'll need it. It is made up of a 5-digit and 8-digit number separated by a slash (XXXXX/XXXXXXXX). Find it on a small label on the side under the footboard.

  3. Get a Windows computer. Wine may work, I haven't tried it though.

  4. Disassemble down to the ESC. You really have to unplug everything and free the board.

  5. Locate holes for pins G, C, and D towards the middle of the mainboard. Solder a pin into each so that you can plug in the cables. I suggest soldering while holding the pins in place with pliers.

    ST Linked

  6. Look at your ST Link dongle. On it, you'll see a layout of what each pin does.

    ST Link Key

    With the Dupont cabling bundled with your ST Link, connect these ST Link pins to the pins on your ESC:

    SWCLK to C
    SWDIO to D
    GND to G
    5.0V to the pin labeled 5 on the 4-pin BLE header, in the corner of the mainboard (see orange jumper in photo).

  7. Plug your ST Link into USB. You should see your board come to life, and probably start flashing a green light.

  8. Launch m365rec.exe and step through the process, entering in your scooter's serial number. If it doesn't find your dongle, you may have to install the STM driver which is bundled in the .rar.

  9. The restoration takes some time. Once complete, plug everything in before reassembling and turn on the scooter. Verify it was successful by squeezing the brake lever, which should blink your tail light. If that works, you should be good to reassemble and ride.

Flashing the BLE via m365rec

The same technique used for the ESC applies to the BLE with a few exceptions. The BLE recovery tool is also in the list of tools, #5.

The process is generally the same. Start by locating the C/D/G holes and soldering some pins in. My board didn't have them filled in with solder already, so I was able to cut and drop in a spare pre-arranged pin module.

Pins on the BLE

You'll need to pull up & disconnect the BLE plug. It's located just a little into the stem as you're looking into it from the top. Connect the board and the ST Link together according to the diagram attached to the .rar. Here it is, for reference:

BLE ST Link wiring diagram

Another extra step is to desolder C16, a surface-mounted resistor. I suggest pushing an xacto knife underneath it holding a soldering gun on one side to unseat it.

With that, you can now execute the recovery script. Make sure to refer to the included readme for further help.

Thanks to Nikita (@nickkee) for making it all possible!

More blog posts