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.

Compiler/TMS320F28377D: Fapi_doMarginRead()

Part Number: TMS320F28377D
Other Parts Discussed in Thread: C2000WARE

Tool/software: TI C/C++ Compiler

Hello Vamsi,

Customer is using Fapi_doMarginRead() on F28377D, but found that it will cause errors and they cannot read flash successfully.

Would you please kindly help confirm whether Fapi_doMarginRead() can be used or not on F28377D?

If not, are there any examples codes to read flash on F28377D for reference?

Thanks!

Best Regards,

Linda

  • Linda,

    Fapi_doMarginRead() can be used on this device by passing Fapi_NormalRead for the oReadMode (4th parameter).

    What error did the user get?  Hope the wait-states are configured correctly as per the operating frequency.

    Thanks and regards,
    Vamsi

  • Hi, Vamsi:

        I found a strange phenomenon during my test. When the only  Fapi_NormalRead() function is executed, the code runs incorrectly. But Fapi_issueAsyncCommandWithAddress () erase function runs before  Fapi_NormalRead() function, the code can work properly. I am very confused about this.

       You mentioned wait-states above. How can I configure this specifically?

       Thank you!

       BR

       xiaopeng

  • Xiaopeng,

    I think you meant to say Fapi_doMarginRead() and not Fapi_NormalRead().

    What do you mean by code running incorrectly?  Please provide details on what made you think that the code is running incorrectly.  Is code ending up in NMI ISR or ITRAP?

    Do you have any content programmed in Flash when you said the code is not running properly when Fapi_doMarginRead() is executed?  If yes, please check whether ECC is programmed correctly or not. Maybe an ECC error is happening.  Please check the ECC registers.  If ECC uncorrectable error occurs, an NMI will occur.

    Regarding wait-states: Please see Table 5-19. Flash Wait States in datasheet at http://www.ti.com/lit/ds/symlink/tms320f28377d.pdf.  Wait-states should be configured as per the system frequency.  You can use InitFlash() provided in F2837xD_SysCtrl.c (C2000Ware_x_xx_xx_xx\device_support\f2837xd\common\source) to configure the wait states. 

    Thanks and regards,

    Vamsi

  • Hi, Vamsi:

       Thanks for immediate reply.

       I didn't found the function Fapi_NormalRead() definition in the F021.h. I just want to read the data stored in the specific address

       During the test process, the program runs in the alone mode so I can't make sure where the code stops.

       when Fapi_doMarginRead() is executed, there is no other operation on flash. Before this function is executed, the below code are added:

     

        InitFlash();
       // Gain pump semaphore
        SeizeFlashPump();
        EALLOW;
        Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0x0;
       // This function is required to initialize the Flash API based on System
       // frequency before any other Flash API operation can be performed
        oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 200);
        if(oReturnCheck != Fapi_Status_Success)
        {
            //
                // Check Flash API documentation for possible errors
                //
                //Example_Error(oReturnCheck);
         }
         // Fapi_setActiveFlashBank function sets the Flash bank and FMC for further
         // Flash operations to be performed on the bank
          oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);

          if(oReturnCheck != Fapi_Status_Success)
          {

          }

          Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0xA;

         Above are the basic information. Thank you!

        BR

        XIAOPENG

      

  • Xiaopeng,

    I did not say that there is a function by name Fapi_NormalRead().  You mentioned that function name in your post earlier.  And I clarified that such a function does not exist.  What exists is Fapi_doMarginRead().

    Try removing  "Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0xA;" and see how it responds.

    Above code statement is enabling ECC.  I think your application is getting in to ECC errors.

    Let me know how it works after removing above line.

    Thanks and regards,
    Vamsi

  • Hi, Vamsi:

       I'm very sorry for responding  to you late.

       According to you advice, the code can run properly when removing the "Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0xA", namely disable ECC detection.

      Thank you for your patient guidance!

      If be available, could I know your email  for convenient contact further !

      BR

      xiaopeng

  • Xiaopeng,

    Glad that the issue is resolved.

    That tells me that ECC is not programmed correctly for the Flash content.

    Please use Fapi_AutoEccGeneration programming mode.  You need to program 64-bits at a time (on 64-bit aligned memory) to use this programming mode. 

    You can find more details about it in below resources:

    1. F2837xD and F2807x Flash API (V1.54) reference guide link: http://www.ti.com/lit/pdf/spnu629

    2. Flash API and ECC wiki:   https://processors.wiki.ti.com/index.php/C2000_Flash_FAQ#Flash_API_wiki

    3. Flash API usage example in C2000Ware:  C2000Ware_x_xx_xx_xx\device_support\f2837xd\examples\dual\flash_programming

    4. Also refer to "3.12 Flash and OTP Memory" chapter in TRM http://www.ti.com/lit/ug/spruhm8h/spruhm8h.pdf 

    Regarding my contact: Please keep talking to me on the forum.  You can open new posts if you have other questions and our experts will help you.  

    If you have any questions that you can not post on the E2E forum due to any proprietary reasons, you can send us a friendship request on the forum and discuss further.

    Thanks and regards,

    Vamsi

  • Hi, Vamsi:

         Thanks for your suggestion again. Meanwhile, I am very glad to receive your reply which includes some helpful materials

          BR

          xiaopeng

  • Hi, Vamsi:

       Recently, I found a stranger phenomenon that when the code jump from bootloader code  to application code after programming, all the system resets.

       Before programming, ECC is disabled and programming adopts the AutoEccGeneration mode.

       Can you give me some suggestion?

       Thank you !

  • Xiaopeng,

    Did you check the RESC register and NMIFLG register to find the reset cause?

    I would suggest you to open a new post for this new issue since the original issue discussed in this post is closed.

    Thanks and regards,

    Vamsi