S32Kxxx

From SEGGER Wiki
Revision as of 10:15, 12 March 2019 by Fabian (talk | contribs) (Created page with "__TOC__ == FlexNVM block partitioning == The S32Kxx series devices comes with a FlexNVM block partitioning for FlexRam. FlexNVM is an additional separate block of flash memory...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

FlexNVM block partitioning

The S32Kxx series devices comes with a FlexNVM block partitioning for FlexRam. FlexNVM is an additional separate block of flash memory. The user can configure the FlexNVM block as: Basic data flash, non volatile storage for emulated EEPROM or a combination of both. For programming via J-Link to be successful, the FlexNVM sector must be configured correctly. For this, the "Program Partition command" must be used.

Program Partition command

The Program Partition command prepares the FlexNVM block for use as data flash, emulated EEPROM backup or a combination of both and initializes the FlexRAM. The Changes related to execution of the Program Partition command take effect after the next reset.

Problem description

For FlexNVM to be used as a flash it has to be partitioned accordingly. Otherwise it is not accessible. Further the Flash needs to be in the "erased" state before it can be partitioned.

Solution example

In the following JLink Commander example, FlexRAM is first erased with the "Erase All Blocks command" and then initialized as flash memory only (No EEPROM) using the "Program Partition command":

speed 4000
r // Reset target
w1 0x40020007, 0x44     // FCOOB0 Erase All Blocks command
w1 0x40020000, 0x80     // FSTAT Start operation
sleep 1000              // Wait 1 sec.
w1 0x40020007, 0x80     // FCOOB0 Program Partition command
w1 0x40020006, 0x00     // FCOOB1 Set CSEc Key Size to 0
w1 0x40020005, 0x00     // FCOOB2 SFE disabled
w1 0x40020004, 0x01     // FCOOB3 0 --> FlexRAM loaded with valid EEPROM data during reset; 1 --> FlexRAM not loaded during reset
w1 0x4002000B, 0x0F     // FCOOB4 Data size for EEPROM Set to 0
w1 0x4002000A, 0x0B     // FCOOB5 Partition Code set to not EEPROM (DEPART)
w1 0x40020000, 0x80     // FSTAT Start operation
sleep 100               // Wait 0,1 sec.
q

Check partitioning

By reading the 32-bit FCFG1 register (4004804C) the DEPART bits ([15:12]), show the FlexNVM partition code. Note, that the Device needs to be power cycled after setting a new partition, since the new DEPART value is refreshed only after power off. JLink Commander example:

mem32 4004804C, 1