summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-07-10 22:58:00 +0700
committerhathach <[email protected]>2024-07-10 22:58:00 +0700
commite251493a161b5a383fd7f8861e3bf7ea72bf872c (patch)
treeb32019d1f6f88107285f6e0dd1fd1df5c4f156f1
parentc1175b70131fa5020713381a850f2ce1018f390f (diff)
skip FLASH_ function to reduce dependency
-rw-r--r--hw/bsp/ch32v20x/system_ch32v20x.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/bsp/ch32v20x/system_ch32v20x.c b/hw/bsp/ch32v20x/system_ch32v20x.c
index 882e7ed71..d32ee8d17 100644
--- a/hw/bsp/ch32v20x/system_ch32v20x.c
+++ b/hw/bsp/ch32v20x/system_ch32v20x.c
@@ -111,9 +111,12 @@ void SystemInit (void)
{
// Enable Flash enhance read mode for full 224KB
#if defined(CH32_FLASH_ENHANCE_READ_MODE) && CH32_FLASH_ENHANCE_READ_MODE == 1
- FLASH_Unlock_Fast();
- FLASH->CTLR |= (1 << 24);
- FLASH_Lock_Fast();
+ FLASH->KEYR = 0x45670123; // FLASH_Unlock_Fast();
+ FLASH->KEYR = 0xCDEF89AB;
+
+ FLASH->CTLR |= (1 << 24); // Enhanced Read Mode
+
+ FLASH->CTLR |= (1 << 15); // FLASH_Lock_Fast();
#endif
RCC->CTLR |= (uint32_t)0x00000001;