I am using the S32K314 MCU and the C40_Ip Driver (RTD Version: 5.0.0) to manage flash operations. The MCU has four Code Flash Memory Blocks, and I want to erase one entire block.
I understand from the Reference Manual that using the block erase operation (via the ESS bit in the MCR register) is restricted for factory use only, due to its reduced endurance (25 Program/Erase cycles). As such, I am using the C40_Ip_MainInterfaceSectorErase() function provided by the driver to erase individual sectors.
Here are my specific questions:
@VaneB Thank you for you suggestion. I have checked that document and the example projects and since my query was not cleared from it, I posted the question on the forum.
My questions still remains the same, in order to erase a complete block of memory, do I have to erase sector by sector ? Are there no functions defined in order to do as currently C40 drivers do not have that option (to erase from one address till another) ?
Hi @ASN7
The C40_Ip/Fls or Mem_43_INFLS drivers only provides the sector-based erase function, but it can be used to erase multiple sectors in a single call as shown below:
#define EXAMPLE_NUMBER_OF_SECTORS (1U)
#define EXAMPLE_SECTOR_SIZE (0x2000U) /* 8K */
#define EXAMPLE_ERASE_SIZE (EXAMPLE_NUMBER_OF_SECTORS * EXAMPLE_SECTOR_SIZE)
#define EXAMPLE_SECTOR_START_ADDR (0x00600000U) /* C40_CODE_ARRAY_0_BLOCK_2_S256 */
#define EXAMPLE_BUFFER_SIZE (512U) /* byte */
uint32 t_SectorStartAddr = EXAMPLE_SECTOR_START_ADDR;
uint32 t_EraseSize = EXAMPLE_ERASE_SIZE;
uint32 t_BufferSize = EXAMPLE_BUFFER_SIZE;
/* Erase */
t_ReturnValue = Mem_43_INFLS_Erase(Example_MemInstanceId, t_SectorStartAddr, t_EraseSize);
Hi @ASN7
We provide Memori Guide application note and demo projects which explains all the steps in detail.
Application note can be can be downloaded from: S32K3 Microcontrollers for Automotive General Purpose > Documentation > S32K3 Memories Guide (AN13388)
The demo projects are provided with RTDs with the names "C40_Ip_Example_S32K344" and "Mem_InFls_Example_S32K344"
BR, VaneB