Cannot generate Cpu_SetFlexNVMPartition() for K20 in PE

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

Cannot generate Cpu_SetFlexNVMPartition() for K20 in PE

Jump to solution
1,798 Views
seanbolton
Contributor III

Hi NXP

 

I want to configure the FlexNVM for use as EEPROM data.  However when I generate the PE code it doesn't generate the methods  CPU_GetFlexNVMPartitionCode()  or CPU_SetFlexNVMPartition().

 

So I cannot configure the FlexNVM on startup.

 

I am using KDS 3.0.0, KSDK 1.3.0  on Windows 10 generating code for MK20DX256VLK10

 

I am now stuck and not sure if it is a problem with my PE settings or a bug within the PE itself.

 

I have looked up similar examples in the NXP site such as 607244  In this example the Methods list for the cpu component includes the option to generate the above methods.  On my KDS/PE I don't get this option.  See screenshots below.

 

Below is my EEPROM configuration.

 

143581_143581.pngpastedImage_0.png

 

 

Below when hovering over the FlexNVM option it indicates to call SetFlexNVMPartition() to configure the EEPROM but this function is not generated for my build.

 

143596_143596.pngpastedImage_3.png

 

 

And I don't get a SetFlexNVMPartition() method in the CPU list of methods.

 

143594_143594.pngpastedImage_1.png

 

Below, just to confirm CPU type.

 

143595_143595.pngpastedImage_2.png

 

Also attached is a demo K20 project where I try to configure the EEPROM in the CPU component settings.

 

Any help on this would be much appreciated.

 

Thank you

 

Sean

Original Attachment has been moved to: USB_K20TEST.zip

Labels (1)
1 Solution
1,574 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Sean,

Does this function can meet your requirement ?

pastedImage_0.png

I yes , please add the component of "fsl_flash" on your project , it include most of the operate of flash.

pastedImage_1.png

Hope it helps


Have a great day,
Alice Yang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

7 Replies
1,574 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello ,

The SetFlexNVMPartition() method is when we create one Processor Expert project (without KSDK) on

kds,  your project is KSDK+PE, pay attention that the two are different。

About create the PE project , when you create project , please select the None in the kinetis SDK:

pastedImage_1.png

pastedImage_0.png

Hope it helps

.


Have a great day,
Alice Yang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
1,574 Views
seanbolton
Contributor III

Hi Alice

Thank you for the quick response.

Our existing project already uses KDSK code (e.g. for USB) so I don't think we can regenerate the project without KSDK.

Is there a mechanism to configure the FlexNVM  when developing with KSDK and PE together.

Ideally I would like to add some code that on startup checks to see if the FlexNVM is configured, and if it isn't then to configure it.

Can you suggest the best way to achieve this in our current project setup.

Thanks again

regards

Sean

0 Kudos
Reply
1,575 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Sean,

Does this function can meet your requirement ?

pastedImage_0.png

I yes , please add the component of "fsl_flash" on your project , it include most of the operate of flash.

pastedImage_1.png

Hope it helps


Have a great day,
Alice Yang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,574 Views
seanbolton
Contributor III

Hi Alice

That looks ideal.  I will try this function in my project.

Is it safe to call this function on every bootup, or should I add code to detect if the FlexNVM is already configured?

Thank you for the quick reply.

regards


Sean

0 Kudos
Reply
1,574 Views
seanbolton
Contributor III

Hi Alice

One additional question I have ;

The fsl_flash component generates the structure for the FLASH_SSD_CONFIG  when I 'Generate Code' in PE.

But the DFLashSize and EEESize fields are shown as zero.  From my FlexNVM configuration in the cpu component I would expect my DFlashSize to be 224Kbyte and 32Kbyte respectively.

Are the values in flash1_InitConfig0 correct for my configuration or do I have to overwrite them before calling the DEFlashPartition() function?  Or does it not matter?

pastedImage_0.png

My FlexNVM settings are ;

pastedImage_1.png

regards

Sean

0 Kudos
Reply
1,574 Views
seanbolton
Contributor III

Hi Alice

I have tried the DEFlashPartition() method but I still have problems trying to write to EEPROM.

The DEFlashPartition()  now returns the code 0x20 and the flashConfig structure looks like the FlexNVM has been configured as I expect with 128 bytes EEPROM space in 32 Kbytes of FlexNVM.

When I read the EEPROM space directly at 0x14000000 I read FFs,  which seems OK as it is blank.

I then try to write to the EEPROM via the EEEWrite() method.

This returns a code of zero (OK?) but the EEPROM data at 0x14000000 remains at FF  (I try to write 0x1234abcd)

Can you advise me if I am doing anything incorrectly here, or maybe missing a step.

Below is my code, the bootloader_InitFlash()  puts the Flash function into ram and I then try to read/write to EEPROM.  Read is OK, reads 0xFFFFFFFF, but also reads 0xFFFFFFFF after the EEWrite()

pastedImage_0.png

And below is the contents of the FlashConfig structure, which looks OK, 128 bytes of EEPROM and 0x38000 bytes of DFlash.

pastedImage_1.png

Thank you

regards


Sean

0 Kudos
Reply
1,574 Views
seanbolton
Contributor III

I think I have resolved this problem.  I should only call DEFlashPartition()  once when not configured.  If I do this then I can write to the EEPROM area OK.

I check if the FlexNVM is already partitioned by looking at the EESize in the flashpartition structure.

if ( flash1_InitConfig0.EEESize != 0x80 )

{

    // DEFlashPartition should only be called once when FlexNVM is not setup.

    // So after first factory boot up this function should never be called again.

    result = DEFlashPartition (  &flash1_InitConfig0, 0x37, 0x03, g_FlashLaunchCommand ) ;

}

// Test write and read to EEPROM

eepromData = 0x12345678 ;

result = EEEWrite ( &flash1_InitConfig0, 0x14000000, 4, (uint8_t*) &eepromData ) ;

eepromData = * ((unsigned int*) 0x14000000) ;

So I think my FlexNVM is working OK.  I can also write to the DFlash Space which is not allocated to EEPROM emulation.

Thanks Alice for helping me with this.

regards


Sean

0 Kudos
Reply