S32K116 Flash Issue

cancel
Showing results for 
Search instead for 
Did you mean: 

S32K116 Flash Issue

251 Views
chaitanya_kalya
Contributor III

Hello,

I am working on urgent project. For our one of the project we are using S32K116 MCU.

 

We are facing issue for flash. After power on reset data getting lost.

 

And when I used Flash module then not able to write the data FLASH_DRV_EEEWrite using this API.

 

After using FLASH_DRV_EEEWrite the data is not getting written in flash.

 

Thank you in advance. 

 

 

 

0 Kudos
13 Replies

237 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @chaitanya_kalya,

Is the FlexNVM partitioned for EEPROM?

What is the value of SIM_FCFG1[DEPART]?

Is FTFC_FCNFG[EEERDY] set after the power-on reset?

The EFlash (or EEPROM backup) is not accessible to the user.

 

Regards,

Daniel

0 Kudos

227 Views
chaitanya_kalya
Contributor III

Hello @danielmartynek ,

 

Thank you for the quick response.

I am using Flash as EEPROM by referring flash_partiitioning_s32k116.

For SIM_FCFG1[DEPART] and FTFC_FCNFG[EEERDY] not setting any value after power on reset.

Can you please provide me any example.

 

 

0 Kudos

216 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @chaitanya_kalya,

The example flash_partiitioning_s32k116 utilizes the EEPROM.

You can halt the execution right at the beginning of the example with a loop like this:

volatile uint32_t flag_var = 1;
while(flag_var)
{
}

So that the example can't do anything after the power-on reset.

The flag_var can be cleared later in the Variables window (S32DS).

If you use a PE Micro debugger, you can attach the debugger to the running target without reprogramming the MCU.

danielmartynek_0-1620128615673.png

While the execution is in the loop, read these registers:

danielmartynek_1-1620128745532.png

If the FlexNVM is partitioned for EEPROM and EEERDY == 1, you should see all the data preserved in the FlexRAM (EEEPROM).

Also, you can preserve the partitioning while loading another project using the Preserve partitioning option:

danielmartynek_2-1620128906147.png

danielmartynek_3-1620128944423.png

 

Regards,

Daniel

 

 

 

0 Kudos

201 Views
chaitanya_kalya
Contributor III

Hello @danielmartynek 

 

I am working on project and in that I am initializing like this.  

chaitanya_kalya_0-1620144639671.png

After power on reset data getting lost.

 

Flashed program also getting lost. Again need to re-flash the program. 

0 Kudos

186 Views
danielmartynek
NXP TechSupport
NXP TechSupport

What do you mean by "Flashed program also getting lost"?

Do you load the project to SRAM or FLASH?

 

BR, Daniel

0 Kudos

177 Views
chaitanya_kalya
Contributor III

Hello @danielmartynek 

 

I checked for Startup -> Attach to running Target.

After selecting this option program getting stuck in ISR.

 

I am using FLASH only to dump the code.

 

I am using the same way with S32K142 for another project but there is no issue with data lost after power on reset 

 

Can you please provide me the solution ASAP. 

 

I am working on urgent project.

 

Thank you in advance.

0 Kudos

166 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @chaitanya_kalya,

Which ISR?

Do you have HardFault Handler in the project with an endless loop?

After POR, the SRAM is not defined.

The code must be in the Flash.

Please make sure the code is in the Flash before it gets power-cycled.

 

Regarding the EEPPROM, as I already mentioned, you need to check the EEERDY flag.

Please refer to AN11983 Using the S32K1xx EEPROM Functionality

8.3 Power-On recommendation

9 Appendix A EEPROM examples

https://www.nxp.com/docs/en/application-note/AN11983.pdf

 

Regards,

Daniel

 

 

0 Kudos

157 Views
chaitanya_kalya
Contributor III

Hello @danielmartynek 

 

After compilation there is no issue and when we attach a debugger program is working fine.

 

Like I am using LIN communication so LIN is working fine but after power in reset data is getting lost. 

 

No LIN frame is able to receive and after power on reset need to re-flash the program. 

 

I am using option ProjName_Debug_PNE to flash the program using PE Multilink. I am using the same option for other project as well but there is  no issue.

 

Environment: S32 Design Studio ARM 2.2

Compiler: IAR

SDK Version : S32_SDK_RTM_3.0.0

chaitanya_kalya_0-1620214526413.png

 

How can I resolve this issue.

 

 

0 Kudos

140 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @chaitanya_kalya,

What linker file does this ProjName_Debug_PNE debug configuration use?

Because it really looks like you are loading it into SRAM.

 

Regards,

Daniel

 

 

0 Kudos

131 Views
chaitanya_kalya
Contributor III

Hello @danielmartynek 

 

It is using S32K116_17_flash.icf as linker file.

0 Kudos

100 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @chaitanya_kalya 

I have difficulties to understand the issue here.

You said that the program does not work after POR e.g. the EEPROM data are missing, LIN does not work.

 

There could be these reasons:

 

1. The code is in SRAM and it works until the MCU is power-cycled - that would explain the LIN behavior.

Please read the map file to see where the code is, make sure you load the correct image, and you can step the code and read the PC.

 

2. The MCU is mass-erase and re-flashed when the debugger gets connected after the POR - that would explain the missing EEPROM data.

If this is the issue, you can simply attach the debugger to the running target as it was explained already.

 

3. The LIN does not work because of a fault exception detected after the POR.

Please implement HardFault handler and debug it.

 

Thank you,

Regard,

Daniel

 

 

 

 

0 Kudos

72 Views
chaitanya_kalya
Contributor III

Hello @danielmartynek 

 

Thank you for your response.

 

Program is not working after power on reset issue resolved. The issue is with S32 Design Studio V2.2 .

 

When I created same program with old IDE that is S32 Design Studio v2018 then it is working fine with same configuration.

 

In case if LIN I was configured for my project requirement and after porting project to 2018 IDE it is working after power on reset.

 

In case of while flashing giving this message

chaitanya_kalya_2-1620549675148.png

after flashing of EEPROM from underline code it is entering into DefaultISR.

chaitanya_kalya_0-1620548831765.png

chaitanya_kalya_1-1620549098097.png

In case of example it is working fine. 

 

I am working on urgent project. Quick response highly appreciated.

0 Kudos

27 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @chaitanya_kalya,

I'm sorry but I have difficulties to understand the description of this issue.

If you have found an issue with the Design Studio, please create a new thread on the S32DS community: https://community.nxp.com/t5/S32-Design-Studio/bd-p/s32ds

Regarding the DefaultISR, this is only a default ISR for all the unimplemented interrupts.

As I mentioned in my previous post, please implement HardFault_Handler() in you project.

Also again, please read DEPART and EEERDY before you start using the EEPROM.

Where is the FLASH_DRV_CommandSequece() function located?

It should be in SRAM.

 

Thank you,

BR, Daniel

 

0 Kudos