hi,
i removed following function in my code but still i cant erase data. using FlashEraseSector() API.
flashSSDConfig.CallBack = (PCALLBACK)RelocateFunction((uint32_t)__ram_for_callback , CALLBACK_SIZE , (uint32_t)callback);
actually my code was looping in this place, i dnt know why. i already put snapshot image also.
ret = pFlashCommandSequence(pSSDConfig);
could you tell what exactly problem..? my new code i attached.
void internal_flash_write()
{
uint32_t ret; /* Return code from each SSD function */
uint32_t destination; /* Address of the target location */
uint32_t size;
uint32_t end;
uint8_t securityStatus; /* Return protection status */
uint16_t number; /* Number of longword or phrase to be program or verify*/
uint32_t *p_data;
uint32_t margin_read_level; /* 0=normal, 1=user - margin read for reading 1's */
uint8_t sudha_data[200];
uint8_t sudha_data_2[10];
uint32_t i=0, FailAddr;
unsigned char *dst;
unsigned char addr;
unsigned char adj_size;
uint32_t FlashValueAtFA00=0;
uint32_t FlashValueAtFA04=0;
gCallBackCnt=0;
CACHE_DISABLE
/**************************************************************************
* Set CallBack to callback function
***************************************************************************/
g_FlashLaunchCommand = (pFLASHCOMMANDSEQUENCE)RelocateFunction((uint32_t)__ram_func , LAUNCH_CMD_SIZE ,(uint32_t)FlashCommandSequence);
//**************************************************************************
destination = flashSSDConfig.PFlashBase + (flashSSDConfig.PFlashSize - 6*FTFx_PSECTOR_SIZE);
end = destination + 3*FTFx_PSECTOR_SIZE; // erase and program two sectors
while ((destination + (FTFx_PSECTOR_SIZE)) < end)
{
size = FTFx_PSECTOR_SIZE;
ret = FlashEraseSector(&flashSSDConfig, destination, size, g_FlashLaunchCommand);
if (FTFx_OK != ret)
{
ErrorTrap(ret);
}
// Verify section for several sector of PFLASH
number = FTFx_PSECTOR_SIZE/FSL_FEATURE_FLASH_PFLASH_SECTION_CMD_ADDRESS_ALIGMENT;
for(margin_read_level = 0; margin_read_level < 0x2; margin_read_level++)
{
ret = FlashVerifySection(&flashSSDConfig, destination, number, margin_read_level, g_FlashLaunchCommand);
if (FTFx_OK != ret)
{
ErrorTrap(ret);
}
}
destination += (size);
}
destination = flashSSDConfig.PFlashBase + (flashSSDConfig.PFlashSize - 6*FTFx_PSECTOR_SIZE);
exist_params=new_params;
size=sizeof(exist_params);//size of flash program must be multiple of 8 so adjust the size
size-=8;// here i am mincing(-) dnt_remove parameter size (confg parameter) because that variable for adjusting purpose only
if((size%8)!=0)//checking size is multiple of 8 or not if not it will adjust
{
adj_size=(size%8);
adj_size=8-adj_size;
size=size+adj_size;
}
if((size%8)==0)
{
//on 21-5-15 printf("\n\r\tVALUE ADJUSTED");
}
else
{
//on 21-5-15 printf("\n\r\tADJUSTED FAILED");
}
ret = FlashProgram(&flashSSDConfig, destination, size, \
&exist_params, g_FlashLaunchCommand);
if (FTFx_OK != ret)
{
ErrorTrap(ret);
}
}
void internal_flash_read()
{
unsigned char *dst;
unsigned char *exitparam_dst;
uint32_t FlashValueAtFA00=0;
uint32_t FlashValueAtFA04=0;
uint32_t i=0;
dst=flashSSDConfig.PFlashBase + (flashSSDConfig.PFlashSize - 6*FTFx_PSECTOR_SIZE);
//dst=1040384;
//dst=0x20000000;
exitparam_dst=&exist_params;
// printf("\n\rDATA START=%d\n\r=",FlashValueAtFA00);
for (i = 0; i <sizeof(exist_params); i++)
{
*exitparam_dst=*dst;
//FlashValueAtFA00=*exitparam_dst;
//printf("%d",FlashValueAtFA00);
dst++;exitparam_dst++;
}
// printf("\n\rDATA END\n\r");
}