0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-05-18 16:01:18 +03:00

README.md

This commit is contained in:
OneOfEleven 2023-09-16 07:55:09 +01:00
parent 1e3b26768e
commit a24facec25
4 changed files with 47 additions and 55 deletions

View File

@ -1,11 +1,11 @@
# compile options # compile options (see Readme.md)
# you can enable ('1') or disable ('0') any/all of these you like # '0' = disable, 1 = enable
ENABLE_SWD := 0 ENABLE_SWD := 0
ENABLE_AIRCOPY := 0
ENABLE_FMRADIO := 0
ENABLE_OVERLAY := 1 ENABLE_OVERLAY := 1
ENABLE_UART := 1 ENABLE_UART := 1
ENABLE_AIRCOPY := 0
ENABLE_FMRADIO := 0
ENABLE_NOAA := 0 ENABLE_NOAA := 0
ENABLE_VOICE := 0 ENABLE_VOICE := 0
ENABLE_ALARM := 0 ENABLE_ALARM := 0

View File

@ -1,42 +1,41 @@
# Open reimplementation of the Quan Sheng UV K5 v2.1.27 firmware # Open reimplementation of the Quan Sheng UV-K5 v2.1.27 firmware
This repository is a cloned and customized version of DualTachyon's open firmware found here .. This repository is a cloned and customized version of DualTachyon's open firmware found here ..
https://github.com/DualTachyon/uv-k5-firmware https://github.com/DualTachyon/uv-k5-firmware
Am amazing achievement if you ask me ! A cool achievement if you ask me
# User customization # User customization
This version you can customize at compile time by making various changes to the makefile. You can customize the firmware by enabling/disabling various compile options.
You can edit those changes by (currently) editing the MakeFile, look for these lines at the top of the file .. You'll find the options at the top of "makefile" ('0' = disable, '1' = enable) ..
``` ```
ENABLE_SWD := 0 enable only if you're using the CPU's SWD port (debugging/programming)
ENABLE_OVERLAY := 1 cpu FLASH stuff
ENABLE_UART := 1 without this you can't configure the radio with your PC
ENABLE_AIRCOPY := 0 easier to just type frequency in ENABLE_AIRCOPY := 0 easier to just type frequency in
ENABLE_FMRADIO := 0 FM band 2 RX ENABLE_FMRADIO := 0 FM band 2 RX
ENABLE_OVERLAY := 1 ENABLE_NOAA := 0 Everything NOAA
ENABLE_UART := 1 without this you can't configure the radio with your PC ENABLE_VOICE := 0 want to hear voices ?
ENABLE_NOAA := 0 NOAA channels
ENABLE_VOICE := 0 strange voices
ENABLE_ALARM := 0 TX alarms ENABLE_ALARM := 0 TX alarms
ENABLE_BIG_FREQ := 0 big font for the frequencies ENABLE_BIG_FREQ := 0 big font for the frequencies
ENABLE_KEEP_MEM_NAME := 1 maintain the channel name when (re)saving a memory channel ENABLE_KEEP_MEM_NAME := 1 maintain the channel name when (re)saving a memory channel
ENABLE_CHAN_NAME_FREQ := 1 show the channel frequency below the channel name/number ENABLE_CHAN_NAME_FREQ := 1 show the channel frequency below the channel name/number
ENABLE_WIDE_RX := 1 enable the RX in the full 18MHz to 1300MHz (though frontend is not tuned for full range) ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz for RX (though frontend is not tuned for full range)
ENABLE_TX_WHEN_AM := 0 allow TX when RX set to AM ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 use CTCSS tail phase shift rather than QS's 55Hz tone method ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 use standard CTCSS tail phase shift rather than QS's own 55Hz tone method
ENABLE_MAIN_KEY_HOLD := 1 keys 0-9 can be held down to bypass having to press the F-key ENABLE_MAIN_KEY_HOLD := 1 keys 0-9 can be held down to bypass having to first press the F-key
ENABLE_BOOT_BEEPS := 1 gives the user some audio feedback on the volume level knob position at boot-up ENABLE_BOOT_BEEPS := 1 give user audio feedback on the volume knob position at boot-up
ENABLE_COMPANDER := 1 compander menu option - not yet fully operational ENABLE_COMPANDER := 1 compander option - not yet fully operational
#ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented #ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented - single VFO on display when possible
#ENABLE_BAND_SCOPE := 1 not yet implemented #ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter
``` ```
To enable the custom option, set the above option to '1'
# Some other changes made # Some other changes made
* Various original QS firmware bugs fixed * Various QS firmware bugs fixed
* Added new bugs * Added new bugs
* Finer RSSI bar steps * Finer RSSI bar steps
* Nicer/cleaner big numeric font than original QS big numeric font * Nicer/cleaner big numeric font than original QS big numeric font
@ -67,7 +66,7 @@ To compile directly in windows without the need of a linux virtual machine:
``` ```
Then you can run 'win_make.bat' from the directory you saved this source code too. Then you can run 'win_make.bat' from the directory you saved this source code too.
You may need to edit the bat file (path to make.exe) depending on where you installed 'gnu_make' too. You may need to edit the bat file (path to make.exe) depending on where you installed the above two packages too.
# Credits # Credits
@ -102,3 +101,9 @@ You may obtain a copy of the License at
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
# Example changes
<p float="left">
<img src="/chan_freq_option.png" width="300" />
<img src="/F-CALI_menu.png" width="300" />
</p>

View File

@ -31,4 +31,3 @@ uint32_t FLASH_ReadNvrWord(uint32_t Address)
{ {
return overlay_FLASH_ReadNvrWord(Address); return overlay_FLASH_ReadNvrWord(Address);
} }

View File

@ -21,9 +21,9 @@
#include "sram-overlay.h" #include "sram-overlay.h"
static volatile uint32_t *pFlash = 0; static volatile uint32_t *pFlash = 0;
uint32_t overlay_FLASH_MainClock; uint32_t overlay_FLASH_MainClock;
uint32_t overlay_FLASH_ClockMultiplier; uint32_t overlay_FLASH_ClockMultiplier;
uint32_t overlay_0x20000478; // Nothing is using this??? uint32_t overlay_0x20000478; // Nothing is using this???
void overlay_FLASH_RebootToBootloader(void) void overlay_FLASH_RebootToBootloader(void)
{ {
@ -94,16 +94,14 @@ uint32_t overlay_FLASH_ReadByAPB(uint32_t Offset)
{ {
uint32_t Data; uint32_t Data;
while (overlay_FLASH_IsBusy()) { while (overlay_FLASH_IsBusy()) {}
}
overlay_FLASH_SetMode(FLASH_MODE_READ_APB); overlay_FLASH_SetMode(FLASH_MODE_READ_APB);
FLASH_ADDR = Offset >> 2; FLASH_ADDR = Offset >> 2;
overlay_FLASH_Start(); overlay_FLASH_Start();
while (overlay_FLASH_IsBusy()) { while (overlay_FLASH_IsBusy()) {}
}
Data = FLASH_RDATA; Data = FLASH_RDATA;
@ -120,11 +118,11 @@ void overlay_FLASH_SetArea(FLASH_AREA Area)
void overlay_FLASH_SetReadMode(FLASH_READ_MODE Mode) void overlay_FLASH_SetReadMode(FLASH_READ_MODE Mode)
{ {
if (Mode == FLASH_READ_MODE_1_CYCLE) { if (Mode == FLASH_READ_MODE_1_CYCLE)
FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_READ_MD_MASK) | FLASH_CFG_READ_MD_BITS_1_CYCLE; FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_READ_MD_MASK) | FLASH_CFG_READ_MD_BITS_1_CYCLE;
} else if (Mode == FLASH_READ_MODE_2_CYCLE) { else
if (Mode == FLASH_READ_MODE_2_CYCLE)
FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_READ_MD_MASK) | FLASH_CFG_READ_MD_BITS_2_CYCLE; FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_READ_MD_MASK) | FLASH_CFG_READ_MD_BITS_2_CYCLE;
}
} }
void overlay_FLASH_SetEraseTime(void) void overlay_FLASH_SetEraseTime(void)
@ -135,8 +133,7 @@ void overlay_FLASH_SetEraseTime(void)
void overlay_FLASH_WakeFromDeepSleep(void) void overlay_FLASH_WakeFromDeepSleep(void)
{ {
FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_DEEP_PD_MASK) | FLASH_CFG_DEEP_PD_BITS_NORMAL; FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_DEEP_PD_MASK) | FLASH_CFG_DEEP_PD_BITS_NORMAL;
while (!overlay_FLASH_IsInitComplete()) { while (!overlay_FLASH_IsInitComplete()) {}
}
} }
void overlay_FLASH_SetMode(FLASH_MODE Mode) void overlay_FLASH_SetMode(FLASH_MODE Mode)
@ -153,28 +150,20 @@ void overlay_SystemReset(void)
{ {
// Lifted from core_cm0.h to preserve function order in the object file. // Lifted from core_cm0.h to preserve function order in the object file.
__DSB(); /* Ensure all outstanding memory accesses included __DSB(); // Ensure all outstanding memory accesses included buffered write are completed before reset
buffered write are completed before reset */ SCB->AIRCR = (0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_SYSRESETREQ_Msk;
SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | __DSB(); // Ensure completion of memory access
SCB_AIRCR_SYSRESETREQ_Msk);
__DSB(); /* Ensure completion of memory access */
for(;;) /* wait until reset */ for (;;) // wait until reset
{
__NOP(); __NOP();
}
} }
uint32_t overlay_FLASH_ReadNvrWord(uint32_t Offset) uint32_t overlay_FLASH_ReadNvrWord(uint32_t Offset)
{ {
uint32_t Data; uint32_t Data;
overlay_FLASH_SetArea(FLASH_AREA_NVR); overlay_FLASH_SetArea(FLASH_AREA_NVR);
Data = overlay_FLASH_ReadByAHB(Offset); Data = overlay_FLASH_ReadByAHB(Offset);
overlay_FLASH_SetArea(FLASH_AREA_MAIN); overlay_FLASH_SetArea(FLASH_AREA_MAIN);
return Data; return Data;
} }
@ -189,22 +178,21 @@ void overlay_FLASH_ConfigureTrimValues(void)
SYSCON_CHIP_ID2 = overlay_FLASH_ReadByAPB(0xF020); SYSCON_CHIP_ID2 = overlay_FLASH_ReadByAPB(0xF020);
SYSCON_CHIP_ID3 = overlay_FLASH_ReadByAPB(0xF024); SYSCON_CHIP_ID3 = overlay_FLASH_ReadByAPB(0xF024);
SYSCON_RC_FREQ_DELTA = overlay_FLASH_ReadByAHB(0x07C8); SYSCON_RC_FREQ_DELTA = overlay_FLASH_ReadByAHB(0x07C8);
SYSCON_VREF_VOLT_DELTA = overlay_FLASH_ReadByAHB(0x07C4); SYSCON_VREF_VOLT_DELTA = overlay_FLASH_ReadByAHB(0x07C4);
PMU_TRIM_POW0 = overlay_FLASH_ReadByAHB(0x07E4); PMU_TRIM_POW0 = overlay_FLASH_ReadByAHB(0x07E4);
PMU_TRIM_POW1 = overlay_FLASH_ReadByAHB(0x07E0); PMU_TRIM_POW1 = overlay_FLASH_ReadByAHB(0x07E0);
PMU_TRIM_RCHF = overlay_FLASH_ReadByAHB(0x07D8); PMU_TRIM_RCHF = overlay_FLASH_ReadByAHB(0x07D8);
PMU_TRIM_RCLF = overlay_FLASH_ReadByAHB(0x07D4); PMU_TRIM_RCLF = overlay_FLASH_ReadByAHB(0x07D4);
PMU_TRIM_OPA = overlay_FLASH_ReadByAHB(0x07D0); PMU_TRIM_OPA = overlay_FLASH_ReadByAHB(0x07D0);
PMU_TRIM_PLL = overlay_FLASH_ReadByAHB(0x07CC); PMU_TRIM_PLL = overlay_FLASH_ReadByAHB(0x07CC);
overlay_0x20000478 = overlay_FLASH_ReadByAHB(0x07B8); overlay_0x20000478 = overlay_FLASH_ReadByAHB(0x07B8);
Data = overlay_FLASH_ReadByAHB(0x07BC); Data = overlay_FLASH_ReadByAHB(0x07BC);
SYSCON_DEV_CLK_GATE = (SYSCON_DEV_CLK_GATE & ~SYSCON_DEV_CLK_GATE_SARADC_MASK) | SYSCON_DEV_CLK_GATE_SARADC_BITS_ENABLE; SYSCON_DEV_CLK_GATE = (SYSCON_DEV_CLK_GATE & ~SYSCON_DEV_CLK_GATE_SARADC_MASK) | SYSCON_DEV_CLK_GATE_SARADC_BITS_ENABLE;
SARADC_CALIB_OFFSET = ((Data & 0xFFFF) << SARADC_CALIB_OFFSET_OFFSET_SHIFT) & SARADC_CALIB_OFFSET_OFFSET_MASK; SARADC_CALIB_OFFSET = ((Data & 0xFFFF) << SARADC_CALIB_OFFSET_OFFSET_SHIFT) & SARADC_CALIB_OFFSET_OFFSET_MASK;
SARADC_CALIB_KD = (((Data >> 16) & 0xFFFF) << SARADC_CALIB_KD_KD_SHIFT) & SARADC_CALIB_KD_KD_MASK; SARADC_CALIB_KD = (((Data >> 16) & 0xFFFF) << SARADC_CALIB_KD_KD_SHIFT) & SARADC_CALIB_KD_KD_MASK;
overlay_FLASH_SetArea(FLASH_AREA_MAIN); overlay_FLASH_SetArea(FLASH_AREA_MAIN);
} }