how to write data flash (S32K328)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to write data flash (S32K328)

879 Views
canghai
Contributor I

I want to store some boot information in the dataflash area when designing the boot. Is there any related routine documentation that can be used as a reference? Currently, I have used AI to generate some operation methods (registers, c40uip), but none of them have been successful, and I don't know how to find the cause。

0 Kudos
Reply
2 Replies

852 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

There are RTD drivers, specifically Mem_43_INFLS (RTD 6.0.0):

https://www.nxp.com/design/design-center/software/automotive-software-and-tools/real-time-drivers-rt...

Pay attention to example 

C40_Ip_Example_S32K358

/**
* @brief Main function of the example
* @details Initializes IP C40 driver and erase, write, read internal flash memory
*/

0 Kudos
Reply

820 Views
canghai
Contributor I

Thank you, but I encountered a problem when using C40_SP for flash operations:

the boot is at core0 0x00400000, and when I perform a write operation on the address of core0 (0x00440000), it enters a hard fault. I confirm that the boot area code is only before 0x00440000 and there is no out of bounds issue, but operating on core1 area (0x00600000) with the same code is not a problem. What is the reason for this.

My rewrote code is as follow

/************ erase code******************/

if (C40_IP_STATUS_SECTOR_PROTECTED == C40_Ip_GetLock(sector_number)) {
printf("RAM: Sector %d is protected, clearing lock\r\n", sector_number);
C40_Ip_ClearLock(sector_number, 0);
}

C40_Ip_MainInterfaceSectorErase(sector_number, 0);do {
t_ReturnValue = C40_Ip_MainInterfaceSectorEraseStatus();
} while (C40_IP_STATUS_BUSY == t_ReturnValue);

 

/************ write code******************/

C40_Ip_MainInterfaceWrite(addr, length, data, 0);
do {
t_ReturnValue = C40_Ip_MainInterfaceWriteStatus();
} while (C40_IP_STATUS_BUSY == t_ReturnValue);

 

0 Kudos
Reply