2017年6月11日 星期日

NANO100:Using data flash without the external 12M HZ crystal.

The data flash start address is set by register so it need a reset after update the address, but in default it will use  the external 12M HZ crystal.It's need to modify the CFOSC .



Modify the \SampleCode\StdDriver\FMC_RW set_data_flash_base() function

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;
}
view raw gistfile1.txt hosted with ❤ by GitHub


Ref:
     Nano100 Series Technical Reference Manual

沒有留言:

張貼留言

Linux driver: How to enable dynamic debug at booting time for built-in driver.

 Dynamic debug is useful for debug driver, and can be enable by: 1. Mount debug fs #>mount -t debugfs none /sys/kernel/debug 2. Enable dy...