This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F28M35H52C F021 Flash API "Fapi_issueProgrammingCommand()" Issue.

Other Parts Discussed in Thread: F28M35H52C

Dear Supporter.

Dear Supporter,

 

I’m using the F28M35H52C with F021 Flash API(C2000).

 

 

First, Flash Program: Flash Start Address: 0x108002, u16DataBufferSizeInWords: 6, with Fapi_AutoEccGeneration using Fapi_issueProgrammingCommand()

  

Second, Flash Program: Flash Start Address: 0x108000, u16DataBufferSizeInWords: 2, with Fapi_AutoEccGeneration using Fapi_issueProgrammingCommand()

 

Second case FLASH API(oFlashStatus = Fapi_getFsmStatus() ) return  value is 0x30.

 

Question)

  1. What is mean return value 0x30? (Not define “types.h”)

  2. How can flash program to separate last 2word(32Bit) with Fapi_AutoEccGeneration?

 

Please advice on this issue…

  • Hi Hwang,

    1.  As mentioned in the API reference guide, Fapi_getFsmStatus() returns the value in the FMSTAT register (register is described in the reference guide).  Value of 0x30 means that you are trying to program a "1" where a "0" is already programmed.  

    2.  ECC is calculated for every 64-bits aligned on a 64-bit Flash memory boundary as explained in the TRM.  For a given 64-bit data (aligned on 64-bit boundary), you can program ECC only once.  (Of course, you can erase and program the ECC again for the 64-bits but erase is per sector as you know.)  You cannot program less than 64-bits when you program ECC for the data.  

    Based on the code sequence that you gave, you programmed six 16-bit words starting at 0x108002 along with ECC.  When you did this, ECC for the 64-bit slice ranging from 0x108000 to 0x108003 got programmed. (ECC for the 64-bit slice ranging from 0x108004 to 0x108007 is also programmed but this is not the one that is giving you the program failure).  AutoEccGeneration logic in the device assumed the data for 0x108000 and 0x108001 as all 1s when calculating the ECC for the 64-bit slice ranging from 0x108000 to 0x108003 since the data is not provided by you.

    If you cannot program all the 64-bits at a time, you can consider programming the data only at first and then program ECC using AutoEccGeneration when all the 64-bits of data is available.  To avoid ECC errors, please note that you have to disable ECC logic when you read the Flash when ECC is not programmed.     

    If you are developing a custom programming utility that streams in the output file of a code project and programs the individual sections one at a time into flash, then you can align all sections linked to flash to be on a 64-bit boundary in the linker command file for your code project as shown below.  This way you can avoid a 64-bit word to span more than one section (i.e., contains the end of one section, and the start of another) and hence you can program all the 64-bits at a time along with ECC.   

    SECTIONS

    {

      .text    : > FLASH, PAGE = 0, ALIGN(4)

      .cinit   : > FLASH, PAGE = 0, ALIGN(4)

      .const   : > FLASH, PAGE = 0, ALIGN(4)

      .econst  : > FLASH, PAGE = 0, ALIGN(4)

      .pinit   : > FLASH, PAGE = 0, ALIGN(4)

      .switch  : > FLASH, PAGE = 0, ALIGN(4)

    }

    Thanks and regards,

    Vamsi

     

  • Dear Vamsi,

    Thanks for your help.