This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Initialize FLASH_FWBN_R with 32 words

Hi, All,

I try to initialize FLASH_FWBN_R with 32 words with the macro HWREG(x), as listed below. But it does not work. Plese advise how to make this work.

uint32_t i, wData = 0x12345678;
 uint32_t uiAddress = 0x1000;
   
 // erase flash memory 1 KB block starting 0x1000
 FLASH_FCMISC_R = FLASH_FCMISC_AMISC; // Clear the flash access interrupt
 FLASH_FMA_R = uiAddress;       // Erase the block
 FLASH_FMC_R = FLASH_FMC_WRKEY | FLASH_FMC_ERASE;
 
 // wait for the erase complete...
 while(FLASH_FMC_R & FLASH_FMC_ERASE)
 {
 }
 FLASH_FWBVAL_R = 0xFFFFFFFF;
 FLASH_FMA_R = uiAddress;
// InitBufferReg();
 for(i = 0; i < 32; i++)
 {
  HWREG(FLASH_FWBN_R + 4 * i) = wData + 4 * i;
 }  
 FLASH_FMC2_R = FLASH_FMC_WRKEY | FLASH_FMC2_WRBUF