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.

[参考译文] TMS320F28027:闪存

Guru**** 2513185 points
Other Parts Discussed in Thread: UNIFLASH

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1348459/tms320f28027-flash

器件型号:TMS320F28027
主题中讨论的其他器件:UNIFLASH

您好、我用过它
Proj_lab10a / 2802 x0_flashapi_bootromsymbols_v2。 01.库
这个闪存库、发现第一次通电时遇到普通存储故障、也可以存储几次、但是一旦发生存储故障、又发现回电的芯片好像死了、这就是为什么
初始如下所示:用于更改正式代码的配置/。

void InitFlash(void)
{
    EALLOW;
    
    //
    // Enable Flash Pipeline mode to improve performance of code executed from
    // Flash.
    //
    FlashRegs.FOPT.bit.ENPIPE = 1;

    //
    //                CAUTION
    // Minimum waitstates required for the flash operating
    // at a given CPU rate must be characterized by TI.
    // Refer to the datasheet for the latest information.
    //
    #if (CPU_FRQ_60MHZ)
    //
    // Set the Paged Waitstate for the Flash
    //
    FlashRegs.FBANKWAIT.bit.PAGEWAIT = 2;

    //
    // Set the Random Waitstate for the Flash
    //
    FlashRegs.FBANKWAIT.bit.RANDWAIT = 2;

    //
    // Set the Waitstate for the OTP
    //
    FlashRegs.FOTPWAIT.bit.OTPWAIT = 2;

    #elif (CPU_FRQ_40MHZ)
    //
    // Set the Paged Waitstate for the Flash
    //
    FlashRegs.FBANKWAIT.bit.PAGEWAIT = 1;

    //
    // Set the Random Waitstate for the Flash
    //
    FlashRegs.FBANKWAIT.bit.RANDWAIT = 1;

    //
    // Set the Waitstate for the OTP
    //
    FlashRegs.FOTPWAIT.bit.OTPWAIT = 1;
    #endif
    
    //
    // CAUTION: ONLY THE DEFAULT VALUE FOR THESE 2 REGISTERS SHOULD BE USED
    //
    FlashRegs.FSTDBYWAIT.bit.STDBYWAIT = 0x01FF;
    FlashRegs.FACTIVEWAIT.bit.ACTIVEWAIT = 0x01FF;
    EDIS;

    //
    // Force a pipeline flush to ensure that the write to the last register 
    // configured occurs before returning.
    //
    asm(" RPT #7 || NOP");
}




void  usermain_flash( void )
{   


/*------------------------------------------------------------------
 To use the Flash API, the following steps
 must be followed:

      1. Modify Flash2802x_API_Config.h for your targets operating
         conditions.
      2. Include Flash2802x_API_Library.h in the application.
      3. Add the approparite Flash API library to the project.

  The user's code is responsible for the following:

      4. Initalize the PLL to the proper CPU operating frequency.
      5. If required, copy the flash API functions into on-chip zero waitstate
         RAM.
      6. Initalize the Flash_CPUScaleFactor variable to SCALE_FACTOR
      7. Initalize the callback function pointer or set it to NULL
      8. Optional: Run the Toggle test to confirm proper frequency configuration
         of the API.
      9. Optional: Unlock the CSM.
     10. Make sure the PLL is not running in limp mode
     11. Call the API functions: Flash_Erase(), Flash_Program(), Flash_Verify()

  The API functions will:

       Disable the watchdog
       Check the device PARTID.
       Disable interrupts during time critical code.
       Perform the desired operation and return status
------------------------------------------------------------------*/

   Uint16 Status;
/*------------------------------------------------------------------
 Initalize the PLLCR value before calling any of the F2802x Flash API
 functions.

     Check to see if the PLL needs to changed
     PLLCR_VALUE is defined in Example_Flash2802x_API.h
     1) Make sure PLL is not in limp mode
     2) Disable missing clock detect logic
     3) Make the change
     4) Wait for the DSP to switch to the PLL clock
        This wait is performed to ensure that the flash API functions
        will be executed at the correct frequency.
     5) While waiting, feed the watchdog so it will not reset.
     6) Re-enable the missing clock detect logic
------------------------------------------------------------------*/

// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP2802x_SysCtrl.c file.
   //InitSysCtrl();

/*------------------------------------------------------------------
 Unlock the CSM.
    If the API functions are going to run in unsecured RAM
    then the CSM must be unlocked in order for the flash
    API functions to access the flash.

    If the flash API functions are executed from secure memory
    (L0-L3) then this step is not required.
------------------------------------------------------------------*/

   Status = Example_CsmUnlock();
   if(Status != STATUS_SUCCESS)
   {
       Example_Error(Status);
   }


/*------------------------------------------------------------------
    Copy API Functions into SARAM

    The flash API functions MUST be run out of internal
    zero-waitstate SARAM memory.  This is required for
    the algos to execute at the proper CPU frequency.
    If the algos are already in SARAM then this step
    can be skipped.
    DO NOT run the algos from Flash
    DO NOT run the algos from external memory
------------------------------------------------------------------*/

// If the build links in the 2802x_FlashAPI_BootROMSymbols.lib, then
// The API is in boot ROM and we do not need to copy it from flash.
//
// If the build links in the software API library:
// i.e. Flash2802x_API_<version>.lib
// then we need to copy the flash API from the flash memory to RAM.

#if (BOOT_ROM_API == 0)
  // Example_MemCopy(&Flash28_API_LoadStart, &Flash28_API_LoadEnd, &Flash28_API_RunStart);
#endif

    // We must also copy required user interface functions to RAM.
   //  Example_MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);


/*------------------------------------------------------------------
  Initalize Flash_CPUScaleFactor.

   Flash_CPUScaleFactor is a 32-bit global variable that the flash
   API functions use to scale software delays. This scale factor
   must be initalized to SCALE_FACTOR by the user's code prior
   to calling any of the Flash API functions. This initalization
   is VITAL to the proper operation of the flash API functions.

   SCALE_FACTOR is defined in Example_Flash2802x_API.h as
     #define SCALE_FACTOR  1048576.0L*( (200L/CPU_RATE) )

   This value is calculated during the compile based on the CPU
   rate, in nanoseconds, at which the algorithums will be run.
------------------------------------------------------------------*/

   EALLOW;
   Flash_CPUScaleFactor = SCALE_FACTOR;
   EDIS;


/*------------------------------------------------------------------
  Initalize Flash_CallbackPtr.

   Flash_CallbackPtr is a pointer to a function.  The API uses
   this pointer to invoke a callback function during the API operations.
   If this function is not going to be used, set the pointer to NULL
   NULL is defined in <stdio.h>.
------------------------------------------------------------------*/

   EALLOW;
   Flash_CallbackPtr = &MyCallbackFunction;
   EDIS;

   MyCallbackCounter = 0; // Increment this counter in the callback function


   // Jump to SARAM and call the Flash API functions
 //  Example_CallFlashAPI();

}


  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    周先生、您好!

    您的问题没有得到清楚的解释、请提供措辞更清晰的详细信息。

    Unknown 说:
    该闪存库第一次通电时发生正常存储故障,也可以存储多次,但存储故障后发现重启的芯片似乎死了,这就是为什么

    我不理解您在这里的措辞、您是说在打开器件时出现了一些错误或闪存问题吗? 您能显示收到的消息的屏幕截图吗? 您认为芯片似乎死了什么意思?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    大家好、信息存储在扇区 A 后、再加电一次、主芯片停止了正常工作。 它似乎滞留在程序的某个部分,我开始怀疑扇区 A 中的数据导致初始替换失败。 但是、我仅通过 Uniflash 擦除了扇区 A、芯片无法再次运行、
    FAH 对存储数据有何影响

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    周先生、您好!

    我尝试重新启动该程序

    我假设您是指您已关闭并重新打开器件的电源(即、关闭然后再打开)。 应用程序卡在程序的哪个部分?

    请牢记、虽然闪存是非易失性的(也就是说、它在断电后仍然存在)、但是 RAM 不是。 如果器件下电上电、应用所需的执行/存储在 RAM 上的任何内容都将被擦除。 您需要确保在闪存中的程序所依赖的 RAM 中未存储任何关键内容。

    FAH 对存储数据有何影响

    除了能够在下电上电后保持不变、闪存的读取/写入访问 还需要等待状态。