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.

TMS570LS1114: @QJ WANG Summarizing Bootloader issues and thank you

Part Number: TMS570LS1114

Dear Expert.

       Thank you for these days of patient solutions.

First, I want to say that you are right. In fact, Bt Code is no problem. The problem bothers me due to the board we design. Now, I rewrite some configurations to replace it, The Bt and PC can communicate successfully.

And Only 16 bytes data transmit still exist,So what should I do next.

 

 

Thanks and Regards.

Qiuchi

  • Hi QiuChi,

    On PC side, after transmitting the first 8 bytes data, you call a data receive function:

    recieve_FrmFlag=Receive(USBCAN2,0,0,ReceiveBuf,50,100);

    data length is 50.

    Please change it to 0.
  • Dear QJ Wang,

    After I change the data length from 50 to 0, The Bt Side  shows no data to load.

    Now I suspect that my for loop function in Send Data is not written correctly.

     

    Thanks and Regards

    Qiuchi

     

  • Dear QJ  Wang,

    My  PC Side Code is the following.

    /*==============================================================================
    * COMMAND Sent Data
    *===============================================================================*/
    Get_BinaryData( filename );
    ulAddress = 0x00010100;
    ZeroMemory(&frameinfo,sizeof(CAN_OBJ));
    frameinfo.DataLen= 8;
    frameinfo.RemoteFlag = 0;
    frameinfo.ID = CAN_COMMAND_SEND_DATA;
    ulLength = image_size;

    //#3, Loop through the data in the code to be downloaded.
    for(ulOffset = 0; ulOffset < ulLength; ulOffset += 8)
    {
    // Build a send data command.
    for(ulIdx = 0; ulIdx < 8; ulIdx++)
    {
    frameinfo.Data[ulIdx] = image[ulOffset + ulIdx];
    }

    // See if the entire buffer contains valid data to be downloaded.
    if((ulOffset + ulIdx) > ulLength)
    {
    frameinfo.DataLen = ulLength - ulOffset;
    // Send the send data command with the remainder of the data to be downloaded.
    //Sleep(1);
    send_one_FrmFlag=Transmit(USBCAN2,0,0,&frameinfo,1);
    //入口参数----m_devtype:设备名;设备索引号;第几路CAN;要发送的数据帧数组首地址;要发送数据帧数组的长度
    //返回实际发送的帧数
    // canTxstateFlag=ReadCANStatus(USBCAN2,0,0,&vcs);
    //VCS :用来存储CAN状态的CAN_STATUS结构指针。
    }
    else
    {
    frameinfo.DataLen = 8;
    send_one_FrmFlag=Transmit(USBCAN2,0,0,&frameinfo,1);
    Sleep(20);
    //入口参数----m_devtype:设备名;设备索引号;第几路CAN;要发送的数据帧数组首地址;要发送数据帧数组的长度
    do{
    recieve_FrmFlag=Receive(USBCAN2,0,0,ReceiveBuf,50,100);
    //入口参数----m_devtype:设备名;设备索引号;第几路CAN;用来接收数据帧的数组首指针地址;用来接收的数据帧数组的长度,等待超时100 MS
    //返回实际读取的帧数

    } while (recieve_FrmFlag < 0);

    if (send_one_FrmFlag < 0)
    {
    ShowInfo("写入失败",2);
    }

    rcvID = ReceiveBuf[0].ID;
    rcvData = ReceiveBuf[0].Data[0];
    rcvDataLen = ReceiveBuf[0].DataLen;
    if((rcvID != 0x05a6) && (rcvData != 0))
    {
    printf(" - COMMAND_SEND_DATA failed!\n");
    }
    }
    recieve_FrmFlag=Receive(USBCAN2,0,0,ReceiveBuf,50,10);
    //入口参数----m_devtype:设备名;设备索引号;第几路CAN;用来接收数据帧的数组首指针地址;用来接收的数据帧数组的长度,等待超时100 MS
    //返回实际读取的帧数
    canRxstateFlag=ReadCANStatus(USBCAN2,0,0,&vcs);
    rcvID = ReceiveBuf[0].ID;
    rcvData = ReceiveBuf[0].Data[0];
    rcvDataLen = ReceiveBuf[0].DataLen;
    if((rcvID != 0x07F4) && (rcvData != 0))
    {
    printf(" - COMMAND_SEND_DATA failed!\n");
    }
    }

     

     

    Thanks and Regards

    Qiuchi

  • Dear QJ Wang,

    My PC  Code  about send data as follows.

    /*==============================================================================
    * COMMAND Sent Data
    *===============================================================================*/
    Get_BinaryData( filename );
    ulAddress = 0x00010100;
    ZeroMemory(&frameinfo,sizeof(CAN_OBJ));
    frameinfo.DataLen= 8;
    frameinfo.RemoteFlag = 0;
    frameinfo.ID = CAN_COMMAND_SEND_DATA;
    ulLength = image_size;

    //#3, Loop through the data in the code to be downloaded.
    for(ulOffset = 0; ulOffset < ulLength; ulOffset += 8)
    {
    // Build a send data command.
    for(ulIdx = 0; ulIdx < 8; ulIdx++)
    {
    frameinfo.Data[ulIdx] = image[ulOffset + ulIdx];
    }

    // See if the entire buffer contains valid data to be downloaded.
    if((ulOffset + ulIdx) > ulLength)
    {
    frameinfo.DataLen = ulLength - ulOffset;
    // Send the send data command with the remainder of the data to be downloaded.
    //Sleep(1);
    send_one_FrmFlag=Transmit(USBCAN2,0,0,&frameinfo,1);

    // canTxstateFlag=ReadCANStatus(USBCAN2,0,0,&vcs);

    }
    else
    {
    frameinfo.DataLen = 8;
    send_one_FrmFlag=Transmit(USBCAN2,0,0,&frameinfo,1);
    Sleep(20);

    do{
    recieve_FrmFlag=Receive(USBCAN2,0,0,ReceiveBuf,50,100);

    } while (recieve_FrmFlag < 0);

    if (send_one_FrmFlag < 0)
    {
    ShowInfo("write fail",2);
    }

    rcvID = ReceiveBuf[0].ID;
    rcvData = ReceiveBuf[0].Data[0];
    rcvDataLen = ReceiveBuf[0].DataLen;
    if((rcvID != 0x05a6) && (rcvData != 0))
    {
    printf(" - COMMAND_SEND_DATA failed!\n");
    }
    }
    recieve_FrmFlag=Receive(USBCAN2,0,0,ReceiveBuf,50,10);

    canRxstateFlag=ReadCANStatus(USBCAN2,0,0,&vcs);
    rcvID = ReceiveBuf[0].ID;
    rcvData = ReceiveBuf[0].Data[0];
    rcvDataLen = ReceiveBuf[0].DataLen;
    if((rcvID != 0x07F4) && (rcvData != 0))
    {
    printf(" - COMMAND_SEND_DATA failed!\n");
    }
    }

    Thanks and Regards

    Qiuchi

     

  • Hi QiuChi,

    I have no idea about the TX and RX functions: Transmit(..) and Receive(...).

    1. What are definition of the arguments of those 2 functions: 0, 0, 1, 50, 100
    My understanding is that the last argument of Transmit(..) is the length of TX data buffer. I noticed that you use "1" for all the Transmit(..), so I am confused.

    2. What is the definition of the return value of those 2 functions: send_one_FrmFlag, and recieve_FrmFlag

    send_one_FrmFlag=Transmit(USBCAN2,0,0,&frameinfo,1);
    do{
    recieve_FrmFlag=Receive(USBCAN2,0,0,ReceiveBuf,50,100);
    } while (recieve_FrmFlag < 0);
  • Dear QJ  Wang,

    Thank you for your help this time, the problem is solved, mainly hardware and delay issues.

     

    Thanks and Regards

    Qiuchi