This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int set_data_flash_base(uint32_t u32DFBA) | |
{ | |
uint32_t au32Config[2]; | |
if (FMC_ReadConfig(au32Config, 2) < 0) { | |
printf("\nRead User Config failed!\n"); | |
return -1; | |
} | |
if ((!(au32Config[0] & 0x1)) && (au32Config[1] == u32DFBA)) | |
return 0; | |
FMC_ENABLE_CFG_UPDATE(); | |
au32Config[0] &= ~0x1; | |
au32Config[0] |= 0x1<<26; //Enable the HIRC | |
au32Config[1] = u32DFBA; | |
if (FMC_WriteConfig(au32Config, 2) < 0) | |
return -1; | |
printf("\nSet Data Flash base as 0x%x.\n", DATA_FLASH_TEST_BASE); | |
// Perform chip reset to make new User Config take effect | |
SYS->IPRST_CTL1 = SYS_IPRST_CTL1_CHIP_RST_Msk; | |
return 0; | |
} |
Ref:
Nano100 Series Technical Reference Manual