NUC230 data flash programming

Post Reply
Ahndy
Posts: 1
Joined: 09 Nov 2017, 11:39

10 Nov 2017, 10:17

Hello.

I am using Nuvoton MCU for the first time.

1. I have difficulty in data Flash programming of the NUC230SE2AE.
I want to write 16bytes data in data flash(0xF000) region.
After the following code(FMC_WR) execution, the IDE(MDK-ARM V5.23) didn’t recognize the MCU in the debug menu
of the target option, and I had to replace the device(MCU) to new one.

Anybody who have experience like this issue, please help me.

uint32_t buf[4] = {0x12345678, 0, 0, 0};
#define DATA_FLASH_BASE 0xF000
unit32_t wConfig[2], rConfig[4] ;
SYS_UnlockReg();
FMC_Open();
FMC_ReadConfig(wConfig, 1);
FMC_EnableConfigUpdate();
FMC_Erase(FMC_CONFIG_BASE);
wConfig[0] &= ~0x1;
wConfig[1] = DATA_FLASH_BASE;
FMC_WriteConfig(Config, 2)
FMC_ReadDataFlashBaseAddr();
rCofig[0] = FMC_ReadUCID(0);
rCofig[1] = FMC_ReadUCID(1);
rCofig[2] = FMC_ReadUCID(2);
rCofig[3] = FMC_ReadDataFlashBaseAddr();
for (i = DATA_FLASH_BASE; i < 4; i += 4)
FMC_Write(i, *buf++);
FMC_Close();
SYS_LockReg();

All return values rConfig[0], rConfig[1], rConfig[2], rConfig[3] were 0xFFFFFFFF.
Config(0x00300000) data was attached image.
Config.jpg
Config.jpg (171.58 KiB) Viewed 999 times
2. The other problem is

In the debug => peripherals => system viewer => GPIO
Even though I set the system viewer file(NUC200AE_v1.SFR) I can see only GPIOA.
GPIOB, GPIOC are invisible.

How can I solve these problems.
Please help me.

Best Regards

Ahndy

AlsoJoe
Posts: 18
Joined: 20 Mar 2017, 11:35

17 Nov 2017, 17:29

Hi Ahndy,

About the FMC question, attached is a sample code base on the FMC_RW sample code in NUC230_240_Series_BSP_CMSIS_V3.01.001.
FMC_RW_171017.zip
(13.03 KiB) Downloaded 70 times
  • Use SetDataFlashBase() to set the Data Flash base address.
    Inside SetDataFlashBase(), SYS->IPRSTC1 |= SYS_IPRSTC1_CHIP_RST_Msk;
    do chip reset to make new setting take effect. Without this line, setting won't be changed until chip reset.
  • Due to the chip reset, you won't be able to use debug mode. Open UART to use debug port.
  • FMC_Write() inside for loop cannot work because of the condition is wrong.
    To write 16 bytes data, DATA_FLASH_TEST_END = DATA_FLASH_TEST_BASE + 16.
    for (i = DATA_FLASH_TEST_BASE; i < DATA_FLASH_TEST_END; i += 4)
    FMC_Write(i, buf[J++]);
  • It is normal that FMC_ReadUCID() return 0xFFFFFFFF. UCID will be empty unless customers ask for.
    You can try FMC_ReadCID(), FMC_ReadPID(), or FMC_ReadUID().
  • I read 0x00300000 data and it's all FF.
    Image
About the debug => peripherals => system viewer => GPIO problem. May I know which version of BSP you are using?
I am now using NUC230_240_Series_BSP_CMSIS_V3.01.001, and the system viewer file is NUC200AE_v1.SFR as well.
Image

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest