S32K324用C40接口向PFlash写数据返回错误码STATUS_C40_IP_ERROR_PROGRAM_VERIFY

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K324用C40接口向PFlash写数据返回错误码STATUS_C40_IP_ERROR_PROGRAM_VERIFY

357件の閲覧回数
cx9
Contributor I

S32K324,使用C40_Ip_MainInterfaceWrite向0x600000地址写入数据返回成功,C40_Ip_MainInterfaceWriteStatus函数体C40_Ip_Compare返回STATUS_C40_IP_ERROR_PROGRAM_VERIFY错误码,这个如何解决?

我的擦除、写代码如下:

#define FLS_ERASE_BLOCKB C40_CODE_ARRAY_0_BLOCK_2_S256 //0x00600000
uint8 PFlash_Erase(void)
{
C40_Ip_StatusType status;
uint32 i = 0;
uint32 Brush_TimerOut = 0;
 
/* Unlock sectors */
for (i=0;i<SECTOR_NUMBER;i++)
{
if(STATUS_C40_IP_SECTOR_PROTECTED == C40_Ip_GetLock(FLS_ERASE_BLOCKB + i ))
{
C40_Ip_ClearLock(FLS_ERASE_BLOCKB + i, FLS_MASTER_ID);
}
}
 
/* Erase sector */
for (i=0;i<SECTOR_NUMBER;i++)
{
Brush_TimerOut = 0;
C40_Ip_MainInterfaceSectorErase(FLS_ERASE_BLOCKB + i, FLS_MASTER_ID);
do
{
Brush_TimerOut++;
status = C40_Ip_MainInterfaceSectorEraseStatus();
}
while(STATUS_C40_IP_SUCCESS != status && Brush_TimerOut <= BRUSH_FLASH_TIME_OUT);
 
if(Brush_TimerOut >= BRUSH_FLASH_TIME_OUT)
return BRUSH_FLASH_ERROR;
 
}
 
return BRUSH_FLASH_OK;
}
 
uint8 PFlash_Write_Data_PTR[PFLASH_BUFF_SIZE];
uint8 PFlash_Write(uint32 T_Address,uint32 size, uint8 *data_t)
{
C40_Ip_StatusType status;
uint32 Brush_TimerOut = 0;
uint32 i = 0;
 
uint32 addr = T_Address;
 
/* Write data to Fls */
Brush_TimerOut = 0;
for(i = 0; i < size; i++)
{
PFlash_Write_Data_PTR[i] = data_t[i];
}
C40_Ip_MainInterfaceWrite(addr, 128, PFlash_Write_Data_PTR, FLS_MASTER_ID);
do
{
Brush_TimerOut++;
status = C40_Ip_MainInterfaceWriteStatus();
}
while(STATUS_C40_IP_SUCCESS != status && Brush_TimerOut <= BRUSH_FLASH_TIME_OUT);
 
if(Brush_TimerOut >= BRUSH_FLASH_TIME_OUT)
return BRUSH_FLASH_ERROR;
 
 
addr += 128;
C40_Ip_MainInterfaceWrite(addr, 128, &PFlash_Write_Data_PTR[128], FLS_MASTER_ID);
do
{
Brush_TimerOut++;
status = C40_Ip_MainInterfaceWriteStatus();
}
while(STATUS_C40_IP_SUCCESS != status && Brush_TimerOut <= BRUSH_FLASH_TIME_OUT);
 
if(Brush_TimerOut >= BRUSH_FLASH_TIME_OUT)
return BRUSH_FLASH_ERROR;
 
return BRUSH_FLASH_OK;
}
0 件の賞賛
返信
1 返信

336件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @cx9,

Can you check the flash in the memory view before and after the write? Is it really erased before the write?

 

Thank you,

Daniel

0 件の賞賛
返信