Content originally posted in LPCWare by dariush_abbasi868 on Tue Aug 26 20:39:34 MST 2014
thank you sir,
It is OK,
Now I can erase any sector
but when I want to write anything in this sector is not ok and it return 9 ;
and some times it is in hank !
this is my code:
txt_len=iap_prepare( TARGET_SECTOR, (TARGET_SECTOR));
txt_len=iap_erase_sector( TARGET_SECTOR, TARGET_SECTOR);
txt_len=iap_prepare( TARGET_SECTOR, TARGET_SECTOR);
txt_len=iap_copy_ram_to_flash(&demo,(char *)CONFIG_FASH_OFFSET, 256);
that :
/* Flash offset where the configuration is stored */
#define CONFIG_FASH_OFFSET 0x1000
#define CONFIG_FLASH_SECTOR (CONFIG_FLASH_OFFSET >> 12)
#define CONFIG_FLASH_SECTOR_SIZE 1
#define TARGET_SECTOR 20
unsigned char demo[]=" dariush abbasi pw co ";