Example: S32K144 EEEPROM usage

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Example: S32K144 EEEPROM usage

Example: S32K144 EEEPROM usage

 Example shows how to configure PE Micro debugger to be able use FlexNVM as
 backup for EEEPROM - Emulated EEPROM  (Backup size 64kB, EEEPROM size 4kB) and preserve the backup
 memory. Configuration can be found in debugger Advanced Options.

s32ds_2018-01-23_09-15-08.png

 In the example is data structure located in FlexRAM section by linker file.
 FlexRAM data change cause flash store on background. Prior each data
 change you shall check if previous flash operation is done.

s32ds_2018-01-23_09-17-59.png

 In the example are two ways of FlexRAM (configured as an EEEPROM) usage:

  •  Direct access (up to 4 bytes can be stored once)
  •  IO Functions

 By direct access you can store only data up to 4 bytes. There is no way how
 to use memory move functions like memcpy/strcpy. In this case you need to
 use functions for store arrays or 4 bytes+ types like double.

 Part of example is LPIT timer storing runtime counter (seconds) each minute.


 PE Micro configuration:
 Enable partitioning for the device - code: 0x0204
 Preserve memory - range: 10000000-1000FFFF

添付
コメント

jiri.kral@nxp.com‌  In our project, we are using the Flex NVM block as 2 partitions -  16 kb as data flash for storing parameters and 48 kb as EEPROM. When I flash the application binary, I set it up to partition the NVM in the debug configuration as mentioned in the example above (with partition code 0x020A). In the application initialization phase, I am executing the Flash init function from SDK ret = FLASH_DRV_Init(&flash_InitConfig0, &flashSSDConfig); to check if the partition is ok. But, I see that the EEESize is reported as zero. It seems the partitioning does not happen.

I tried with the code 0204 as in your example and see the same result. Am I missing any step here?

pastedImage_1.png

Console log:

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=USBMULTILINK -speed=˜

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 0204

Started.
Done.
CMD>VC
Verifying object file CRC-16 to device ranges ...
block 00000000-00016EF7 ...
Ok.
block 0007E000-0007E160 ...
Ok.
Checksum Verification Successful. (Cumulative CRC-16=$E4FF)
Application verified in memory. No need to reprogram.

CMD>RE

Initializing.
Target has been RESET and is active.
Disconnected from "127.0.0.1" via 127.0.0.1
Disconnected from "127.0.0.1" via 127.0.0.1
Target Disconnected.

Hi, 

0x020A is correct code - but the partitioning is write-once operation. If you use partitioning with PE Micro - you can't modify it in runtime, For me is your scenario working - I changed the example 0x0204 partitioning code to 0x020A:
pastedImage_4.png

Also make sure that DFLASH area in linker file (if you flash data into custom dflash section) doesn't exceed the 16kB size (0x10000000 to 0x10004000). 

Jiri

jiri.kral@nxp.com Hello Jiri,

I need assistance to figure out how to flash the application and data into flash memory properly without affecting other areas using PE micro. We have designed our memory layout like this:

We have set up data flash portion like this:

16 kb of D-flash memory

48 kb of Emulated EEPROM

using partition code 0x020A.

I am able to do a one time partition of the flex NVM as you had explained using this configuration:

pastedImage_1.png

We use 3 files:

1. application binary that sits in P-flash partition

2. Data file that sits in D-flash (address 0x10000000 to 0x100007FF) [CIB_S32_production_param.srec]

3. Data file that sits in D-flash(address 0x10001000 to 0x100017FF) [CIB_S32_appl_config_data.srec]

Our requirement:

We need to flash the device once to setup the Flex NVM partition.

After that, I need to be able to flash either of these files (data or application file) without erasing other files or resetting the FlexNVM partition. What I see is that if I flash any of the files after the initial partition, the flex NVM partition is getting reset. I tried to check the "Preserve Partitioning for the device". Even then, it looks like the partition is reset.

I have shared the sample data files here:

data_files.7z - Google Drive 

Can you help in setting up debug configuration for each of these files so that I only change the required memory areas and do not alter the partition configuration.

I may have figured out the solution myself. If I set the partition configuration in the debug configuration for all my files and also specify the memory preservation, I could see that the partition is maintained and the data in other areas are also preserved. For e.g: I used the configuration below for the file that resides in 0x1000000 to 100007FF. Here I set up the preservation for my application code at 0x0 to 0x7FFFF and for the other file at 0x10000800 to 0x100017FF. I also set up the partition to 0x020A. Now, when I flash this, the application reboots with the proper flexNVM partition.

But I dont understand what the option Preserve Partitioning for the device does. When I enabled this, the earlier partition configuration is cleared after flashing. I am not clear when this should be used and if this can be used along with the Enable Partitioning for the device  option

@Venkatraman C  and @ Jiri Kral 

I have one another question, I have referred the Example Program this program has used the SDK Generated file for the FlexNVM. My request is that without using SDK and Generated files how I will configure the FlexNVM as EEPROM for my application.

Is there any example for FlexNVM without used SDK and generation Files.

Please help me on this.

Thanks ,

Sakthivel K

Hi Sakthivel, 

unfortunatelly - there is  no non SDK example for EEPROM usage. You can go through FLASH_DRV_EEEWrite() SDK function and see how is implemented or see Reference manual and see how to use EEPROM. 

Jiri

Hi, 

I found this application note - https://www.nxp.com/docs/en/application-note/AN11983.pdf?fsrch=1&sr=2&pageNum=1 

Hope it helps. 

Jiri 

Thanks for your quick response,

Now my application not used any SDK, can I used the SDK for the EEPROM with my existing project ?. This will cause any problems.

Now I'm used s32k144_EVB for The initial development of my project.

Sakthivel K

Hi,

in the example named "Example_S32K144_EEEPROM_usage.zip" there are some writes in FlexRAM, but before each writes there is :

while ((FTFC-> FSTAT & FTFC_FSTAT_CCIF_MASK) == 0){}

This is mandatory?

There is the possbility to eliminate it ?

Thanks a lot.

Hi,

well - this is mandatory in case that you are going to write continuously data portions. It can't be done before previous operation is done. You can do anything useful instead waiting till operation is finished. But be sure that before next write all previous writes are done. 

Jiri

@jiri Kral

Thanks for your document, I have referred the document, One thing I'm not clear,

 pastedImage_1.png

     pastedImage_2.png

I have decided to use this option, for my project requirements means I have store the User configuration data(sensor ID (4byes *24), another configuration parameter), Could you suggest me this option is suitable for?

 ?above code snape "flash_launchCommand() " used for, what should I write the code for this function definition.

I'm still configuration of using Read and write sequence of EEPORM Usage for my Project.

Please give me the clear idea.

Sakthivel K

oValidation of FlexRAM as EEPROM and EEPROM backup in S32K144

Please verify my programming sequence 

step 1:

The main function→init_EEPROM()

pastedImage_2.png

step2: init_FlexRAM()

pastedImage_3.png

Flash_launchCommand()

pastedImage_4.png

step 3:

EEE_Write_ByteArray(data,&FLEXRAM_START_ADD,strlen(data));

My Question:

1. is that mandatory to do the PE Configuration? If then once I did the Configuration, I should manually change the   s32K144_64_Flash.ld file as mentioned above.

2. If any configuration I have missed?

3. In the example program used SDK but my project not used SDK so, Should do the FLASH_DRV_init()?

4. When I used the init_EEPROM() function program not running as expected if this configuration wrong?

Please help me on this,

Sakthivel K

@ Jiri Kral

I have followed the PE Configuration,

1.Flash Memory setting

pastedImage_4.png

2. Manually change .ld file

pastedImage_5.png

3. I have used the same  data structure located in FlexRAM section by linker file

4. Build success, but during debugging below errors are occurring, Please let me know what could be the problems?

pastedImage_3.png

Console Log:

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_v1.3\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_3.4.9.201804042108\win32\pegdbserver_console -device=NXP_S32K1xx_S32K144F512M15 -startserver -singlesession -serverport=7224 -gdbmiport=6224 -interface=USBMULTILINK -speed=|

CMD>RE

Initializing.
Target has been RESET and is active.
CMD>CM C:\NXP\S32DS_ARM_v1.3\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_3.4.9.201804042108\win32\gdi\P&E\supportFiles_ARM\NXP\S32K1xx\freescale_s32k144f512m15_pflash_dflash_eeprom.arp

Initializing.
Initialized.

;version 1.04, 11/30/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 = $4977
Done.
CMD>PA 0204

Started.
Done.
Programming sequency is : erase, blank check, program, and verify {default}
CMD>VC
Verifying object file CRC-16 to device ranges ...
block 00000000-000011AB ...
Calculated CRC-16 does not match block. (File = $BC61, Device = $4E54)

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.

Hi, 

you can use eeeprom_io_control from example. I tried remove all SDK stuff - and for me it is working. I tested in with non-SDK hello word example. 

Basically - only what is mandatory prior EEERAM usage is DFLASH partitioning (via PE Micro for example)  - and preserve memory from 0x10000000-0x1000FFFF from being rewritten by PE Micro. 

You can check EEERAM readiness in FTFC->FCNFG->EEERDY register bit. Should be set to 1. 

pastedImage_1.png

I'm going to add non SDK EEERAM usage example into example list later today. 

Jiri 

 Thanks for your response,

The example program is available for  EEPROM usage using non-SDK?

I'm facing still an issue:

Case1: PE Configuration is done and manually changed in S32K144_flash.ld file as mentioned above. (Is that must to di manual change in ..ld file?)

Case2: FlexNVM Partition done by SW,

u8ret = FLASH_DRV_Init(&Flash_InitConfig0,&flashSSDConfig);
if(u8ret != STATUS_SUCCESS)
{
return u8ret;
}

// let's check if FlexRAM is configured by PE Micro properly
if(flashSSDConfig.EEESize==0)
{
u8ret = FLASH_DRV_DEFlashPartition(&flashSSDConfig, 0x02, 0x08, 0x0u, false, true);
DEV_ASSERT(STATUS_SUCCESS == u8ret);
u8ret = FLASH_DRV_Init(&Flash_InitConfig0, &flashSSDConfig);
DEV_ASSERT(STATUS_SUCCESS == u8ret);
u8ret = FLASH_DRV_SetFlexRamFunction(&flashSSDConfig, EEE_ENABLE, 0x00u, NULL);
DEV_ASSERT(STATUS_SUCCESS == u8ret);
}

-----------------------------------------

if(flashSSDConfig.EEESize != 0)
{
address = flashSSDConfig.EERAMBase;
size = sizeof(uint32_t);
ret = FLASH_DRV_EEEWrite(&flashSSDConfig, address, size, sourceBuffer);
if (ret != STATUS_SUCCESS)
{
return ret;
}
/* Verify the written data */
if (*((uint32_t *)sourceBuffer) != *((uint32_t *)address))
{
/* Failed to write data to EEPROM */
exit_code = 1u;
return exit_code;
}

Case3: very first time when Debugger  runs this time no issue.

Case4: Next time same code start debugging problem has occurred as mentioned above post.

"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."

Please help me to resolve this, I'm stuck with this issue long time.

Hi,

 

the non-SDK example is here: Example: S32K144 EEEPROM usage - No SDK - partitioning is done by software. There is hardcoded 64kB backup DFLASH. You can change the size by your requirements. Feel free reuse any part of the example. 

Sometimes with PE Micro I got similar errors like you - especially when MCU is already partitioned and there is active memory preservation. The Emergency Kinetis Device recovery help fix the issue. 

pastedImage_2.png

Jiri

Hi,

I have stuck with FlexCAN Communication with non-SDK.

I have tested sample example from Document Number: AN5413.

but I can't see any Data frame signal mentioned in the Document, please can you help me what is problems with Example code or any setup issue.

Details are,

I used S32K144 EVB

I tapped MCU CAN_TX (PTE5)

In Scope can't see any Data Signal.

Please help me on this problems,

Thanks,

Sakthivel k

jiri.kral@nxp.com

Hi Jiri,

please help me solve the question for me, thanks.

https://community.nxp.com/thread/537890 

Dear NXP,

Can we direct use FlexNVM as EERPOM to store data? i.e. without using the method that: using FlexRAM to simulate EEPROM and FlexROM as backup (ratio 1:16)? If it can, what could be the side effect compared to using the FlexRAM to simulate EEPROM?

Thanks and best regards

He Wei

Hi, 

there is an example related to your question - https://community.nxp.com/docs/DOC-335619  

Jiri

Dear Jiri,

So we can direct to use the FlexNVM as EEPROM. Then what is the advantage to configure FlexRAM as EERPOM then FlexNVM as backup (1:16)? This can achieve better w/e cycle endurance? performance is more faster? (Because in term of memory usage efficiency,  direct using FlexNVM without FlexRAM for EEPROM implementation is better?)

Thanks and best regards

He Wei

Hi, 

you have three options. Use FlexNVM (which is technically Flash ROM) as an Emuletad EEPROM. This requires FlexRAM configured as EEEPROM. In this case, you have 4kB of EEEPROM and FlexNVM (64kB) is used as a backup for EEEPROM. In this case you don't need care about flash algorithm - you can simply write your data into FlexRAM (EEEPROM) and all data are automatically stored into FlexNVM. 

Second option is using FlexNVM as a regular Program/Data Flash. In this case - you need some flashing algorithm if you like store data in runtime. In this case - you can use full 64kB of FlexNVM. 

Third option is mix of both - part of FlexNVM for EEEPROM backup, part as Program/Data flash. 

Hope it helps. 


Jiri 

Thanks Jiri for explanation. 

評価なし
バージョン履歴
最終更新日:
‎01-23-2018 01:51 AM
更新者: