Hi,
I have reviewed your code, but I do not see the code to erase flash, if you program flash space which are not erased, you may damage the flash.
How about using the code:
/*!
** @file main.c
** @version 01.16
** @brief
** Main module.
** This module contains user's application code.
*/
/*!
** @addtogroup main_module main module documentation
** @{
*/
/* MODULE main */
/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "Events.h"
#include "Pins1.h"
#include "IFsh1.h"
#include "IntFlashLdd1.h"
/* Including shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "Init_Config.h"
#include "PDD_Includes.h"
#define PROADDRESS 0x7000
unsigned int array[1024];
unsigned int temp,i;
unsigned int *pointer;
void main(void)
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* Write your code here */
for(i=0;i<1024;i++)
{
array[i]=i;
}
pointer=(unsigned int *)PROADDRESS;
//erase program flash from address:0x1 F000
IFsh1_EraseSector((unsigned long)PROADDRESS);
pointer=(unsigned int *)PROADDRESS;
asm(nop);
for(i=0; i<1024; i++)
{
IFsh1_SetWordFlash((unsigned long)pointer,array[i]);
pointer++;
}
for(;;) {}
}
/* END main */
/*!
** @}
*/
/*
** ###################################################################
**
** This file was created by Processor Expert 10.3 [05.09]
** for the Freescale 56800 series of microcontrollers.
**
** ###################################################################
*/
BR
XiangJun Rong