Maix Bit cannot flash new firmware

Hello, I received my Maix Bit yesterday and was trying the sample scripts for MaixPy using the MaixPy IDE at some point when I was loading a script the screen became blank white and I have not been able to flash anything since. I have used Kflash Gui v1.5 and K-Flash 0.3 and nothing works. How can I reset the board?

Is there any output over serial when you reset (i.e. push the reset button)? Do you get any errors when flashing? Have you tried ktool? If you have a JTAG emulator, have you tried hooking it up? If you have an oscilloscope or logic analyzer, do you see signals on the SPI flash chip during boot?

1 Like

I’m running Manjaro linux 20

I have not tried to use serial monitor, I dont know how.

I get a error with ktool:

[INFO] Trying to Enter K210 ROM ISP Mode… .
Greeting fail, check serial port (SLIP receive timeout (wait frame start))

kflash does flash firmware:

$ kflash -p /dev/ttyUSB1 maixpy_v0.5.0_88_gb7f0c13.bin
*[INFO] COM Port Selected Manually: /dev/ttyUSB1 *
*[INFO] Default baudrate is 115200 , later it may be changed to the value you set. *
*[INFO] Trying to Enter the ISP Mode… *
._
*[INFO] Automatically detected goE/kd233 *

*[INFO] Greeting Message Detected, Start Downloading ISP *
Downloading ISP: |=================================================================================================================| 100.0% 10kiB/s
*[INFO] Booting From 0x80000000 *
*[INFO] Wait For 0.1 second for ISP to Boot *
*[INFO] Boot to Flashmode Successfully *
*[INFO] Selected Flash: On-Board *
*[INFO] Initialization flash Successfully *
Programming BIN: |=================================================================================================================| 100.0% 10kiB/s
[INFO] Rebooting…

But I think my bootloader is broken since I cant connect to the board with the maixpy IDE. And I dont know how to flash a new one. I have been trying to flash isp.bin that comes with the ktool repo and have had not been able to get that to work. Is that isp.bin the bootloader. How do I flash it to the proper address? When I try --> kflash -p /dev/ttyUSB0 --bootloader isp.bin <-- it asks for a firmware file.

I do have a j-link and st-link although my knowledge of them is little especially the j-link, but I have not tried connecting those to he board.

I dont have a scope or analyzer.

As I said earlier this board worked when I got it but something went wrong in some way when I was trying to load a script to it in the maixpy IDE. So I have no experience with this board. I have however been playing with arduinos, esp, stm32 and adafruit circuitpython boards for close to 2 years.

If you need more info just ask. Any suggestions would be very greatly appreciated.

I have not tried to use serial monitor, I dont know how.

use picocom like

picocom -b 115200 /dev/ttyUSB1

and you should be able to use serial. You can also pass -t to ktool or kflash and they will start a terminal after flashing. Do be aware that I’ve had some issues with the enter key being hit twice for every time I press it with the ktool/kflash terminal.

I get a error with ktool:

[INFO] Trying to Enter K210 ROM ISP Mode… .
Greeting fail, check serial port (SLIP receive timeout (wait frame start))

Have you passed the board option? I have to use -B bit_mic to flash my board. If you have the version of the bit without a microphone (it has a metal package with a hole), you will need to use -B bit instead.

But I think my bootloader is broken since I cant connect to the board with the maixpy IDE. And I dont know how to flash a new one. I have been trying to flash isp.bin that comes with the ktool repo and have had not been able to get that to work. Is that isp.bin the bootloader. How do I flash it to the proper address? When I try --> kflash -p /dev/ttyUSB0 --bootloader isp.bin <-- it asks for a firmware file.

The bootloader is not the “real” bootloader. The real bootloader on the device has limited capabilities, so kflash/ktool first sends a “bootloader” over which is more capable. This “bootloader” does the actual reception and flashing of your firmware.

I do have a j-link and st-link although my knowledge of them is little especially the j-link, but I have not tried connecting those to he board.

I’ve been trying to get this to work recently, but I haven’t had any luck. There is a special version of openocd that you will need if you want to try it out.

edit: I have gotten jtag working, thought I haven’t done extensive testing.

1 Like

I switched to my windows 10 installation and tried to run ktool.py from there. And managed to flash the board with micropython firmware, it boots up now as it did in the beginning.

  1. I began with ktool.py -p COM3 -B bit_mic -E which ran all the way through and cleared the chip.

  2. Then I took maixpy_v0.5.0_95_g05c4e70_minimum_with_ide_support.bin.kfpkg and opened it as zip file and extracted the *.bin and *.json from it (.kfpkg are just zip files) from the json file I saw that this firmware had to be flashed at address 0.

  3. Next step was to run ktool.py -p COM3 -a 0 -B bit_mic maixpy_v0.5.0_95_g05c4e70.bin it took awhile but the file was in the en successfully flashed and the board is working for me again.

I dont think that switching the OS made any difference and am reasonably sure this would work just as well in linux. I think that the -B bit_mic flag and selecting correct address to start flashing from were the key to making this work for me. Erasing the chip prior to flashing may have had an effect also but I am not sure, I will be using that myself though when I get myself into trouble again.

Thank you for the assistance the -B bit_mic flag is something that I didn’t find a reference to and I’m sure that was very important for this to work.

I’m interested in the debugging possibilities with the j-link but I need a good beginnar guide to get started on that, so far I’ve only used my j-link and st-link to flash firmware.

Hi, the last weekend I faced a problem, that after the upload of a new firmware (custom make using StandAlone SDK for Kendrayte) my Maix Dock , did’t allowed the flash of new firmwares, it showed an error.

After 1 hour of research, I found that I changed the configuration of the UART IRQ, I thought that this configuration only affected UART1 and not the HIGHSpeed UART used by USB-C port, but it did.

To solve this problem, I had to press the RESET Button of the Maix, and then try to UPLOAD the new firmware, and keep pressing the RESET Button until the KFLAHS_GUI showed a WAITING dialog box, then I released the RESET button.

Is easier to use the KFPKG files insted of individual files, this package is the best way to upload many files to the Maix, for example I have made an HTTP Server that can serve one client at a time, and I use the KFPKG to upload de BIN (code of the Server), KMODEL files and HTML all at the same time

Here you can find a guide to create your own KFPKG :