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.

求助:CC3000 TCP连接发送数据进入BUFFER_MAGIC_NUMBER 异常死循环的问题

Other Parts Discussed in Thread: MSP430G2553

下面是socket的建立源码

signed char appSocketConnect(void)
{
    smtpSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

    if (smtpSocket == -1)
    {
        wlan_stop();
        return -1;
    }

    tSocketAddr.sa_family = AF_INET;

    tSocketAddr.sa_data[0] = (port & 0xFF00) >> 8;
    tSocketAddr.sa_data[1] = (port & 0x00FF);

      //correcting the endianess
    tSocketAddr.sa_data[2] = smtpServerIP[0];  // First octet of destination IP
    tSocketAddr.sa_data[3] = smtpServerIP[1];   // Second Octet of destination IP
    tSocketAddr.sa_data[4] = smtpServerIP[2];  // Third Octet of destination IP
    tSocketAddr.sa_data[5] = smtpServerIP[3];  // Fourth Octet of destination IP

    smtpServerFlag = connect(smtpSocket, &tSocketAddr, sizeof(tSocketAddr));

    if (smtpServerFlag < 0)
    {
            // Unable to connect
        return -1;
    }
	else
	{
		smtpServerFlag = 1;

		//success
	}
    // Success
    return 0;
}

下面是发送源码

send(smtpSocket,"Hello",6,0);

 

网络调试助手能收到消息。但是CC3000在发送完之后就会进入死循环,调试原因发现是进入了

if (wlan_tx_buffer[CC3000_TX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER)

wlan_tx_buffer这个buf的第58个字节被覆盖为0x01了

然后官方给的处理是死循环。但是我吧while注释完之后,也能正常的连续发送。

请问下这是什么原因导致的。

 

非常感谢!!!