Calls to IO_IOCTL_FREE_SPACE returns half the NAND memory size

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

Calls to IO_IOCTL_FREE_SPACE returns half the NAND memory size

Jump to solution
1,207 Views
randalljordan
Contributor III

I’m are using MQX 4.1and a K20FX512VLQ12 connected to a Spansion S34ML08G2 NAND flash memory chip.  Calls to IO_IOCTL_FREE_SPACE returns half the
memory size, 512K instead of 1MB.

I have updated the NANDFLASH_INFO_STRUCT to reflect the Spansion memory characteristics (page size, block size, etc…), updated
“wTotalInternalDice” in NFCNandMedia::initChipParam to show 2 dies on the chip.  I’m sure I’ve missed a value that needs to be updated, but I’m not sure what it is. 

Has anyone had experience setting up the BSP / FFS using a NAND memory chip that has two dies?

I’m using CodeWarrior 10.6 with MQX 4.1

Thank you.

Labels (1)
0 Kudos
1 Solution
836 Views
RadekS
NXP Employee
NXP Employee

Hi Randall,

Could you please share here your NANDFLASH_INFO_STRUCT?

According my expectation, it should be:

/* S34ML08G2 organization */

#define S34ML08G2_PHYSICAL_PAGE_SIZE      2048

#define S34ML08G2_SPARE_AREA_SIZE        128

#define S34ML08G2_BLOCK_SIZE              131072 /* 128kB */

#define S34ML08G2_NUM_BLOCKS              8192  /*4096 for each 4 Gb device*/

#define S34ML08G2_WIDTH                  8

NANDFLASH_INFO_STRUCT _ S34ML08G2_organization_8bit[] =  {

  S34ML08G2_PHYSICAL_PAGE_SIZE,

  S34ML08G2_SPARE_AREA_SIZE,

  S34ML08G2_BLOCK_SIZE,

  S34ML08G2_NUM_BLOCKS,

  S34ML08G2_WIDTH

};

Note: Unfortunately there is one additional FFS bug also in MQX 4.2.0. This could cause dead lock situation after some time.

In attachment you can find fixed media_buffer_manager.cpp file. Fix will be part of next MQX release.


I hope it helps you.

Have a great day,
RadekS

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

View solution in original post

0 Kudos
6 Replies
836 Views
DavidS
NXP Employee
NXP Employee

Hi Randall,

There was issue with FFS to NAND that had workaround of only letting you have access to 1/2 of the NAND space.

This was fixed in the MQX4.1.1 Release.

The Release Notes for it contain following:

MQX-4108 FFS NAND driver halves physical memory issue is fixed. The actual algorithm prepares enough reserved

blocks for a backup algorithm. The mfs_nandflash example is updated.

Updating should resolve the issue.

Regards,

David

0 Kudos
836 Views
randalljordan
Contributor III

David,

Thank you for your reply. I’ve updated to MQX 4.1.1 and have the same result, I even tried using MQX 4.2 but it also shows half the available memory which is what leads me to think I have missed something.

The Spansion memory is two 512 mega-byte planes per devices (in my post I mistakenly said 512K), I’m not sure where to tell MFS / FFS that there are two planes on the device.

Beside updating the NANDFLASH_INFO_STRUCT, NANDFLASH_INIT_STRUCT and wtotalInternalDice in initChipParm is there any other items you can think of I need to change?

Thank you for your time.

Randall Jordan

0 Kudos
837 Views
RadekS
NXP Employee
NXP Employee

Hi Randall,

Could you please share here your NANDFLASH_INFO_STRUCT?

According my expectation, it should be:

/* S34ML08G2 organization */

#define S34ML08G2_PHYSICAL_PAGE_SIZE      2048

#define S34ML08G2_SPARE_AREA_SIZE        128

#define S34ML08G2_BLOCK_SIZE              131072 /* 128kB */

#define S34ML08G2_NUM_BLOCKS              8192  /*4096 for each 4 Gb device*/

#define S34ML08G2_WIDTH                  8

NANDFLASH_INFO_STRUCT _ S34ML08G2_organization_8bit[] =  {

  S34ML08G2_PHYSICAL_PAGE_SIZE,

  S34ML08G2_SPARE_AREA_SIZE,

  S34ML08G2_BLOCK_SIZE,

  S34ML08G2_NUM_BLOCKS,

  S34ML08G2_WIDTH

};

Note: Unfortunately there is one additional FFS bug also in MQX 4.2.0. This could cause dead lock situation after some time.

In attachment you can find fixed media_buffer_manager.cpp file. Fix will be part of next MQX release.


I hope it helps you.

Have a great day,
RadekS

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

0 Kudos
836 Views
randalljordan
Contributor III

Radeks,

Thank you for your reply. I must have misunderstood the structure setup, I have the number of blocks set to 4096, I was thinking that setting wTotalInternalDies to 2 would take care of the total number of blocks. I’ll make the change and post the results.

I’ve attached the NANDFLASH_INFO_STRUCT (with the total blocks changed to 8192) in case there are any other mistakes I’ve made.

Again, thanks for your help.

-Randy

0 Kudos
836 Views
RadekS
NXP Employee
NXP Employee

Hi Randall,

You are welcome.

You are right,

I spend several minutes until my calculations returns 8192 blocks. I must agree that description of memory structure in MT29F2G16 datasheet is slightly better.

S34ML08G2.png


I hope it helps you.

Have a great day,
RadekS

0 Kudos
836 Views
randalljordan
Contributor III

RadekS,

Changing the block size to 8192 increases the memory size to 518MB. Is there anything else you can think of that I missed?

Thanks,

Randy

0 Kudos