Since Keil MDK 5.25 does not have the bug anymore, we recommend to update (see Downloads section)
===== Keil-Bug workaround (needed for almost all boards except H101/H8S or H8mini_green ) =====
**As this question is being asked from time to time in H8 mini thread, I'll write a short answer here:**
- Install (if not already) [[http://www.st.com/en/development-tools/stsw-link004.html|STLink Utilities]]
- Connect (if not already) STLink to USB port
- Connect quad to STLink (step 3 & 4 not needed, but you'll get a connect error then)
- Power the quad using a battery
- Click on "target"–>"connect", some blue writing should be displayed. If not, check Wires, check if the board is powered, are STLink drivers installed correctly?
- Click on "target"–>"disconnect"
- Open Keil
- Unplug & plug quad's battery (if flashed for the first time, otherwise continue step 10)
- Click "flash"–>"erase" (if flashed for the first time, otherwise continue step 10)
- Click "flash"–>"download"
- Finished
Note: If you're trying to erase a "fresh" board, the time between battery plug-in and erase is limited, be aware of that and do it as fast as you can / repeat if it didn't work!
**Here is how krillex does it:** [[https://www.rcgroups.com/forums/showpost.php?p=38868191&postcount=12547|Link to post]]
Regarding flashing the blue board for the first time I also have some problems but this is what I do: \\
1. Connect usb-programmer and battery to fc. \\
2. Run the "st-link upgrade tool" and update firmware (even if it's already updated). Close the upgrade software. \\
3. Erase memory from within Keil. \\
4. Disconnect usb-programmer from PC and battery from fc. \\
5. Reconnect programmer to PC and battery to fc. \\
6. Run the "upgrade tool" again. Close upgrade tool. \\
7. Download software from within Keil. \\ \\
Any flashings after that, just use download in Keil (use "upgrade tool" first). \\
It's the first time with a new blue board that is problematic. \\
I'm sure there are other ways to get it working but that procedure works good for me.
**Another version from Ian444:** [[https://www.rcgroups.com/forums/showpost.php?p=38869818&postcount=12554|Link to post]]
Yet another recipe. Must be carried out in this order. Keil can be open, but minimised on the PC. \\
1. Open the ST-Link Utility program. \\
2. Connect ST-Link to USB port. Do not connect ST-Link to quad yet. \\
3. Click "connect" in ST-Link Utility program. \\
4. You get a "cannot connect" message. \\
5. Close the message and close the ST-Link Utility program. Now the ST-Link is "initialised". \\
6. Open (or maximise) Keil, connect the quad, connect the quad's battery and flash it. \\ \\
Note for first erase and flash - usually it is needed to disconnect and then reconnect the battery after the erase and before the flash. No need to disconnect the quad or the ST-Link (or do anything in Keil) when doing this.