Question
Flash write problem! Help
Posted on November 12, 2011 at 06:53
In the application we are using stm32f103zet6 high density ARM controller. We r trying to write array of data to flash memory. We r just able to write 4 words with ProgramHalfWord function,
my program segment goes like this //some of the macros listed //Embedded Flash Configuration #define __EFI_ACR_Val 0x00000012 /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Flash Access Control Register bits */ #define ACR_LATENCY_Mask ((u32)0x00000038) #define ACR_HLFCYA_Mask ((u32)0xFFFFFFF7) #define ACR_PRFTBE_Mask ((u32)0xFFFFFFEF) /* Delay definition */ #define EraseTimeout ((u32)0x00000FFF) #define ProgramTimeout ((u32)0x0000000F) Addr = 0x08010000;//32nd page address for(k=0;(k<40 && FLASHStatus == FLASH_COMPLETE);k = k+1)//loop for 40 32bit memory data { T.val = DB9[k];//DB9[] is array of u32 type data = T.bytes.lowByte; //data is u16 type, used union to split 32 bit data //lower 16 bits FLASHStatus = FLASH_ProgramHalfWord(Addr, data); // Addr = Addr + 2;//increment address by 2 while(FLASHStatus != FLASH_COMPLETE);//wait until FLASH_COMPLETE data = T.bytes.highByte;////data is u16 type, used union to split 32 bit data //higher 16 bits FLASHStatus = FLASH_ProgramHalfWord(Addr, data); // Addr = Addr + 2; while(FLASHStatus != FLASH_COMPLETE);//wait until FLASH_COMPLETE } My controller is operated with 72MHz Any problem with Erase timeout or program timeout?