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.

[参考译文] TMS320F28069F:同时使用串行端口写入闪存。 读取校验和测试时出现问题。

Guru**** 2542630 points


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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/783552/tms320f28069f-while-writing-flash-memory-using-serial-port-problem-with-reading-for-checksum-test

器件型号:TMS320F28069F

我已经尝试写入闪存存储器。

我指的是 TI 闪存写入器。 我的应用程序基于 Windows MFC。

我的串行写入器函数就是这样的...

--------------------------------------------------

UINT Serial_Flash_Programmer (LPVOID lpData)
{


PointerToDev* thInfo =(PointerToDev*) lpData;
CProdcutView* pthread = thInfo->Pview;
CMainFram* pMain = thInfo->pMain;
int devNo = thInfo->devNo;

int iExitCode = 0;Cmastr Port* pMain = thInfo->audt
;CaudstrString (Ct_Data/trag/Caudt




);Caud_String (Ct_Strtt);Caud_Strt_String (Ct_Data/Ct_Data/Ct_Strt_Data/Cupt)
Check Alignment











of PHs>字符串 g_strKernelFile (_T (""));g_strKernelFile = pthread->GetKernelTxtFile();//内核文件 g_strAppFile = pthread->GetAppTxtFile();//应用文件 if (initFlashProgrammer (pthread、devNo、g_port_commorFile)= pthread、commport0)...(commitr&r)= ptrl 0)、commv0...(commv0=port.0)、commorFile= ptrendorFile...)、commport.0)
返回0;
}


文件*KfH;
KfH = openKernel (pthread、devNo、g_strKernelFile);
if (KfH =NULL)
{
...//errorHandling……
返回10;
}


文件*AFH;
AFH = openapp (pthread、devNo、g_strAppFile);
if (AFH == NULL)
{
...//errorHandling……
如果



(setKernelAutoBaud (pthread、commPortFile、devNo)<0)
{...//errorHandling
……则返回10;}
return (12);
}
trace (_T ("内核自动波特率成功\n"));


writeKernel (pthread、commPortFile、KfH、devNo);
Sleep (1000);

if (setAppAutoBaud (pthread、commPortFile、devNo)< 0)
{
return (12);
}

if (writeApp (pthread、commPortFile、AFH、devNo)< 0)
{
return 12;
}
CloseHandle (commPortFile);
CString str;

//成功处理...

pMain->PrintBuild(str);
return 0;

} 

--------------------------------------------------

我遇到了 writeApp(...)的一些问题。

当 writeApp 执行一些校验和测试时、将触发无限0字节读取 ROOF。

下面是器件。

--------------------------------------------------

int writeApp (CProdcutManagerView* pthread、handle targetBoard、file* AppFileHandle、int devNo)
{
//预览是所有已通过的进程...
int pos = 0;
while (1)
{
CString str;
fileStatus = fscanf_s (AppFileHandle、"%x "、&sendData[0]);

if (fileStatus = EOF)
break;


targetFile (WritetBoard、&sendData[0]、1、&Writdwten、 空);
校验和+= sendData[0];

//获取块大小
//块大小= targetBoard[0]+(targetBoard[1]<8)
if (txCount == 0x00)
{
w_blocksize = sendData[0];
}
否则(txCount == 0x01)
{

byteData = sendData = sendData<|msb+
;(txData=0+)





//如果下一个块大小为0,则退出 while 循环。
if (w_blocksize =0x00 && txCount > 1)
//handle 文件结束
{
w_blocksize = 0x0000;
byteData = 0x0000;
//str.Format (_T ("测试校验和:%d")、pos);
pthread->SetNotify (devNo、 _t("Test Passed.");
break;
}//
将在块中的所有数据都已发送时执行
,否则,如果(txCount == 2 *(w_blocksize + 3))
//handle 块结束
{
str.Format (_T ("测试校验和:%d,SEND),pos);
pthread->Setstr (devNo,Notify);
doublewordReadCount = 0;
while (doublewordReadCount = 0)
{
ReadFile (targetBoard、&rcvData、1、&doublewordReadCount、NULL);

}
doublewordReadCount = 0;

while (doublewordReadCount = 0)
{
ReadFile (targetBoard、&rcvDataH、1、&doublewordReadCount、NULL);

}
//确保校验和匹配
(checksum !=(rcvData |(rcvDataH << 8)))
{
trace(_T("chkSum (%x):%x")、校验和、(rcvData |(rcvDataH << 8)));
CloseHandle (targetBoard);
pthread (<1);'SetNotify (_DevNotify
)

否则
校验和= 0;

w_blocksize = 0x0000;
byteData = 0x0000;
txCount = 0x00;
}
//将在闪存内核缓冲区已满(0x400字= 0x800字节)时执行
,否则(txCount - 6)% 0x800 = 0 && txCount > 6)
//处理内核溢出
{

int retry = 0;
doublewordReadCount = 0;
rcvData = 0;
rcvDataH = 0;

while (doublewordReadCount = 0)ReadFile (targetBoard、&rcvData、1、&doublewordReadCount、NULL); 
如果(retry++> 1000)
{
CloseHandle (targetBoard);
str.Format (_T ("测试校验和:%d、txRead1:%d")、pos、txCount); 
pthread->SetNotify (devNo、str);
返回-1; 
}

//留待程序 

返回1;

--------------------------------------------------

结果日志是 

“Testing checksum :3515,txRead1:2054"并停止。


我希望上传的应用文件已损坏、但我不确定。
因为、
1.有些文件运行良好,但有些文件不工作。
2.所有使用 JTAG 写入的上载操作都运行良好。

您能否检查文件、上传时出现了什么问题?

我正在等待答案。  

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

    加法: Ooops..

    --------------------

    int writeApp (CProdcutManagerView* pthread、handle targetBoard、file* AppFileHandle、int devNo)
    {
    //预览是所有已通过的进程...
    int pos = 0;
    while (1)
    {
    CString str;
    fileStatus = fscanf_s (AppFileHandle、"%x "、&sendData[0]);
    
    if (fileStatus = EOF)
    break;
    
    
    targetFile (WritetBoard、&sendData[0]、1、&Writdwten、 空);
    校验和+= sendData[0];
    
    //获取块大小
    //块大小= targetBoard[0]+(targetBoard[1]<8)
    if (txCount == 0x00)
    {
    w_blocksize = sendData[0];
    }
    否则(txCount == 0x01)
    {
    
    byteData = sendData = sendData<|msb+
    ;(txData=0+)
    
    
    
    
    
    //如果下一个块大小为0,则退出 while 循环。
    if (w_blocksize =0x00 && txCount > 1)
    //handle 文件结束
    {
    w_blocksize = 0x0000;
    byteData = 0x0000;
    //str.Format (_T ("测试校验和:%d")、pos);
    pthread->SetNotify (devNo、 _t("Test Passed.");
    break;
    }//
    将在块中的所有数据都已发送时执行
    ,否则,如果(txCount == 2 *(w_blocksize + 3))
    //handle 块结束
    {
    str.Format (_T ("测试校验和:%d,SEND),pos);
    pthread->Setstr (devNo,Notify);
    doublewordReadCount = 0;
    while (doublewordReadCount = 0)
    {
    ReadFile (targetBoard、&rcvData、1、&doublewordReadCount、NULL);
    
    }
    doublewordReadCount = 0;
    
    while (doublewordReadCount = 0)
    {
    ReadFile (targetBoard、&rcvDataH、1、&doublewordReadCount、NULL);
    
    }
    //确保校验和匹配
    (checksum !=(rcvData |(rcvDataH << 8)))
    {
    trace(_T("chkSum (%x):%x")、校验和、(rcvData |(rcvDataH << 8)));
    CloseHandle (targetBoard);
    pthread (<1);'SetNotify (_DevNotify
    )
    
    否则
    校验和= 0;
    
    w_blocksize = 0x0000;
    byteData = 0x0000;
    txCount = 0x00;
    }
    //将在闪存内核缓冲区已满(0x400字= 0x800字节)时执行
    ,否则(txCount - 6)% 0x800 = 0 && txCount > 6)
    //处理内核溢出
    {
    
    int retry = 0;
    doublewordReadCount = 0;
    rcvData = 0;
    rcvDataH = 0;
    
    while (doublewordReadCount = 0)
    {
    ReadFile (targetBoard、&rcvData、1、&doublewordReadCount、NULL);
    如果(retry++> 1000)
    {
    CloseHandle (targetBoard);
    str.Format (_T ("测试校验和:%d、txRead1:%d")、pos、txCount);
    pthread->SetNotify (devNo、str);
    return -1;
    
    }
    
    }...//steet
    进程
    
    返回1;
    } 

    结果:  

    “Testing checksum :3515,txRead1:2054"并停止。 


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

    我将无法帮助调试您的定制闪存编程器。

    但您可以使用串行闪存编程器和 SCI 闪存内核来帮助您快速入门。

    请访问 www.ti.com/.../sprabv4b.pdf

    此致、
    SAL