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.

TMS320F28377D: 使用XDS560V2仿真器在Debug时调用FlashAPI程序会在无规律的某一次写入中跑飞 离线运行正常

Part Number: TMS320F28377D

最近购买了xds560V2仿真器在对28377d debug程序时出现了在调用FlashAPI对N扇区进行擦除写入时经常性的出现程序跑飞的情况(在无规律的某一次写入中跑飞 在此之前的Flash写入均成功) 我再次使用了以前的xds100v3仿真器却一直没有出现该问题 使用2款仿真器下载的程序离线运行时操作Flash也没有出现跑飞的情况

Flash写入命令是由串口传输至dsp的 通过屏蔽flash写入的函数就没有出现过跑飞的情况  测试的电脑ccs版本为9.3  

有时候跑飞ccs会显示out at address 0x0 或者0x3ff16a

还有出现突然停在_Fapi_issueFsmCommand这 跑飞之后程序只能再次下载才能继续运行 不可以restart

弄了好久了也没发现问题在哪 请工程师帮帮看看。谢谢!

  • 您好,我们已收到您的问题并升级到英文论坛寻求帮助,如有答复将尽快回复您。谢谢!

  • 您好,

    和您确认下,您是说,您目前无法使用 xds560v2来擦除闪存的 N 扇区? 但能够使用 xds100v3成功擦除扇区?

    此外,该程序在没有连接 JTAG 调试探针时工作良好? 

  • 不是使用xds560擦除是通过程序调用flashapi对内部flash进行读写 但此时debug使用的仿真器是xds560 在外部发sci命令此时下位机程序调用flashapi进行读写的过程中会有很大几率在某一次调用中报错 但当我使用xds100v3进行同样操作时却不会出现报错 下位机程序是运行在BCDEF中 并没有运行在N区

  • 调试状态是通过xds560进行debug 通过串口发送命令给dsp 然后dsp调用flashapi进行数据的擦除和写入 连接仿真器的目的是查看数据是否被正确的写入 但在这个过程中的某一次 ccs就会报错 dsp会直接复位 但在此之前数据都被正确的写入 同样的操作步骤 使用仿真器变为xds100v3进行debug时却不会出现报错复位的情况 此程序离线运行正常

  • 我就没太弄得明白

  • 我们跟进给工程师了,有答复的话尽快给到您。

  • 您好,

    那么目前的情况是,在您的程序中有一些内容,以便 F28377D 在通过 SCI 接收到特定命令时执行闪存擦除?

    请问您是如何使用闪存 API 的? 能否分享下该部分代码?(如有不便请联系我,我会通过邮件与您取得联系)

  • 有点长。。.

    void Flash_Write(Uint32 address,Uint16* Buffer,Uint16 length,uint16_t Status)
    {
    Uint32* Buffer32 = (Uint32*)Buffer;
    Uint32 u32Index = 0;
    Uint16 i = 0;

    // Disable ECC. ECC does not have to be disabled to do FSM operations like
    // program and erase.
    // However, on Sonata Rev. 0 silicon, due to an OTP ECC errata,
    // disable ECC to avoid ECC errors while using Flash API functions that
    // read TI-OTP
    EALLOW;
    Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0x0;
    EDIS;

    EALLOW;

    // Before performing FSM operations, set the waitstates for FSM operations
    // calculated using RWAIT = (SYSCLK/50MHz)-1
    // If RWAIT results in a fractional value, round it up to the nearest
    // integer.
    // Please note that RWAIT for read operation should be calculated
    // differently. See Internal Memory guide section in TRM for more details.

    #if CPU_FRQ_200MHZ
    Flash0CtrlRegs.FRDCNTL.bit.RWAIT = 0x3;
    #endif

    // This function is required to initialize the Flash API based on System
    // frequency before any other Flash API operation can be performed
    #if CPU_FRQ_200MHZ
    oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 200);
    #endif


    if(oReturnCheck |= Fapi_Status_Success)
    {
    // Check Flash API documentation for possible errors
    Example_Error(oReturnCheck);
    }

    // Fapi_getLibraryInfo function can be used to get the information specific
    // to the compiled version of the API library
    //oLibInfo = Fapi_getLibraryInfo();


    // 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)
    {
    // Check Falsh API documentation for possible errors
    Example_Error(oReturnCheck);
    }

    // Fapi_getBankSectors function returns the bank starting address, number of
    // sectors, sector sizes, and bank technology type
    // Above information is returned in a structure oFlashBankSectors of type
    // Fapi_FlashBankSectorsType
    /* oReturnCheck = Fapi_getBankSectors(Fapi_FlashBank0,&oFlashBankSectors);
    if(oReturnCheck |= Fapi_Status_Success)
    {
    //Check Falsh API documentation for possible errors
    Example_Error(oReturnCheck);
    }
    */
    if(Status==0)
    {
    // Erase Sector N
    // Sectors A and D have the example code so leave them programmed
    oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,
    (uint32 *)address);

    // Wait until FSM is done with erase sector operation
    while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady){}

    // Verify that SectorL is erased. The Erase step itself does a
    // verify as it goes. This verify is a 2nd verification that can be done.
    oReturnCheck = Fapi_doBlankCheck((uint32 *)address,
    Bzero_16KSector_u32length,
    &oFlashStatusWord);

    if(oReturnCheck |= Fapi_Status_Success)
    {
    // Check Falsh API documentation for possible errors
    // If Erase command fails, use Fapi_getFsmStatus() function to get the
    // FMSTAT register contents to see if any of the EV bit, ESUSP bit,
    // CSTAT bit or VOLTSTAT bit is set (Refer to API documentation for
    // more details)
    Example_Error(oReturnCheck);
    }
    }
    // A data buffer of max 8 words can be supplied to the program function.
    // Each word is programmed until the whole buffer is programmed or a
    // problem is found. However to program a buffer that has more than 8
    // words, program function can be called in a loop to program 8 words for
    // each loop iteration until the whole buffer is programmed


    // Example: Program 0xFF bytes in Flash Sector C along with auto-
    // generated ECC

    // In this case just fill a buffer with data to program into the flash.
    /* for(i=0;i<=WORDS_IN_FLASH_BUFFER;i++)
    {
    Buffer[i] = i+20;
    }
    */

    for(i=0, u32Index = address ;
    (u32Index < (address + length))
    && (oReturnCheck == Fapi_Status_Success); i+= 4, u32Index+= 4)
    {
    oReturnCheck = Fapi_issueProgrammingCommand((uint32 *)u32Index,Buffer+i,
    4,
    0,
    0,
    Fapi_AutoEccGeneration);

    while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);

    if(oReturnCheck |= Fapi_Status_Success)
    {
    // Check Flash API documentation for possible errors
    Example_Error(oReturnCheck);
    }

    // Read FMSTAT register contents to know the status of FSM after
    // program command for any debug
    oFlashStatus = Fapi_getFsmStatus();

    // Verify the values programmed. The Program step itself does a verify
    // as it goes. This verify is a 2nd verification that can be done.
    oReturnCheck = Fapi_doVerify((uint32 *)u32Index,
    2,
    Buffer32+i/2,
    &oFlashStatusWord);
    if(oReturnCheck |= Fapi_Status_Success)
    {
    // Check Flash API documentation for possible errors
    Example_Error(oReturnCheck);
    }
    }

    // Fapi_doMarginRead((Uint32 *)Bzero_SectorM_start,Buffer_read32,2,Fapi_NormalRead);

    // Enable ECC
    Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0xA;

    EDIS;

    //Fapi_doMarginRead((Uint32 *)Bzero_SectorM_start,Buffer_read32,5,Fapi_NormalRead);
    // Leave control over flash pump
    // ReleaseFlashPump();

    // Example is done here
    Example_Done();

    }

  • uint16_t Data_r[150];
    float_to_Byte(Location_PID_Data1[0].KP, &Data_r[0]);
    float_to_Byte(Location_PID_Data1[0].KI, &Data_r[4*1]);
    float_to_Byte(Location_PID_Data1[0].KD, &Data_r[4*2]);
    float_to_Byte(Location_PID_Data1[0].MAX_Integration, &Data_r[4*3]);
    float_to_Byte(Location_PID_Data1[0].MIN_Integration, &Data_r[4*4]);
    float_to_Byte(Location_PID_Data1[0].Offect_Num, &Data_r[4*5]);

    Flash_Write(Bzero_SectorM_start, Data_r, 136, 0);

  • 好的,已跟进给工程师。

  • 您好,

    xds100v3和 XDS560V2使用的是单独的软件来生成发送到器件的位。 该问题可能是由 XDS560V2软件中的某些问题引起的,是一个非常具体且很难找到的bug。

    对您来说该问题是否很紧迫?还是说可以使用没有该问题的xds100v3继续推进您的项目?

  • 不是非常紧迫 可以继续使用xds100v3继续调试 但是下载的速度较慢 当时采购xda560就是为了调试能够更加快速 如果可以的话希望还是能帮忙找找解决方案 谢谢!

  • 好的明白,我们反馈给工程师看下,应该会在下周工作日给到您答复。

  • 您好,

    如果能找到根本原因确实很好,但这个可能不是 C2000器件的问题,而是 XDS560调试探针的问题。 我们的专家询问了一位熟知XDS560软件的工程师,但他们也表示没见过该问题。

    如果可以的话您愿意试下其他 JTAG 调试探针吗? 调试时XDS110比 XDS100快,可以选择将 TCK 频率设置为高达14MHz。 XDS200调试探针可设置为以20MHz 运行。