以下勘误通报适用于 具有多个闪存组的 TMS320F28003x、TMS320F28004x 器件。 我们很快会将此公告添加到相应的器件勘误表文档中。 此外、我们将更新 C2000Ware_5_02_00_00 (目标发布日期为2024年4月)中的闪存编程示例、以包含以下讨论的软件权变措施。
闪存勘误咨询:在不禁用闪存预取的情况下执行 Fapi_setActiveFlashBank()可能会导致 ITRAP。
详细信息:仅当没有任何对闪存的活动提取存取时、才应通过从 RAM 执行的代码禁用闪存预取机制。 Fapi_setActiveFlashBank()禁用预取机制。 当预取-禁用进程正在进行时、任何闪存执行都会导致 ITRAP。 因此,应在执行 Fapi_setActiveFlashBank()之前禁用预取。
解决方法:在调用 Fapi_setActiveFlashBank()之前禁用预取机制。 可以在执行 Fapi_setActiveFlashBank()后启用预取。 禁用和启用预取机制的代码应从 RAM 执行。 当这个变通办法被执行时,请注意 Fapi_setActiveFlashBank()可以从闪存执行(不是从擦除/编程操作所针对的存储体执行),因为预取已经被禁用。
C2000Ware_5_02_00_00 (及更高版本)中提供的闪存 API 使用示例描述了此变通办法的用法。
TMS320F28003x 示例的路径:
C2000Ware_5_02_00_00\driverlib\f28003x\examples\flash\flashapi_ex1_programming.c
TMS320F28004x 示例路径:
C2000Ware_5_02_00_00\driverlib\f28004x\examples\flash\flashapi_ex1_program_autoecc.c
在这些示例中 ,从 RAM 执行 Flash_Disable fetch_sw_Workaround()以禁用预取,然后调用 Fapi_setActiveFlashBank()。 Flash_Enable fetch_sw_Workaround()从 RAM 执行以在调用 Fapi_setActiveFlashBank()后启用预取。
注: 由于 C2000Ware_5_02_00_00尚未发布、我在下面提供了软件权变措施实现详细信息:
/* Implementation details: */
// As shown in below code snippet:
// Call Flash_DisablePrefetch_SW_Workaround() before Fapi_setActiveFlashBank().
// Call Flash_EnablePrefetch_SW_Workaround() after Fapi_setActiveFlashBank().
//
// Disable Flash prefetch before Fapi_setActiveFlashBank()
//
Flash_DisablePrefetch_SW_Workaround(FLASH0CTRL_BASE);
//
// Initialize the Flash banks and FMC for erase and program operations.
// Fapi_setActiveFlashBank() function sets the Flash banks and FMC for
// further Flash operations to be performed on the banks.
//
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
if(oReturnCheck != Fapi_Status_Success)
{
//
// Check Flash API documentation for possible errors
//
Example_Error(oReturnCheck);
}
//
// Enable Flash prefetch after Fapi_setActiveFlashBank()
//
Flash_EnablePrefetch_SW_Workaround(FLASH0CTRL_BASE);
/* Below is the code for Flash_DisablePrefetch_SW_Workaround(). */
//*****************************************************************************
//
//! Disables flash prefetch mechanism and adds 7 cycle delay
//!
//! \param ctrlBase is the base address of the flash wrapper control registers.
//!
//! \return None.
//
//*****************************************************************************
#ifdef __cplusplus
#pragma CODE_SECTION(".TI.ramfunc");
#else
#pragma CODE_SECTION(Flash_DisablePrefetch_SW_Workaround, ".TI.ramfunc");
#endif
void Flash_DisablePrefetch_SW_Workaround(uint32_t ctrlBase)
{
//
// Check the arguments.
//
ASSERT(Flash_isCtrlBaseValid(ctrlBase));
//
// Disable flash prefetch
//
Flash_disablePrefetch(ctrlBase);
//
// Force a pipeline flush to ensure that the write to the last register
// configured occurs before returning.
//
FLASH_DELAY_CONFIG;
}
/* Below is the code for Flash_EnablePrefetch_SW_Workaround() */
//*****************************************************************************
//
//! Enables flash prefetch mechanism and adds 7 cycle delay
//!
//! \param ctrlBase is the base address of the flash wrapper control registers.
//!
//! \return None.
//
//*****************************************************************************
#ifdef __cplusplus
#pragma CODE_SECTION(".TI.ramfunc");
#else
#pragma CODE_SECTION(Flash_EnablePrefetch_SW_Workaround, ".TI.ramfunc");
#endif
void Flash_EnablePrefetch_SW_Workaround(uint32_t ctrlBase)
{
//
// Check the arguments.
//
ASSERT(Flash_isCtrlBaseValid(ctrlBase));
//
// Disable flash prefetch
//
Flash_enablePrefetch(ctrlBase);
//
// Force a pipeline flush to ensure that the write to the last register
// configured occurs before returning.
//
FLASH_DELAY_CONFIG;
}