WIZnet Developer Forum

IAP Function call issue

For a project i’m using a w7500p development board. For this project some data needs to be stored and remembered even when the power is down.

The problem persists that when i want to use the IAP-FLash function to read/write some data the application gets stuck in the nmi handler.

I’ve tried to change the the clock to the internal 8 Mhz clock as recommended in the errata data sheet.
Still this problem persists.

Anyone who can help solve this problem? I’m using the keil uvision interface to programm the w7500p.

This is the source code i’m adding to write data to the flash memory

uint8_t ip = 192;
CRG_FCLK_SourceSelect(CRG_RCLK);

FLASH_IAP(IAP_ERAS_SECT, IP_START_0, 0, 0 );
FLASH_IAP(IAP_PROG, IP_START_0, &ip, SECT_SIZE);

CRG_FCLK_SourceSelect(CRG_MCLK);

I think, you also apply the code about “SysTick_Config” and “all interrupt masking” before IAP.

Pls see the example flash_update_start() and flash_update_end() functions in the

flash call example:

   flash_update_start();
      // IAP Function calls
      save_DevConfig_to_storage();
   flash_update_end();

(…)

/* System Core Clock Update for improved stability */
static void flash_update_start(void)
{
    /* System Core Clock Update */
    SystemCoreClockUpdate_User(CLOCK_SOURCE_INTERNAL, PLL_SOURCE_8MHz, SYSTEM_CLOCK_8MHz);
    
    /* SysTick_Config */
    SysTick_Config((GetSystemClock()/1000));
    
    /* Simple UART re-init by MCU clock update */
    UART2_Configuration();
    
    // Backup Interrupt Set Pending Register
    temp_interrupt = (NVIC->ISPR[0]);
    (NVIC->ISPR[0]) = (uint32_t)0xFFFFFFFF;
}

/* System Core Clock Update - Restore */
static void flash_update_end(void)
{
    /* System Core Clock Update */
    SystemCoreClockUpdate_User(DEVICE_CLOCK_SELECT, DEVICE_PLL_SOURCE_CLOCK, DEVICE_TARGET_SYSTEM_CLOCK);
    
    /* SysTick_Config */
    SysTick_Config((GetSystemClock()/1000));
    
    /* Simple UART re-init by MCU clock update */
    UART2_Configuration();
    
    // Restore Interrupt Set Pending Register
    (NVIC->ISPR[0]) = temp_interrupt;
}

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.