Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Info: other compatible firmwares with tools #6

Open
OK2MOP opened this issue Mar 10, 2024 · 39 comments
Open

Info: other compatible firmwares with tools #6

OK2MOP opened this issue Mar 10, 2024 · 39 comments

Comments

@OK2MOP
Copy link
Contributor

OK2MOP commented Mar 10, 2024

Hello,
as the E-mail address in commits is probably not working and I was not able to contact repo owner directly, I attach here just a small update for potential additional reverse engineering:

  1. the decryption/encryption tools work also for Radtel .kdhT and .kdhX firmware files (RT-470, RT-490) and potentially other firmware updates I was not able to get (e.g. JJCC8629 is a possible candidate)
  • .kdhT is equivalent to the .BF file with two-part firmware file (with second FW part which includes code in the original SYSTEM bootloader area)
  • .kdhX is just a single encrypted firmware (decryptable with decrypt binary) in main code memory
  1. Some radios (like UV-17/18/21 Pro use different LPQFP48 CPU with 128kB flash and 32kB RAM. As I do not have access to the firmware besides RT-490 (with two different versions of FW 1.03, for old V1 radio and newer V2 radio), I can only guess which:
  • for old V1 RT-490 the CPU is unknown (around 86-88 records in vector table - I was not able to match it to any Artery AT32 CPUs)
  • for newer (end of 2022+) V2, the CPU it is probably an AT32F415CCT7 clone (but one of the last reserved vectors is set to default handler instead of 0 so it is not a perfect match)
  • if anybody can share Baofeng UV18PRO or UV17PRO firmware, I would like to look at it

73, Pavel, OK2MOP

@amoxu
Copy link
Owner

amoxu commented Mar 10, 2024

UV18PRO_6818_V1.14_230330.zip
UV17PRO_6818_V1.18_230115.zip
Attached fw file for your information.

Upon reverse engineering their upgrade tool (written in .NET, can be examined using ILSPY), you will be pleasantly surprised. Within a class named BootHelper, a list of possible models or manufacturers is defined, including JJCC, Baofeng, SenHaiX, and others. Using this list of models, one can locate firmware upgrade packages and new version upgrade tools from various manufacturers. Further decompilation can reveal additional model lists.

Later, I discovered that this is a solution provider company called KeDiHeng. They specialize in purchasing and customizing MCUs from MCU manufacturers like Gigadevice/Artery, branding them with the name KDH32xxxx, and using them in their design. The encrypted firmware's suffix "kdh" is also an abbreviation of their company name. They specifically design handheld radio solutions (including PCBs + firmware) for radio manufacturers.

It's possible that dozens or even hundreds of different models of radios on the market are designed by their team. These designs share similar hardware designs and software codebases. This suggests that if an excellent open-source system is designed or ported, potentially tens millions of handheld radios already in the market could immediately receive upgrades and enhancements, greatly benefiting users.

@amoxu
Copy link
Owner

amoxu commented Mar 10, 2024

BTW, you can directly reach me with the email address on my github profile.

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Mar 10, 2024

Thanks, I have already looked on those tools with ILSpy last week, there are actually other flasher models, one of the other interesing ones is for RT-850 (which has open firmware and seems to use same CPU as the BF-5RH) and uses UTF-16 to store hex files with firmware inside of the flasher. This type is also used for Abbree AR-2520 with larger memory and up to 25W power (and CPU probably like the one in UV-17/UV-18 Pro).

EDIT:

BTW, you can directly reach me with the email address on my github profile.

That's the one I have used but it did not work from my gmail for some reason.

@amoxu
Copy link
Owner

amoxu commented Mar 11, 2024

IMG_20240311_104457.jpg

Attached AR2520 internel photo fyi

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Mar 11, 2024

So my speculation about the Abbree AR-2520 CPU has proven correct. Interestingly your internal photo shows different footprint than one seen in a video from earlier last year on top side. This is GPS (labeled as V2 by sellers) or non-GPS version?

Unfortunately, I had no luck yet identifying the UV17/18 Pro CPUs yet, they do not seem to be Gigadevice/Artery/STM32G0 ones. I will try to continue looking.

@amoxu
Copy link
Owner

amoxu commented Mar 11, 2024

My AR2520 is V2 version which with GPS.
IMG_20240311_224421.jpg

There is also a preserved Bluetooth? chip pad.

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Mar 11, 2024

Yes, this was discussed within the video I was mentioning, some of the radios have Bluetooth for Android app management option, but it has not been installed in this device.

One of AR-2520s is on a way to me now, theoretically this one should be easier to hack with the existing RT-890 codebase than UV-5R*/UV-1* PRO

The second slot seems to be for SD card reader

@amoxu
Copy link
Owner

amoxu commented Mar 11, 2024

Unfortunately, I had no luck yet identifying the UV17/18 Pro CPUs yet, they do not seem to be Gigadevice/Artery/STM32G0 ones. I will try to continue looking.

That's easy, I just need to open my radio and share some photo here.

Here is the UV17 Pro.

IMG_20240311_225725.jpg

IMG_20240311_225730.jpg

IMG_20240311_225735.jpg

IMG_20240311_225741.jpg

@amoxu
Copy link
Owner

amoxu commented Mar 11, 2024

And here is the UV18 Pro, these photo were taken few months ago.

The MCU was rebranded as KD32F401RBT6, I will detect its real mcuid by openocd later.

IMG_20240311_230145.jpg

IMG_20240311_230150.jpg

IMG_20240311_230200.jpg

IMG_20240311_230230.jpg

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Mar 11, 2024

The UV-17 Pro is probably clearly the old hardware based on the 2022 year on the PCB (there are two variants in the wild, does it have the blue/white screen?). You did not have to disassemble it for me, hope it was OK to re-assemble. The "fingerprint" of vector table does not seem to match the CPU type in the decompiled firmware by a lot, so the firmware is probably for the other (new) version with FD6818.

If I were to guess, both the new UV-17 Pro and UV-18 Pro Max use the same CPU as in the UV-18 Pro post as seen on the photo. I think it could be some clone of LQFP64 STM32F401RBT6 but with limitations (it reminds me of the "TYT" CPU in newer RT3s/UV-1701s the people of OpenGD77 core development team had issues with, as they did not support all of the features of original and FreeRTOS was not running on them before they added some fixes). However, I was not able to find startup_stm32f401xb.s (only startup_stm32f401xc.s/startup_stm32f401xe.s and they have different size of vector table) to confirm this yet.

To mod the firmware, there is, however an additional complication of it using NRF FD6818 TRX.

BTW, your collection of radios is impressive, although if I am a freak with that as well and have ordered quite a lot of them in past (mainly the DMR models), I cannot compare.

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Mar 11, 2024

OK, so now I found out I stripped the initial 16 bytes of the UV files with the tool when I was tired yesterday evening so nothing made sense. But it is not making it now either, as the table in UV-17 Pro/UV-18 Pro Max corresponds to AT32F415 table seen in other devices now not the STM device. Maybe they forgot to change it in SDK and yet it works?

@amoxu
Copy link
Owner

amoxu commented Mar 11, 2024

does it have the blue/white screen?).

You are right if you were talking about the factory firmware style. The right one besides UV17 Pro is UV17L which using AT32F421?(i guess, not validated).

IMG_20240312_000500.jpg

IMG_20240312_001017.jpg

You did not have to disassemble it for me, hope it was OK to re-assemble.

Never mind bro! Almost every radio I bought had been or will be disassembled.

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Mar 11, 2024

UV17L has similar HW like the BF UV-5RH/AT1846S in the non-RF part, and same CPU (SYN2A-000). Only the Pro/UV-1XH/UV-21H models have CPU with more flash/RAM to be able to handle the GPS (and kdhx firmware).

Actually I think the GUI has differences only because of different images representing the interface being uploaded to flash.

@amoxu
Copy link
Owner

amoxu commented Mar 11, 2024

Regarding performance improvement, I found a solution last year, you can use AT32F402CCT7, which is fully pin-compatible with AT32F421C8T7, and has a 226MHz operating frequency, 256KB Flash and a maximum of 102KB of RAM. Of course, there is an additional 20KB system bootloader that can be used as code flash. There is just one problem. It is really difficult for ordinary users to use a heat gun to replace the MCU.

@amoxu
Copy link
Owner

amoxu commented Mar 11, 2024

I have contacted several Chinese radio companies (both manufacturers and solution designers) and they have received my feedbacks.

On the one hand, I encourage them to use MCUs with redundant performance so that their products will have the opportunity to be enhanced by the open source community in the future.

At the same time, I am also pushing them to reserve audio path for M17 open source digital communication. If you are interested in M17 or OpenRTX, please follow the community.

Baofeng may release related products in coming few months.

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Mar 11, 2024

Hi, so either my suspicion that the CPU does not match the firmware was right, or something else wrong is happening: I have flashed the UV-18 Pro Max firmware to the radio (the one with airband) after doing sanity check I was able to do (checking the the HW revision in the firmware file matches the one of the radio display) and the radio boots into the GUI but the reaction including the audio playback is slowed down to <10%. Either the CPU is set up wrong or the peripherals inside are different, e.g. the radio is not FD6818 and some calls time out preventing the reaction. Disassembled the radio and the CPU cannot be verified, the FD6818 is there. In any case, do not flash the firmware to your radio as it will also probably make it unusable (or maybe not, my HW revision is listed as 1.5 and yours is 1.3). But in firmware both HW versions are V1.30 (and my FW version was V1.3)

IMG_20240311_204258~2
IMG_20240311_204606__01
IMG_20240311_204552~2
IMG_20240226_213806-mask

The conclusion to this is probably following:
With the different firmware and hardware revisions not distinguishable by the HW version and the need to actually disassemble the radio to check the variant, it will be probably impossible to create open-source reverse-engineered firmware which would be usable by different people.

@amoxu
Copy link
Owner

amoxu commented Mar 12, 2024

UV18Pro_NRF_NORX_V1.03_240306(1).zip
Try this.

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Mar 12, 2024

That did the trick, main parts of radio are working again (GPS may have problems due to cold start or antenna connection after disassembly, I have to check which), so with correct firmware to restore the potential to upload own test firmware increased.

If I have decoded it correctly, this actual model is not equipped with the FM radio chip and the main loop with tasks was stuck waiting for it to answer which lead to the degraded performance... I was not able to identify the missing components, but I did not guess it was that. But the FM radio is working in the firmware, maybe through FD6818?

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Mar 15, 2024

So I have played with the radios I have, and tried to extract the bootloaders. For RT-890 I have modified the OEFW firmware to dump these areas, for UV-18 Pro I was repeatedly failing to succeed when building with make and AT32 IDE, but finally figured about an hour ago how to add the missing platformio packages and then the compilation resulted in working firmware. Attached are the dumps of bootloaders and system bootloaders.

dumped-rt890.zip (the sys bootloader vector table looks strange, however).
dumped-uv18pro.zip

I have reversed most of the bootloader from the repo and RT-890 BL, but there are no suprising hidden commands, the bootloaders match the protocol from the flashers.

The ABBREE AR-2520 arrived, but unfortunately there is a V2 firmware, which differs from the V1 available on the Internet so I am stuck until/if I ever get the V2 equivalent FW because I would brick the device experimenting with it.

EDIT: Not surpisingly, the UV18Pro BL does not have the 0x5 command for switching upload to sysbootloader area, otherwise the functionality is similar to the one of UV-5RH.

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Mar 19, 2024

At the same time, I am also pushing them to reserve audio path for M17 open source digital communication. If you are interested in M17 or OpenRTX, please follow the community.

Baofeng may release related products in coming few months.

I have looked at the specifics of M17 and I am afraid even with the reserve audio path the presently used AT32F415 128kB/32kB MCUs will not get even close to required minimal configuration for M17. Now a possibility would be an external MCU with serial communication (like the M17 serial mike redone to be handheld) and USART communication, but I have studied the publicly available BK4819 and FD6818 datasheets and they do not mention possibility of MSK 9600 bps mode needed for this type of operation.

So the best such handheld radio would be probably something like "MD-389/MD-UV399 plus" with 10 W MD-UV380/390 GPS base hardware where OpenGD-77 is now in beta state, and BK4819 (or if we hack it, as it seems similar register-wise, also FD6818) with the audio path routed to the MCU. But this are becoming quite expensive even with the present 10W HW.

@Pornete
Copy link

Pornete commented Aug 19, 2024

At the same time, I am also pushing them to reserve audio path for M17 open source digital communication. If you are interested in M17 or OpenRTX, please follow the community.
Baofeng may release related products in coming few months.

I have looked at the specifics of M17 and I am afraid even with the reserve audio path the presently used AT32F415 128kB/32kB MCUs will not get even close to required minimal configuration for M17. Now a possibility would be an external MCU with serial communication (like the M17 serial mike redone to be handheld) and USART communication, but I have studied the publicly available BK4819 and FD6818 datasheets and they do not mention possibility of MSK 9600 bps mode needed for this type of operation.

So the best such handheld radio would be probably something like "MD-389/MD-UV399 plus" with 10 W MD-UV380/390 GPS base hardware where OpenGD-77 is now in beta state, and BK4819 (or if we hack it, as it seems similar register-wise, also FD6818) with the audio path routed to the MCU. But this are becoming quite expensive even with the present 10W HW.

Hello OK2MOP,

Can you tell me how i can contact you? I tried to upgrade UV-17ProGPS from version 1.03 to 1.11 and now, the unit is bricked. can you explore the file and give a solution for recovery?
Thanks

@Pornete
Copy link

Pornete commented Aug 19, 2024

UV17PRO_401 _NRF_V1.11_240808.zip
@OK2MOP this is the firmware what i received from the seller

@dailtontec33
Copy link

Hello, good morning! I have a Baofeng UV 17 Pro GPS, the original firmware is 1.03.

I updated it with the firmware UV17PRO_401 _NRF_V1.11, and the radio crashed.

I need to downgrade it to F.W1.03 (I don't have a tool to extract it from another radio I have here). I couldn't find it available anywhere! =(
Sorry for my English, I used Google Translate!

Dailton, Brazil.

@amoxu
Copy link
Owner

amoxu commented Sep 11, 2024

Hello, good morning! I have a Baofeng UV 17 Pro GPS, the original firmware is 1.03.

I updated it with the firmware UV17PRO_401 _NRF_V1.11, and the radio crashed.

I need to downgrade it to F.W1.03 (I don't have a tool to extract it from another radio I have here). I couldn't find it available anywhere! =( Sorry for my English, I used Google Translate!

Dailton, Brazil.

Another public available fw file for UV17PRO is UV17PRO_6818_V1.18_230115.zip, try it.

@dailtontec33
Copy link

Another public available fw file for UV17PRO is UV17PRO_6818_V1.18_230115.zip, try it.

Thanks, I'll test it here!

@dailtontec33
Copy link

dailtontec33 commented Sep 12, 2024

Hello, good morning! I have a Baofeng UV 17 Pro GPS, the original firmware is 1.03.
I updated it with the firmware UV17PRO_401 _NRF_V1.11, and the radio crashed.
I need to downgrade it to F.W1.03 (I don't have a tool to extract it from another radio I have here). I couldn't find it available anywhere! =( Sorry for my English, I used Google Translate!
Dailton, Brazil.

Another public available fw file for UV17PRO is UV17PRO_6818_V1.18_230115.zip, try it.

#6

Thanks, I'll test it here!

Hello good evening! I installed the fw UV17PRO_6818_V1.18, the radio came back, but it was slow (with a delay of one second in the commands, and not all the functions came back). I have another UV 17 pro GPS with fw 1.03, I'm going to buy an SPI communicator to extract and try to recover it.

  • I also tried to install the UV18 fw, it got stuck in a loop, "Lol" =).

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Sep 13, 2024

It seems like the same issue like I had for UV-18 Pro 1.03 vs other firmware. You have the same MCU but something (probably external XTAL) is missing. Unless something like UV18Pro_NRF_NORX_V1.03_240306.zip exists for UV17Pro, you are probably stuck. Because the 1.03 is actually a newer firmware, and the 1.18 is for older hardware revision of this model.

@dailtontec33
Copy link

It seems like the same issue like I had for UV-18 Pro 1.03 vs other firmware. You have the same MCU but something (probably external XTAL) is missing. Unless something like UV18Pro_NRF_NORX_V1.03_240306.zip exists for UV17Pro, you are probably stuck. Because the 1.03 is actually a newer firmware, and the 1.18 is for older hardware revision of this model.

It's interesting how FW 1.03 is more up-to-date than 1.18, but I've already been told that.

In the original FW1.03, the AM modulation saturates the audio when an aircraft is close by (I really like this VHF band).

I'm going to try to copy FW 1.03 from the other radio by buying an SPI communiqué from some Chinese website. I'm also going to get another radio that has FW 1.27 here. If I can get it, I'll put it here for download =)

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Sep 13, 2024

Theoretically it could be possible to extract firmware over SWD MCU pins but I am not sure if this model has the L1 readout protection enabled or not (the same revision of UV18Pro had the protection enabled, if I remember correctly).

Partial extraction is possible with special dumper due to bootloader implementation, but you would be missing at least first 1 kB of firmware since you need to replace it with the dumper, so it will not help.

Please note that the firmware is stored inside of the MCU, not in SPI flash. That contains only data. So extraction from other radio will not be possible the way you are mentioning in previous post. If you do not have the other radio, and plan to buy it, I strongly suggest against it (you may even receive a different HW revision) as these models have/had very bad second harmonic of VHF and transmit into military band.

The same base solution platform is used for Talkpod A36+ MAX (8W version only!) which does not have a GPS, but Andrej is working on open firmware and has most of the functions already working, but the HW and MCU are different so that firmware will not work for this radio either.

EDIT: Just for information, even for disabled readout protection you would need DAPLink/STLinkV2 and access to SWDIO and SDWCLK pins for firmware extraction.

@dailtontec33
Copy link

dailtontec33 commented Sep 13, 2024

Theoretically it could be possible to extract firmware over SWD MCU pins but I am not sure if this model has the L1 readout protection enabled or not (the same revision of UV18Pro had the protection enabled, if I remember correctly).

Partial extraction is possible with special dumper due to bootloader implementation, but you would be missing at least first 1 kB of firmware since you need to replace it with the dumper, so it will not help.

Please note that the firmware is stored inside of the MCU, not in SPI flash. That contains only data. So extraction from other radio will not be possible the way you are mentioning in previous post. If you do not have the other radio, and plan to buy it, I strongly suggest against it (you may even receive a different HW revision) as these models have/had very bad second harmonic of VHF and transmit into military band.

The same base solution platform is used for Talkpod A36+ MAX (8W version only!) which does not have a GPS, but Andrej is working on open firmware and has most of the functions already working, but the HW and MCU are different so that firmware will not work for this radio either.

EDIT: Just for information, even for disabled readout protection you would need DAPLink/STLinkV2 and access to SWDIO and SDWCLK pins for firmware extraction.

Thanks for the information, my friend =).

When I bought this Baofeng, the seller (Chinese website store) said it was FW 1.27 (the airband is much better), but it arrived with FW 1.03 =(

Actually, I'm more used to Quansheng or Radtel, Baofeng is more complicated!

  • The only way is to look until there's some FW 1.03 available, to go back to what it was before!

@Laidukas
Copy link

I just received my Baofeng UV-17 Pro GPS with FW 1.03 and AirBand reception is very pour when compared to my other radios like TIDRADIO H3, Talkpod A36Plus , Quansheng UV K5, Radtel RT-470 V1.

Do I understand correctly that FW 1.27 would improve thing for Baofeng UV-17 Pro GPS ?

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Sep 27, 2024

NO. FW 1.27 is for older hardware revision, if you flash this firmware, you will brick your device. 1.03 is actually more recent

@Laidukas
Copy link

NO. FW 1.27 is for older hardware revision, if you flash this firmware, you will brick your device. 1.03 is actually more recent

So at the moment there is no better firmware solution for this radio?

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Sep 27, 2024

No, and there is not even a dump of the firmware available (and the radio is probably protected against dumping it) so you cannot go back. Plus note that the issue may not only be in firmware, but also in hardware, because it uses (at least in this revision) FD6818 not BK4819 radio so the performance may be different because of that (the radios you have mentioned use BK4819). There is calibration data stored in flash, but I am not aware of a setting which would control AM reception

@dailtontec33
Copy link

dailtontec33 commented Sep 27, 2024

I just received my Baofeng UV-17 Pro GPS with FW 1.03 and AirBand reception is very pour when compared to my other radios like TIDRADIO H3, Talkpod A36Plus , Quansheng UV K5, Radtel RT-470 V1.

Do I understand correctly that FW 1.27 would improve thing for Baofeng UV-17 Pro GPS ?

I'VE BEEN TRYING TO FIND OUT THESE DAYS.

NOW AS FOR THE BAOFENG UV17 PRO GPS, It has two types of board (hardware).

  1. FD6818 (older) uses firmware 1.27, 1.28...etc
  2. NRF (current) this uses firmware 1.03, 1.07 and 1.11
    The latter has a new numerical sequence referring to the FW nomenclature.
    To find out the board, power button + "8" key, the type of board will appear on the display.
  • Note: If you have a radio that has the NRF card and want to update to fw 1.11.
    It has to be from fw 1.07 ====> to 1.11
    Because if you go from 1.03 to 1.11, the radio will freeze! (this happened with my radio, I didn't have this information before)

There's a really cool Facebook group, the name is: "Baofeng UV-17 Pro GPS"

Someone correct me if I'm wrong!

@jeffddr
Copy link

jeffddr commented Oct 2, 2024

Hi friends, I would like to know where I can get the original firmware for the BF.17 PRO GPS
to have it as a backup

In the new BF uv-k61, good equipment but the menu leaves a lot to be desired. Is there anyone who can improve the menu so that it is more modern? Anyway, I have the firmware for the uv k61 equipment in case anyone wants to do the tests.

@jeffddr
Copy link

jeffddr commented Oct 2, 2024

UV17PRO_6818_V1.18_230115
What improvements does it have because I didn't like the aesthetics, the colors don't look good
Also, the image looks blurry

@shevaru
Copy link

shevaru commented Oct 20, 2024

Hello. I have Baofeng K5Plus (MCU SYN2A-000, radio FD6818). The MCU is broken and needs to be replaced. Does anyone have a processor firmware for this radio station?

@OK2MOP
Copy link
Contributor Author

OK2MOP commented Oct 26, 2024

Hello, SYN2A-000 is AT32F421C8T7 (QFP-48) MCU. But there is a caveat - the system bootloader area is overwritten by part of the firmware (kdhT firmwares) or custom bootloader (kdhx) so you need SWD and modyfing the control register to do that. See @amoxu comment above where he replaced it with AT32F402CCT7. If you are really advanced user with great QFP soldering skills, you could try it, but otherwise I suggest you do not bother and buy a new radio (there will be a Radtel soon - RT-900? with same code base and BK4829 - right now KSUT sells it as UV110D, but with broken calibration for L/M on VHF - and they want to make the firmware/tools open source)

Regarding performance improvement, I found a solution last year, you can use AT32F402CCT7, which is fully pin-compatible with AT32F421C8T7, and has a 226MHz operating frequency, 256KB Flash and a maximum of 102KB of RAM. Of course, there is an additional 20KB system bootloader that can be used as code flash. There is just one problem. It is really difficult for ordinary users to use a heat gun to replace the MCU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants