Hi,
When I tried to write the data to the flash -c55 using emulation software, It is going to an exception,
The reason for it because of the value of dest variable(value is 7),
I tried to debug this issue, I noticed that blocks blankspace configuration is assigned to this block, still not understanding how to overcome this issue,
I have configured all the parameter properly as per my understanding It should work. I feel some issue with emaulation software, Please let me know how to resolve this issue
My configuration and the code
code: causing problem while writing the data
/* Invalidate flash controller cache */
DisableFlashControllerCache(FLASH_PFCR1, FLASH_FMC_BFEN_MASK, &pflash_pfcr1);
DisableFlashControllerCache(FLASH_PFCR2, FLASH_FMC_BFEN_MASK, &pflash_pfcr2);
/* Unlock all EEPROM blocks */
ret = FLASH_DRV_SetLock(C55_BLOCK_LOW, UNLOCK_LOW_BLOCKS);
ret = FLASH_DRV_SetLock(C55_BLOCK_MID, UNLOCK_MID_BLOCKS);
ret = FLASH_DRV_SetLock(C55_BLOCK_HIGH, UNLOCK_HIGH_BLOCKS);
/* Initialize EPROM emulation */
ret = EEE_DRV_InitEeprom(&userConf, &state);
/*---------------------------------------------------------------------*/
/* Read data from EEPROM-----------------------------------------------*/
/*---------------------------------------------------------------------*/
ret = AppNVM_ReadData(NVM_LH_RIDE_HGT_OFFEST_ID,sizeof(rhs_left_hgt_offset),(uint32_t)&rhs_left_hgt_offset,&recordAddr,EEE_IMMEDIATE_NONE);
ret = AppNVM_ReadData(NVM_RH_RIDE_HGT_OFFEST_ID,sizeof(rhs_right_hgt_offset),(uint32_t)&rhs_right_hgt_offset,&recordAddr,EEE_IMMEDIATE_NONE);
uint8_t data[4]={0,};
uint8_t size = sizeof(data);
/* Write data to the EEPROM------------------------------------------- */
if( pid == PID_LEFT_HT_ZERO)
{
Value2Bytes(UINT32,&Diag_data_LeftHgt_PID,data);
ret = AppNVM_WriteData(NVM_LH_RIDE_HGT_OFFEST_ID,size,(uint32_t)data,EEE_IMMEDIATE_NONE);
//ret = EEE_DRV_WriteEeprom(NVM_LH_RIDE_HGT_OFFEST_ID,size,(uint32_t)data,EEE_IMMEDIATE_NONE);
}
else
{
Value2Bytes(UINT32,&Diag_data_RightHgt_PID,data);
ret = AppNVM_WriteData(NVM_RH_RIDE_HGT_OFFEST_ID,size,(uint32_t)data,EEE_IMMEDIATE_NONE);
//ret = EEE_DRV_WriteEeprom(NVM_LH_RIDE_HGT_OFFEST_ID,size,(uint32_t)data,EEE_IMMEDIATE_NONE);
}
My observation:
I observed that blank space value which is copied from g_eeeState which is having value 4294967295
which is the maximum value uint32_t variable can hold,
when we add idOffset (value
When we divide that 7 by 8 it is end up DEV_ASSERT loop
I am sure that blankspace value is copied from configuration parameter but I am not able to understand why value is 0xFFFFFFFF(max value of uint32 datatype)
解決済! 解決策の投稿を見る。
Hi @SAchary11
It's MPC5748G, right?
I would start with your configuration. I can see three issues there:
Size of block at 0xFB0000 is not 16KB but 32KB:
Then the masks are not correct. For block at 0xF94000 it's 0x2, for block at 0xFB0000 it's 0x100:
So, try to fix this configuration as a first step.
Regards,
Lukas
Hi @SAchary11
It's MPC5748G, right?
I would start with your configuration. I can see three issues there:
Size of block at 0xFB0000 is not 16KB but 32KB:
Then the masks are not correct. For block at 0xF94000 it's 0x2, for block at 0xFB0000 it's 0x100:
So, try to fix this configuration as a first step.
Regards,
Lukas
Hi Lukas,
yes, it is MPC5748G,
Thanks for the reply! It has worked after correcting the configuration.
I have one more question regarding Endianess,
In the below screenshot the highlighted data variables are written and read from flash, there is a change in the endianess
Do we need to explicitly handle the endianess each time when we write or read the data?
Hi Sukesh,
you don't need to consider the endianness at all. It looks rather like an issue related to wrong size of the record or something like that. Because you selected variable length record scheme, could you check if the same size was used for write and read function?
Regards,
Lukas