Hello,
I am working on the s32k148 and in my use case, I want to erase and write the data into the flash which is received via CAN by using UDS 36 service.
So is there any useful example so I can refer to that and start the implementation or any resource that can I refer to please let me know.
I am new in the flash erase and writing on NXP S32k148.
So help from NXP Community it will really helpful.
Thanks in Advance,
Hello,
You can refer to the Unified Bootloader Framework:
Or you can look for third-party solutions
Regards,
Daniel
Hello,
The PFlashSize should be 0x00180000, but this is not the issue here.
Can you place a breakpoint at
/* Calling flash command sequence function to execute the command */
ret = FLASH_DRV_CommandSequence(pSSDConfig);
and read the FCCOBx registers?
Regards,
Daniel
Hi Danial,
Thanks for your support,
As you suggested to check the register values PFA images for more details on the registers data.
is anything I missing?
Regards,
Kallappa
Hi Kallappa,
Can you halt the execution right after the CCIF flag is set in the FLASH_DRV_CommandSequence(pSSDConfig) function.
These are the error conditions that could be causing it:
Thank you
BR, Daniel
Hi Daniel,
we are able to erase PFLASH memory from address 0x00080000 and able to protect the memory from address 0x00000000 to 0x0007FFFF to achive this what we have did is mentioned below points.
Project Scenario
We have Bootloader and application and We kept Bootloader at address 0x00000000 to 0x0007FFFF block and remaining 1MB PFLASH from 0x00080000
is used for Application
We are able to delete the PFLASH from 0x00080000 for that we used Function called FLASH_DRV_EraseBlock.
and while Flashing Bootloader it is erasing Application and Vice-Versa for that we used memory protection mechanism as shown below picture.
So Please let us know whether we are doing correct or not?
Can we do the same thing via program/code itself?
Thanks for support
Hi @Kallappa
Thank you for the updates.
So, I understand the issue with the block erasing has been solved.
The advance option of the PE Micro plugin tells the programmer to not erase and reprogram certain part of the memory, but the bootloader or the application can modify the flash protected there.
You can however protect the flash part you want in the flash configuration field:
The flash is then protected out of reset.
During the system reset sequence, the content of the FPROTn bytes is moved to the FPROTn registers.
Regards,
Daniel
Hello Daniel,
As your suggestion, I halted the execution to check CCIF flag after set [Please refere below image],
/* Check if an error is occurred */
if ((FTFx_FSTAT & (FTFx_FSTAT_MGSTAT0_MASK | FTFx_FSTAT_FPVIOL_MASK | FTFx_FSTAT_ACCERR_MASK | FTFx_FSTAT_RDCOLERR_MASK)) != 0U)
{
ret = STATUS_ERROR;
}
and
we checked the errors at the above point of statement execution & didn't get any error
Thanks