PE TOOL MEMORY PRESERVATION

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

PE TOOL MEMORY PRESERVATION

4,745 Views
hajianik
Senior Contributor I

Hi,

I'm having an issue with data written to flex Ram.

I can partition the device(S32K144) correctly and I write some 8 bytes at the top of the flex ram (0x14000_000)

Then I COMMENT OUT the statement which writes to the flex_ram and down load the code using the PE open SDA or multilink universal on S32K DESIGN STUDIO FOR ARM. When I look at memory at location (0x14000_000), it contains all FFFFFFs which is the erased state of the flex ram when used as EEPROM, please keep in mind that the partition still preserves but the data is lost.

In the debug configuration window under debugger tab there is advanced option button that lets you preserve the partition and some memory range(I guess they are there since the PE TOOL mass erases before it downloads), for memory range I put

0x14000_000 to 0x14000_FFF which is 4k however this does not do the trick .

Any help is appreciated.

0 Kudos
Reply
16 Replies

3,569 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

you need to preserve FlexRAM backup flash memory (located in FlexNVM). It depends on configuration - for maximum 4kB of FlexRAM used as EEPROM you need to preserve full FlexNVM - from 0x10000000 to 0x1000FFFF:

pastedImage_1.png

Jiri

3,569 Views
hajianik
Senior Contributor I

Hi Jiri,

Sorry for the confusion.

Actually I was wrong in my assertion that It works when running off the debugger . It does not, The reason that I thought it did, is the fact that it failed to download without the write to EEPROM, and it was still running the old code with the EEPROM write in. I tried a different range since my partition is 32k_32k(1000_8000 to1000_ffff)  and it still fails to flash . below is from debugger flash council:

Connection from "127.0.0.1" via 127.0.0.1

Connection from "127.0.0.1" via 127.0.0.1

Telnet server running on 127.0.0.1:51794

Copyright 2012 P&E Microcomputer Systems,Inc.

Command Line :C:\NXP\S32DS_ARM_v2.0\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_3.1.1.201708081924\win32\pegdbserver_console -device=NXP_S32K1xx_S32K144F512M15 -startserver -singlesession -serverport=7224 -gdbmiport=6224 -interface=OPENSDA -speed=5000  

CMD>RE

Initializing.

Target has been RESET and is active.

CMD>CM C:\NXP\S32DS_ARM_v2.0\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_3.1.1.201708081924\win32\gdi\P&E\supportFiles_ARM\NXP\S32K1xx\freescale_s32k144f512m15_pflash_dflash_eeprom.arp

Initializing.

Initialized.

;version 1.02, 01/20/2017, Copyright 2017 P&E Microcomputer Systems, Inc. All rights reserved. www.pemicro.com [s32k144f512m15_x_pflash_dflash_eeprom_rev2]

;device freescale, s32k144f512m15, pflash_dflash_eeprom

;begin_cs device=$00000000, length=$14001000, ram=$20000000

Loading programming algorithm ...

WARNING - Selected .ARP file has been modified. CRC16 = $6A9F

Done.

CMD>PA 0203

Started.

Done.

CMD>VC

Verifying object file CRC-16 to device ranges ...

block 00000000-00012E97 ...

Calculated CRC-16 does not match block. (File = $8B83, Device = $BCEB)

CMD>EM

Preserving data range $10000000-$1000FFFF before erase ...

Done.

Erasing.

Module has been erased.

Reloading programming algorithm ...

done.

Re-programming preserved data range $10000000-$1000FFFF ...

Done.

Error communicating to target processor - try a RESET.

CMD>PM

Programming.

Processing Object File Data ...

.

Programmed.

Error communicating to target processor - try a RESET.

CMD>VC

Error loading CRC-16 algorithm.

Error loading CRC-16 Algorithm.

Error verifying flash of device

Error occured during Flash programming.

Thanks,

0 Kudos
Reply

3,569 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

it looks like that you are using older version of PE Micro tool set. Please update the tools to latest version by clicking on Help -> Install New Software

pastedImage_1.png

Click on Available Software Sites and check PE Micro:

pastedImage_2.png

As a last step - select All Available Sites and proceed with update: 

pastedImage_4.png

Hope it will fix the PE Micro debug issue. 

Jiri

0 Kudos
Reply

3,569 Views
hajianik
Senior Contributor I

Hi Jiri,

Thank you for your quick response.

I followed your instructions to update the P&E . Unfortunately that did not resolve the issue. exact same thing happens.

Capture_ERROR.PNG

This error message appears after flash failure.

Location 0x412 is in the beginning of the Reset_Handler.

Please note that if the box in Memory preservation field is unchecked , the down load and debug wok fine.

The location mentioned in problem report is not protected or secured.

Really don't know what is going on.

Thanks

0 Kudos
Reply

3,569 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

it is possible share your project? If not - can you test flash_partitioning_s32k144 example project? This project does almost the same stuff as yours - and for me is working without any issue when preserve memory is checked. 

pastedImage_1.png

You can also try Kinetis emergency erase:

pastedImage_2.png

Jiri

0 Kudos
Reply

3,569 Views
hajianik
Senior Contributor I

Sorry,

I wrote AND THEN COMMENT THE EEPROM OUT

it should say:

"AND THEN COMMENT THE WRITE TO EEPROM OUT".

0 Kudos
Reply

3,569 Views
sakthivelkuland
Contributor III

@Koorosh Hajiani

I'm also  facing the same problem,

Did you found the solution for this issue?

I have checked the Preserver Range (0x10000000 - 0x1000ffff)

During the Flashing D-Flash has erased, so the FlexRAM (EEPROM) all data will be FF

Please let me know if you have any findings?

Thanks,

Sakhtivel K

0 Kudos
Reply

3,569 Views
hajianik
Senior Contributor I

Hi,

I got over the issue ,which is not a %100 full proof but still let me debug on 32k design studio by configuring the tool as below:

Capture_advanced_option_ debug_config.PNG

which configure 64k of d flash as back up and 32k flex ram as NVRAM.

0 Kudos
Reply

3,569 Views
jiri_kral
NXP Employee
NXP Employee

I updated the EXAMPLE: S32K144 EEEPROM usage - No SDK  example. There is bug in PE Micro flashing algorithm. Thank you to discover this bug, hope that the PE Micro will fix it soon. 

Jiri 

0 Kudos
Reply

3,569 Views
hajianik
Senior Contributor I

Hi,

Do you mean that in 32k design studio ,Advanced Otion , unde Flash Algorithm selection the following algorithm "freescale_s32k144f512m15_pflah_dflash_eeprom"  has a bug?

I'm confused.

Thanks,

0 Kudos
Reply

3,569 Views
jiri_kral
NXP Employee
NXP Employee

Well, at least with some option - partition protection and memory protection the pegdbserver crashes. It is probably script interpreter crash, but user is using the script. Anyway - it is already logged in as a bug. 

0 Kudos
Reply

3,569 Views
hajianik
Senior Contributor I

MY_TEST_20.zip

<https://drive.google.com/file/d/1TFqpXa2KfyXbclGHzlbIQVJ1TnQP5CFs/view?usp=drive_web>

​Hi Jiri,

Thanks for your response.

Actually I tried the example project , exact same thing happens.

the project is attached.

The initialization and portioning of the flex NVM is in

C:\my_ws_5\MY_TEST_20\Sources\mcal\mcal_s32k144.c.

The writing to FLEX_RAM is in C:\my_ws_5\MY_TEST_20\Sources\srvc\tasks.c ,

the function is called TASKS_App50ms*, *line 281.

I first write 0x99887766 at 0x14000_000 AND THEN COMMENT THE EEPROM OUT,

SAVE REBUILD AND FLASH .That's when the issue occurs.

Same exact thing happens with the example project.

Thanks,

Koorosh

On Mon, Dec 4, 2017 at 3:02 AM, jiri.kral@nxp.com <admin@community.nxp.com>

0 Kudos
Reply

3,569 Views
jiri_kral
NXP Employee
NXP Employee

Hi Koorosh, 

I tested your project - and for me is downloading with preserved mem working (I check it multiple times - without any issue). 

Here is my console output (you can compare it with yours) 

==========================================================================

Connection from "127.0.0.1" via 127.0.0.1
Connection from "127.0.0.1" via 127.0.0.1
Telnet server running on 127.0.0.1:51794
Searching for FreeRTOS Kernel Symbols...
pxCurrentTCB not found. FreeRTOS analysis not enabled.
Copyright 2017 P&E Microcomputer Systems,Inc.
Command Line :C:\NXP\S32DS_ARM_v2.0\eclipse\plugins\com.pemicro.debug.gdbjtag.pne.expansion_3.2.4.201710241511\win32\pegdbserver_console -device=NXP_S32K1xx_S32K144F512M15 -startserver -singlesession -serverport=7224 -gdbmiport=6224 -interface=OPENSDA -s˜

CMD>RE

Initializing.
Target has been RESET and is active.
CMD>CM C:\NXP\S32DS_ARM_v2.0\eclipse\plugins\com.pemicro.debug.gdbjtag.pne.expansion_3.2.4.201710241511\win32\gdi\P&E\supportFiles_ARM\NXP\S32K1xx\freescale_s32k144f512m15_pflash_dflash_eeprom.arp

Initializing.
Initialized.

;version 1.03, 10/09/2017, Copyright 2017 P&E Microcomputer Systems, Inc. All rights reserved. www.pemicro.com [s32k144f512m15_x_pflash_dflash_eeprom_rev2]

;device freescale, s32k144f512m15, pflash_dflash_eeprom

;begin_cs device=$00000000, length=$14001000, ram=$20000000

Loading programming algorithm ...

WARNING - Selected .ARP file has been modified. CRC16 = $22E3
Done.
CMD>VC
Verifying object file CRC-16 to device ranges ...
block 00000000-00013017 ...
Calculated CRC-16 does not match block. (File = $5E88, Device = $D61E)

CMD>EM
Preserving data range $10000000-$1000FFFF before erase ...
Done.

Erasing.
Module has been erased.
Reloading programming algorithm ...
done.
Re-programming preserved data range $10000000-$1000FFFF ...
Done.
CMD>PM

Programming.
Processing Object File Data ...


.
Programmed.
CMD>VC
Verifying object file CRC-16 to device ranges ...
block 00000000-00013017 ...
Ok.
Checksum Verification Successful. (Cumulative CRC-16=$5E88)

CMD>RE

Initializing.
Target has been RESET and is active.

====================================================================

Are you using S32K144 EVB with Open SDA?

Jiri 

0 Kudos
Reply

3,569 Views
hajianik
Senior Contributor I

Hi Jiri,

Thanks as always for getting back with me quickly.

That's good news.

Yes, I'm using  Open SDA.

just want to make sure when you're saying " it's working for you", We're on the same page.

The way I test this is as follows:

I write to the location 0x14000_000 successfully , Then I comment out the statement on line 281 in tasks.c file

FLASH_DRV_EEEWrite(&flashSSDConfig, 0x14000000, 4, sourceBuffer);

I do this to make sure that the value written previously preserves and the code is not writing to EEPROM anymore.

I build the code and try to download using OPEN SDA, that's when it fails to flash.

I was wondering if you tested it the same way and it works for you.

Thanks,

0 Kudos
Reply

3,569 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

I have to use different setup - For some reason (probably communication issue? ) The OS can't start for me. So - I write data into EEEPROM ( by the very same command copy-pasted from your code) in different project. I clean your project,  commented out FLASH_DRV_EEEWrite from your code (in tasks.c file) , set memory preservation, built and upload your project. The data on 0x14000000 remains the same as I wrote before in different project. There was no issue during flashing.  

Your issue is related to Flashing phase - technically I modified EEEROM data, preserve the memory and flashed your project. In Memory view I can see correct data. 

Jiri

0 Kudos
Reply

3,569 Views
hajianik
Senior Contributor I

Hi Jiri,

Thanks for your quick response.

Your suggestion works when I run off the debugger, I use printf to read back the location that I wrote to however when I try to debug using open SDA or other multilink debuggers , I can not debug.

I use the SDA /MULTI LINK  to download and run it without the debugger and that works but the debugger just does not work at all unless I uncheck the box for memory preservation.

Thanks,

Koorosh

0 Kudos
Reply