40 ‐ Step‐by‐step plan - losehu/uv-k5-bootloader-custom GitHub Wiki
The Basic Steps to join this feature
- Make Calibration and configuration backup.
- Stack 2 x M24M02RD EEPROMs.
- Load LOSEHU firmware.
- Re-store the calibration and configuration.
- Check the EEPROM status to be 512KB (4Mbit).
- Go to Multi-boot and write the EEPROM.
- Use ST-LINK to flash the LOSEHU bootloader.
- Now load firmwares to the loader and write to the device.
It is already described in a document, but the steps will be described and explained here below.
-1- Make Calibration and Configuration backup
[!IMPORTANT]
- Don't miss this step. Always keep a backup of calibration data.
- For all steps below, use Google Chrome as browser
Use k5prog-win or K5Web. Tip: use right mouse click and open in New Window.
- Turn on the radio in normal mode and connect the USB cable.
- Click on
Connect
and thenBackup Calibration
. Backup Config
uration also.
-2- Stack 2 x M24M02RD EEPROMs
The M24M02 is a 2-Mbit I2C serial access EEPROM (electrically erasable programmable memory) organized as 256 K × 8 bits.
[!IMPORTANT] Beware of orientation of the Eeprom-IC on the PCB (the other way around).
We use 2 eeproms soldered in parallel, except pin 3.
Pin 3 is the Chip enable (E2) This input signal is used to set the value that is to be looked for on the least significant bit b3 of the 7-bit device select code. This input must be tied to VCC or VSS, to establish the device select code as shown in Figure 4. When not connected (left floating), this input is read as low (0).
Remove the PCB
The EEPROM is located at the back of the PCB. There are 5 screws (2 of them are located behind the LCD). Once the 2 screws behind the LCD are removed. Reattach the LCD to the PCB to prevent the flat cable from being damaged.
Replace the EEPROM
Desolder the original chip BL24C64 (64Kb) and solder the 2Mib chip. Be careful to keep the same orientation.
Add the second EEPROM (PCB version R51-V1.8)
The radio I modded is a UV-K5(99) and it came with a PCB version R51-V1.8. On this PCB there is already a populated footprint for another EEPROM.
For older PCB versions
If there is not an extra location to solder the 2nd chip, you need to solder jumper wires between the two chips or try to put second chip on top (if that fits into the casing ?)
- Connect all the pads of the two chips in parallel (pad 1 to pad1, pad 2 to pad 2 e.t.c), except pad 3.
- Pad 3 on the 1st EEPROM is connected to ground. Pad 3 on the 2nd EEPROM should be pulled up to Vcc.
- Put a wire or a 10K resistor between pad 3 and pad 8 on the 2nd chip.
- You can also use an 2*2M Expansion board and solder that in place of the original eeprom and add both 2Mb eeproms on top.
-3- Load LOSEHU firmware
Before you can use K5Web to program the firmwares into Eeprom, you need to be on a firmware that can “see” the 4Mbit of EEPROM.
The only one that worked for me was one you make in a special made DIY section of k5WEB.
I selected Chinese for top 2 options, and left everything else default, the firmware generated had like 400000 or something in the name.
You must do this before you flash the bootloader MCU on the radio using ST Link, otherwise it wont boot until you put original bootloader back on.
With this firmware we will be able to access the 4Mb EEPROM and write the firmwares of your choice.
- Go to LOSEHU DIY
- Press
Connect
and select correct COM-port. - Select the
Chinese Channel Name
.
-
Click on
Generate
to go directly to K5Web Flasher. This firmware name ends with 400000000.- or (optional)
Download
to flash it with the tool of your choice.
- or (optional)
-
Put the radio in flash mode (White LED must be ON)
-
Click
Flash
and select used com-port, to store the firmware in the flash memory of the radio.
The radio restarts in normal mode. On the display there might be blocks in stead of readable text. No worry. ;-)
- Optionally install the Chinese font library, if you intend to use this firmware.
You find this optional function under Set Patch. This installation takes some time. Progress is shown on PC-screen.
-4- Re-store the Calibration and Configuration
In Backup/Restore tool,
-
- Power-ON the radio in normal mode and Press
Connect
and select correct COM-port.
- Power-ON the radio in normal mode and Press
The screen may look like this all dots that normal; there's random data in your Eeprom.
We will fix that in next steps, until we have activated Multiboot.
-
- Press
Restore Calibration
to restore your previously saved callibration.
- Press
-
- Optionally you can click on
Restore Config
to restore your previously saved configuration.
- Optionally you can click on
-
- once ready Press
Disconnect
.
- once ready Press
-5- Check the EEPROM status
It must be 512KB (4Mbit). Use K5Web Basic Information
- Press
Connect
and select correct COM-port.
- Press
Test
. - The result should be EEPROM Size: 512KB (4Mbit) (see last line).
- Press
Disconnect
.
-6- Go to Multi-boot and write the Eeprom
-
With the radio connected in normal mode open Multi-booting tool
-
Press
Connect
and select correct COM-port. -
click
Write to device
.
- Info: The bottom lines mean
Bootloader writing progress: 98.4% Bootloader writing progress: 99.0% Bootloader writing progress: 99.5% Firmware quantity writing progress: 0.0% Bootloader version writing progress: 0.0% Writing completed
- once ready Press
Disconnect
and disconnect your radio.
-7- Replace the official bootloader
Wire ST-Link interface to radio
Use ST-LINK interface (or J-Link)to flash the LOSEHU bootloader into the MCU-Flash (DP32G030 chip).
Due to language requirements (Chinese input method), approximately 150KB is needed, so this bootloader is only suitable for UVK5 with 4Mib (512KB) EEPROM.
-
Download and install the ST-Link driver
-
Solder some wires to the PCB to realise connectivity to the ST-Link
- No need to place battery at radio!
- Connect the ST-Link at USB port of PC.
- Press and hold
PTT
before you turnon the radio
in flashing mode - Radio White LED will light up and you can release the
PTT
.
Flash the losehu bootloader
- Download the latest bootlader file "Source code (zip)".
- Unzip the complete directory bl-toolkit
- Run
losehu_bootloader.bat
(found in bl-toolkit folder). It only takes 6 seconds.
- Disconnect ST-link
- De-solder the wires
- Reassemble the radio
-8- Now load your Firmware Selection to the 4Mb Eeprom.
Now we have Losehu firmware flashed and are able to address the 4Mb.
- Turn ON radio in normal mode and connect programming cable.
- Use Multi-booting tool.
- Press
Connect
and select correct COM-port.
[!NOTE] Select firmware in *.packed.bin format
- Click
Select Firmware
andOpen
the firmwares you want to write (up to 4 files). - Drag each one on the first white square.
- Click
Write to device
to write all of them. This will take some time .... approx 6 minutes per firmware
Note: Due to flash size limitations, individual firmware size should not exceed 60KB.
- Check logging for ! like this line
Firmware-file 固件文件检测到写入错误!!!
It means firmware-file detected a write error!!!
If you get the screen below you forgot to press
Write to device
and there are NO selectable Firmwares in the Eeprom
Turn OFF
the radio and start over here (this chapter).
Test flashing using Eeprom
- Turn ON the radio while the
Menu
button pressed shortly or wait until - you see a screen with "Boot OK - Release key". After that ...
- You should see a list of the installed firmwares in EEPROM. Like this screen ...
- Select your choice with the
arrows
and use theMenu
button to start flashing. It takes less than 10 seconds.
Note
- If it stucks for a while and it's not rebooting you might have forgotten to restore the calibration data.
- If you have any issues with the bootloader you can restore the official bootloader.
- Run
qs_bootloader.bat
(found in bl-toolkit folder)
ENJOY Multiboot ;-)
- When the (multiboot-)loader is finished copying the selected firmware into flash memory, it automatically starts the in flash loaded firmware.
- When you turn the radio back on, this firmware remains active. Until you do the next step.
- Switching to another firmware is now so easy... approx 15 seconds.
How to reprogram the radio with new multiboot items
- The same steps? No you can skip Steps 1,2 and 4,5,6 and 7.
- So only perform step 3 and 8.
- Make Calibration and configuration backup.
- Stack 2 x M24M02RD EEPROMs.
- Load LOSEHU firmware in Flash to be able to access the 4Mb EEPROM
- Re-store the calibration and configuration.
- Check the EEPROM status to be 512KB (4Mbit).
- Go to Multi-boot and write the EEPROM.
- Use ST-LINK to flash the LOSEHU bootloader.
- Now load firmwares to the loader and write to the device.