diff options
| author | hathach <[email protected]> | 2024-07-10 22:58:00 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2024-07-10 22:58:00 +0700 |
| commit | e251493a161b5a383fd7f8861e3bf7ea72bf872c (patch) | |
| tree | b32019d1f6f88107285f6e0dd1fd1df5c4f156f1 | |
| parent | c1175b70131fa5020713381a850f2ce1018f390f (diff) | |
skip FLASH_ function to reduce dependency
| -rw-r--r-- | hw/bsp/ch32v20x/system_ch32v20x.c | 9 |
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; |
