AnsweredAssumed Answered

Bug in Flash Memory Module "program sector command"?

Question asked by Lothar Eichelberger on May 18, 2013
Latest reply on May 20, 2013 by Kan_Li

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

 

 

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

 

Outcomes