why erase FLASH failed?

cancel
Showing results for 
Search instead for 
Did you mean: 

why erase FLASH failed?

Jump to solution
319 Views
terrybogard
Contributor II

#define MY_FLASH_LOCATION 0x00007C00 /* Flash memory location the data will be written to */

volatile bool DataWrittenFlg = FALSE;
LDD_TError Error;
LDD_FLASH_TOperationStatus OpStatus;
LDD_TDeviceData *MyFLASH_Ptr;
//UInt16 DataTest[] = {0,1,2,3,4,5,6,7,8,9};
//UInt16 *pClbrtData = 0;


void SaveClbrtData(void)
{
static UInt16 Cnt = 0;

MyFLASH_Ptr = FLASH1_Init(NULL); /* Initialization of FLASH1 component */
Error = FLASH1_Erase(MyFLASH_Ptr, MY_FLASH_LOCATION, 1024); /* Start erase to the flash memory */
/* Here some other application code can be placed */
while (!DataWrittenFlg)
{ /* Wait until the data are written */
FLASH1_Main(MyFLASH_Ptr); /* Run the main method */
Cnt++;
if(Cnt > 300)
{
break;
}
}

Device: MC56F82748

dear NXP expert, 

i try to erase a sector .p_FlashData (RWX) : ORIGIN = 0x00007C00, LENGTH = 0x00000400,

i am sure the FTFA_PDD_SetFCCOBCommand and FTFA_PDD_SetFCCOBAddress set as expected, no memory protected, FTFA_FPROTn bits are all 1.But i the memory corresponding no change to 0xFFFF, is there any operation need further?

thanks.

 

0 Kudos
1 Solution
302 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Alexander,

I suggest you use another flash bean rather than the one you use.

I attach an simple example to write flash based on MC56F82748 and PE, hope it can help you.

BR

XiangJun Rong

View solution in original post

0 Kudos
5 Replies
318 Views
terrybogard
Contributor II

if (DeviceDataPrv->CurrentOperation != LDD_FLASH_READ) {
FTFA_PDD_SetFCCOBCommand(FTFA_BASE_PTR, DeviceDataPrv->CurrentCommand); /* Set the desired flash operation command */
FTFA_PDD_SetFCCOBAddress(FTFA_BASE_PTR, ((uint32_t)(DeviceDataPrv->CurrentFlashAddress - DstAddrOffset))); /* Set an address of the flash memory location for the current flash operation command */
/* {Default RTOS Adapter} Critical section begin, general PE function is used */
EnterCritical();
DeviceDataPrv->SafeRoutineInCodePtr(); /* Run the Safe routine */
/* {Default RTOS Adapter} Critical section end, general PE function is used */
ExitCritical();
}

0 Kudos
303 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Alexander,

I suggest you use another flash bean rather than the one you use.

I attach an simple example to write flash based on MC56F82748 and PE, hope it can help you.

BR

XiangJun Rong

View solution in original post

0 Kudos
291 Views
terrybogard
Contributor II

and how can i write the struct type to the destination?

0 Kudos
280 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As you know that a struct includes multiple data type, for example byte, word, long word..., but the flash writing requires standard 16 bits data type(word type), so I think you can define a word array, copy the struct variable to the standard array.

Hope it can help you

BR

XiangJun Rong

0 Kudos
297 Views
terrybogard
Contributor II

hi xiangjun,

why you suggest use another flash bean.

I test your code, that's work well.

thanks a lot.

0 Kudos