Bug in Flash Memory Module "program sector command"?

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

Bug in Flash Memory Module "program sector command"?

Jump to solution
907 Views
lothar
Contributor II

Hi

I wrote a little test program to test the Flash Memory Module "program sector command".

To test it, I use a K20 tower board. The K20 tower board has got 256kByte of P-Flash, 32kByte FlexNVM (D-Flash) and 2kByte FlexRam.

The sector size is:

2kByte for P-Flash

1kByte for D-Flash

The program sector command allows to use half the FlexRam to program Flash memory. One just fills the under half of the flexRam and launches the progam sector command.

Thats what I'm doing in the following code. I fill the under half of the FlexRam (1kByte) with a test pattern and launch the command. The strange thing is, that the last byte keeps unprogrammed. Only 1023 byte are programmed and the last one keeps erased (0xFF).

This is not a real problem but i'm interessted if i'm doing a misstake or if it is a bug. Maybe someone can help me :smileyhappy:

uint8* pFlexNVM = (uint8*) 0x10000000;// Pointer to the start address of the D-Flash
uint32* pFlexRam =(uint32*) 0x14000000;// Pointer to the start address of the FlexRam

/* Fill the under half (2kByte/2 = 1kByte) of the FlexRam with a test pattern */

for(i=0;i<256;i++){

   pFlexRam[i] = 0x01020304;

}

/* Erase Flash Sector Command */

FTFL->FCCOB0 = 0x09;// Erase sector command
FTFL->FCCOB1 = 0x80;// Address to erase (0x1000 0000)

FTFL->FCCOB2 = 0x00;

FTFL->FCCOB3 = 0x00;

while((FTFL->FSTAT & FTFL_FSTAT_CCIF_MASK)==0){}

FTFL->FSTAT &= 0xFF;// Start erasing

while((FTFL->FSTAT & FTFL_FSTAT_CCIF_MASK)==0){}

ftfl_check();// Prints information if an error occured

/* Program Section Command */

FTFL->FCCOB0 = 0x0B;// Program section command
FTFL->FCCOB1 = 0x80;// Address to program (0x1000 0000)

FTFL->FCCOB2 = 0x00;

FTFL->FCCOB3 = 0x00;
FTFL->FCCOB4 = 0x00;// Nummber of longwords to program (0x00FF)

FTFL->FCCOB5 = 0xff;

while((FTFL->FSTAT & FTFL_FSTAT_CCIF_MASK)==0){}

FTFL->FSTAT &= 0xFF;

while((FTFL->FSTAT & FTFL_FSTAT_CCIF_MASK)==0){}

ftfl_check();// Prints information if an error occured

printl("Vaulue at 0x1000 0000: % \r\n",*pFlexNVM);// Result = 1
printl("Vaulue at 0x1000 0001: % \r\n",pFlexNVM[1]);// Result = 2
printl("Vaulue at 0x1000 03FC: % \r\n",pFlexNVM[1020]);// Result = 255
printl("Vaulue at 0x1000 03FD: % \r\n",pFlexNVM[1021]);// Result = 255

Labels (1)
0 Kudos
Reply
1 Solution
493 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Since you want to progam 1024 bytes, which is 256 longwords, so you have to set

FTFL->FCCOB4 = 0x01;// Nummber of longwords to program (0x0100)

FTFL->FCCOB5 = 0x00;

I also tested it with this change based on TWR-K20D50M, the result is as below.

a1.JPG

Please kindly refer to the attached project for more details.


Hope that helps,

View solution in original post

0 Kudos
Reply
1 Reply
494 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Since you want to progam 1024 bytes, which is 256 longwords, so you have to set

FTFL->FCCOB4 = 0x01;// Nummber of longwords to program (0x0100)

FTFL->FCCOB5 = 0x00;

I also tested it with this change based on TWR-K20D50M, the result is as below.

a1.JPG

Please kindly refer to the attached project for more details.


Hope that helps,

0 Kudos
Reply