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.

[参考译文] TMS320F28P550SJ:对 OTP 密码进行编程的代码示例

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1503499/tms320f28p550sj-code-example-for-programming-otp-passwords

器件型号:TMS320F28P550SJ
主题:C2000WARE 中讨论的其他器件

工具/软件:

我找不到一个直接对 OTP 密码进行编程的示例。 您能否查看下面的代码并了解这是否是推荐的方法?

链接器命令文件:

移动数据

  otp_memory:origin = 0x78000、length = 0x00020

}

 

很重要

  .otpData:> otp_memory、page = 0

}

注意:将0x78000和0x00020替换为 TMS320F28P55数据表中定义的特定 OTP 区域的适当起始地址和长度。

 

main.c  

pragma DATA_SECTION (otpData、".otpData");

const uint32_t otpData[4]={0x12345678、0x9ABCDEF0、0x0FEDCBA9、0x87654321};

 

#include "DefinedFunctions.h" Fapi_User

包含"F021_F28004x_C28x.h"

 

void programOTP (void)

  Fapi_Status 类型状态;

  uint32_t otpAddress = 0x78000;// OTP 的起始地址

  uint32_t dataBuffer[4]={0x12345678、0x9ABCDEF0、0x0FADCBA9、0x87654321};//输入您自己的密码

 

  //初始化闪存 API

  STATUS = Fapi_initializeAPI (F021_CPU0_BASE_ADDRESS、200);// 200 MHz 系统时钟

  if (status != Fapi_Status_Success)

  {

    //处理错误

  }

 

  //设置活动闪存组

  状态= Fapi_setActiveFlashBank (Fapi_Flash 组0);

  if (status != Fapi_Status_Success)

  {

    //处理错误

  }

 

  //对 OTP 进行编程

  状态= Fapi_issueProgrammingCommand ((uint32_t *) otpAddress、dataBuffer、4、0、0 Fapi_Auto EccGeneration);

  if (status != Fapi_Status_Success)

  {

    //处理错误

  }

 

  //等待编程操作完成

  while (Fapi_checkFsmForReady ()!= Fapi_Status_Fsm);

 

  //验证编程数据

  对于(uint16_t i = 0;i < 4;i++)

  {

    if (*(volatile uint32_t *)(otpAddress +(i * 4))!= dataBuffer[i])

    {

      //处理验证错误

    }

  }

}

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

    您好、

    是代码正确、但在 发出编程命令之前、您必须调用  

    ClearFsmStatus();


    Fapi_setupBankSectorEnable (FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROT_UO、0x00);

    请参阅 C2000ware 中的闪存 API 示例和闪存 API 用户指南(http://www.ti.com/lit/pdf/sprujc5)for、了解更多详细信息)。

    此致、

    Rajeshwary