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.

TMS320F28374S: usage of read functions from C2000 F021 Flash API Version 1.53

Part Number: TMS320F28374S
Other Parts Discussed in Thread: CONTROLSUITE,

Hi,

Question1:

I want to read raw data which is not corrected by ECC module from all type memory including Flash,Flash ECC,OTP,OTP ECC.

Can "Fapi_doMarginRead" read raw data?

 Question2:

Flash API provides three read modes:normal read, read margin 0 and read margin 1.

What is meaning for each mode?

Question3:

Flash API provides Fapi_doPsaVerify function to speed up Verify.

But it need a PSA value to compare.Would you give me the C source code to calcute the PSA  which will be implemented by Master(Burner)? 

  • Xin,

    Note that Flash API version 1.55 is used for TMS320F2837xS.  F2837xS Flash API documentation link: http://www.ti.com/lit/pdf/spnu630.

    Flash API version 1.53 is used for TMS320F28M35x and TMS320F28M36x devices (http://www.ti.com/lit/pdf/spnu595).

    Coming to your questions:

    Question 1). If you want to read raw data without ECC correction, you need to disable SECDED logic in Flash wrapper by writing a value of 0 to ECC_ENABLE register (please refer to TRM for details of this register) before reading the Flash/OTP.

    Flash API does not provide a function to read the raw data from Flash/OTP/ECC since users can write a simple function to accomplish it.

    Please note that the read margin modes are not supported in F2837xS device and hence Fapi_doMarginRead() function is not supported. Hence, you don't find related information in the TRM. We are about to release an updated Flash API reference guide to remove the references of read margin modes. Sorry for the confusion.

    Question 2). Now, you know that read margin modes are not supported for this device.

    Question 3). You can use Fapi_calculatePsa() function from API library to calculate the PSA. Note that this function does not support ECC memory space. You can use it for Flash main array or OTP but not for ECC space.

    Flash API (F021_API_F2837xS_FPU32.lib) for F2837xS device can be found at:
    \controlSUITE\device_support\F2837xS\v210\F2837xS_common\lib.

    Flash API usage example for F2837xS device can be found at:
    controlSUITE\device_support\F2837xS\v210\F2837xS_examples_Cpu1\flash_programming

    Let me know if you have any questions.

    Thanks and regards,
    Vamsi

  • Hi,Vamsi,
    Thanks for your answer.
    Would you give me the C source code of Fapi_calculateEcc() from Flash API?
    I want to implement it in master(Burner).
    Thanks~
    Best regards~
    XIn
  • Xin,

    Fapi_calculateEcc() function in the API library uses the Flash wrapper SECDED logic to generate the ECC. Hence it has to be executed on the target.

    Why can't you use the AutoEccGeneration mode when you use Fapi_issueProgrammingCommand() function? This mode will calculate the ECC for the address and the 64-bit data that you provide and program ECC along with the Flash main array.

    Thanks and regards,
    Vamsi
  • Hi Vamsi,

    I will use AutoEccGeneration mode to program main memory and associated ECC memory.

    But I want to verify the raw data in main memory and ECC memory.

    So I should calcute the ECC.

    Thanks~ 

    Best regards~

    XIn

  • Xin,

    I understand.  Since the Fapi_calculateEcc() function in the API library uses the SECDED logic to generate the ECC, it's source code does not help you.  Instead, you can use attached function to calculate the ECC for a given address and 64-bit data.

    Let me know if you have any questions.

    I will add this to a FAQ wiki page for the sake of others.

    Thanks and regards,

    Vamsi

    ECC_calculationCode.docx

  • Hi,Vamsi,

    Thanks for your help.

    I find another issues.

    Q1:Use Fapi_issueProgrammingCommand() to program flash and flash ECC by Fapi_AutoGeneration mode

    for parameter u16DataBufferSizeinBytes[in]:One byte equal to 16 bits.

    for parameter u16EccBufferSizeinBytes[in]:How many bits euqal to one byte?

    Q2:Use Fapi_issueProgrammingCommand() to program flash and flash ECC by Fapi_AutoGeneration mode

    Sector A and SectorA associated ECC can not be programmed.

    Would you give some advise?

    Q3:Use Fapi_issueProgrammingCommandForEccAddress() to program ECC 

    for parameter u8EccBufferSizeInBytes[in]: Is one byte euqals to 8bits?

    Q4:Use Fapi_issueProgrammingCommandForEccAddress() to program ECC

    SectorA associated ECC can not be programmed.

    Would you give some advise?

    Thanks~

    Best regards~

    Xin

  • Xin,

    1) 

    u16DataBufferSizeInBytes -> number of 16-bit words in the Data buffer

    u16EccBufferSizeInBytes  -> number of 8-bit bytes in the ECC buffer

    2) What error did you get when you program Sector A and its ECC?  Did you check whether it is erased or not before you program?

    3) Fapi_issueProgrammingCommandForEccAddress() is not supported for F2837x devices.  Since you program using AutoEccGeneration mode, you don't need Fapi_issueProgrammingCommandForEccAddress() function.  Please refer to Flash API reference guide for this device at http://www.ti.com/lit/pdf/spnu630
     

    Thanks and regards,

    Vamsi   

  • Hi,Vamsi,

    For Item 2)

    I program the sectorA with non-blank value.But the read back value are all blank vlaue(all ones).I am sure that I have done sector-erase&blank before program.

    It is a strange thing that other sectors except SectorA&SectorA-ECC can be programmed successfully .To verify it,I have read all the raw data including main flash and associated-ECC.The result is that only Sector A and associated ECC can not go through the verify issue. 

    I do not know why?

    I have attached more information about how I operate  TMS320F28374s below:

    Thanks~

    Best regards~

    XIn

    Flash API:

    controlSUITE\device_support\F2837xS\v210\F2837xS_common\lib\F021_API_F2837xS_FPU32.lib

  • Xin,

    You don't have EALLOW before program function in the snapshot that you sent.  Can you try with EALLOW?

    Thanks and regards,
    Vamsi

  • Hi,Vamsi,

    Every thing is ok.

    Thank you very much.

    Best regards~

    Xin

  • Xin,

    1) Are you switching the PUMP SEMAPHORE between Bank0 and Bank1 for Bank0 and Bank1 Flash program/erase operations respectively?

    2) Can you confirm that you call Fapi_initializeAPI(F021_CPU0_W0_BASE_ADDRESS,UserConfigured_frequency) and Fapi_setActiveFlashBank(Fapi_FlashBank0) functions before doing Flash operations on Bank0 sectors?

    3) Can you confirm that you call Fapi_initializeAPI(F021_CPU0_W1_BASE_ADDRESS,UserConfiguredFrequency) and Fapi_setActiveFlashBank(Fapi_FlashBank1) functions before doing Flash operations on Bank1 sectors?

    Note that you have to call the above functions with respective wrapper/bank numbers as shown above whenever you switch between the banks for erase/program operations.

    Thanks and regards,

    Vamsi

  • Hi,Vamsi,
    I find the issue.
    Hecnce I forget to remove the erase debug code in main frame of loader.Sertor A was erase every time.
    I am sorry for it.
    Thank you very much!
    Best regards~
    Jack
  • Xin,

    Glad that the application is working now after removing the erase debug code.

    I am closing this thread now.

    Thanks and regards,

    Vamsi

  • Hi,Vamsi,

        I found another problem.

        Please help check it.

       When I program 0x78018-0x7801F(Bootctrl area),I got the error code:Fapi_Error_InvalidAddress(507).But I do not think there is any error about the program address.

       Woud you have any idea?

      Thanks~

      Best regards~

    Xin

  • Xin,

    You need to use 0x7801C address to program BootCtrl fields.

    Please check the blinky_with_DCSM project and it's linker command file in controlSuite.(controlSUITE\device_support\F2837xS\v2x\F2837xS_examples_Cpu1\blinky_with_DCSM)

    Thanks and regards,
    Vamsi
  • Hi,Vamsi,

       Do you recommand this way "Fapi_issueProgrammingCommand((INT32U*)devaddr,(uint8 *)p16data,4,0,0,Fapi_AutoEccGeneration)" or this way "Fapi_issueProgrammingCommand((INT32U*)devaddr,(uint8 *)p16data,8,0,0,Fapi_AutoEccGeneration)" to program flash?

       The first way can bypass program when 64bits data are all ones.

       The second way can bypass program when 128bits data are all ones.

        Thanks~

    Best regards~

    Xin

  • Xin,

    If all the 8 words are available, then 8 is preferable since that will cut down the programming time.

    If only 4 words are available, then 4 is preferable; this way you can save the space of the other 4-words to use later.

    Thanks and regards,
    Vamsi
  • Hi,Vamsi,
    Thanks~
    Best regards~
    Xin
  • Hello Vamsi,

    I would like to know how to implement Flash read. Is it similar to RAM read ? Just by dereferencing a pointer flash read works ?
    Your immediate response would be helpful.

    Best Regards,
    Ajit B
  • Ajit,

    Yes, it should work. Let me know if you see any issues.

    Thanks and regards,
    Vamsi

  • Vamsi,

    Thanks. I will open a new thread in case if it does not work.

    Best Regards,
    Ajit B
  • Dear Vamsi,

    maybe it's trivial but I spent a lot of time trying to figure out how to read from flash memory.

    Can you place here an example on how access to the memory to read a given written on flash? That would be great. 

    Thank you very much.

    Andrea

  • Andrea,

    This thread went through several phases and hence it would be tough for others to learn from it if we add further. 

    Please open a new thread as I suggested to Ajit earlier in this thread. 

    Thanks and regards,
    Vamsi