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.

CCS/LAUNCHXL-CC1352R1: i am using the bootloader with its uart to write bin file to flash. the question is that it is nomal or not that i have to send cmd(download/ping/...)several times(maybe 5 times), then i can receive ACK/NACK from the bootloader.

Part Number: LAUNCHXL-CC1352R1

Tool/software: Code Composer Studio

i write a func so that i can receive right messages from the bootloader with uart even if it dose not return anything or wrong messaes.

void sendcmd(UART_Handle uart, uchar Cmd, const uchar *pcSendData, uchar SendLen_data)//命令+数据(通过第三个参数判断数据指针叠加的数),最终发送数据:第一字节为总的发送内容的长度
{ //第二字节为校验和=cmd+data
uchar length_all = SendLen_data + 3; //第三字节即为cmd
//uchar pdata[length_all]; //后面即为接着cmd的数据,可以没有,因此最短长度为3
uchar pdata[3];
pdata[0] = length_all;
pdata[1] = generateCheckSum(Cmd, pcSendData, SendLen_data);
pdata[2] = Cmd;
if(UART_write(uart, pdata, 3) != 3)//数组的长度不确定,因此分批发送
errorhandle();
int i;
for(i=0; i<SendLen_data; i++)
{
//pdata[2+i] = pcSendData[i];
uchar data_1byte = *(pcSendData+i);
if(UART_write(uart, &data_1byte, 1) != 1)
errorhandle();
}
//if(UART_write(uart, pdata, length_all) != length_all)
// errorhandle();
}
void sendcmd_right(UART_Handle uart, uchar Cmd, const uchar *pcSendData, uchar SendLen_data)
{
int x=0;
uchar rec_data[2];
rec_data[0]=0x00;
rec_data[1]=0x00;
while(!(rec_data[0]==0x00&&rec_data[1]==0xcc))
{
sendcmd(uart, Cmd, pcSendData, SendLen_data);
x = UART_read(uart, rec_data, 2);
}
}