Other Parts Discussed in Thread: CC3200SDK
Tool/software: Code Composer Studio
Hi,
SDK:CC3200SDK_1.5.0
I use the udp_socket project it appears unknown delay(about 16ms), Based on this project, only modified the following parts:
int BsdUdpServer(unsigned short usPort)
{
SlSockAddrIn_t sAddr;
SlSockAddrIn_t sLocalAddr;
int iCounter;
int iAddrSize;
int iSockID;
int iStatus;
long lLoopCount = 0;
short sTestBufLen;
int count = 0;
// filling the buffer
for (iCounter=0 ; iCounter<BUF_SIZE ; iCounter++)
{
g_cBsdBuf[iCounter] = (char)(iCounter % 10);
}
sTestBufLen = BUF_SIZE;
//filling the UDP server socket address
sLocalAddr.sin_family = SL_AF_INET;
sLocalAddr.sin_port = sl_Htons((unsigned short)usPort);
sLocalAddr.sin_addr.s_addr = 0;
iAddrSize = sizeof(SlSockAddrIn_t);
// creating a UDP socket
iSockID = sl_Socket(SL_AF_INET,SL_SOCK_DGRAM, 0);
if( iSockID < 0 )
{
// error
ASSERT_ON_ERROR(SOCKET_CREATE_ERROR);
}
// binding the UDP socket to the UDP server address
iStatus = sl_Bind(iSockID, (SlSockAddr_t *)&sLocalAddr, iAddrSize);
if( iStatus < 0 )
{
// error
sl_Close(iSockID);
ASSERT_ON_ERROR(BIND_ERROR);
}
udp_socket_opt_set(iSockID);
// no listen or accept is required as UDP is connectionless protocol
/// waits for 1000 packets from a UDP client
// while (lLoopCount < g_ulPacketCount)
while (1)
{
iStatus = sl_RecvFrom(iSockID, g_cBsdBuf, sTestBufLen, 0,
( SlSockAddr_t *)&sAddr, (SlSocklen_t*)&iAddrSize );
if( iStatus < 0 && iStatus != -11)
{
// error
sl_Close(iSockID);
ASSERT_ON_ERROR(RECV_ERROR);
}
lLoopCount++;
//UART_PRINT("iStatus = %d\r\n",iStatus);
UART_PRINT("0");
delay_us(900);
if(iStatus>0)
{
UART_PRINT("11111111111111111111111111111111111111111111111111iStatus = %d\r\n",iStatus);
}
}
UART_PRINT("Recieved %u packets successfully\n\r",g_ulPacketCount);
//closing the socket after receiving 1000 packets
sl_Close(iSockID);
return SUCCESS;
}
/****************************************************************************
// MAIN FUNCTION
//****************************************************************************
void main()
{
long lRetVal = -1;
//
// Board Initialization
//
BoardInit();
//
// uDMA Initialization
//
UDMAInit();
//
// Configure the pinmux settings for the peripherals exercised
//
PinMuxConfig();
//
// Configuring UART
//
InitTerm();
//
// Display banner
//
DisplayBanner(APPLICATION_NAME);
InitializeAppVariables();
//
// Following function configure the device to default state by cleaning
// the persistent settings stored in NVMEM (viz. connection profiles &
// policies, power policy etc)
//
// Applications may choose to skip this step if the developer is sure
// that the device is in its desired state at start of applicaton
//
// Note that all profiles and persistent settings that were done on the
// device will be lost
//
lRetVal = ConfigureSimpleLinkToDefaultState();
if(lRetVal < 0)
{
if (DEVICE_NOT_IN_STATION_MODE == lRetVal)
UART_PRINT("Failed to configure the device in its default state \n\r");
LOOP_FOREVER();
}
UART_PRINT("Device is configured in default state \n\r");
//
// Asumption is that the device is configured in station mode already
// and it is in its default state
//
lRetVal = sl_Start(0, 0, 0);
if (lRetVal < 0 || lRetVal != ROLE_STA)
{
UART_PRINT("Failed to start the device \n\r");
LOOP_FOREVER();
}
UART_PRINT("Device started as STATION \n\r");
UART_PRINT("Connecting to AP: %s ...\r\n",SSID_NAME);
//
//Connecting to WLAN AP
//
lRetVal = WlanConnect();
if(lRetVal < 0)
{
UART_PRINT("Failed to establish connection w/ an AP \n\r");
LOOP_FOREVER();
}
UART_PRINT("Connected to AP: %s \n\r",SSID_NAME);
UART_PRINT("Device IP: %d.%d.%d.%d\n\r\n\r",
SL_IPV4_BYTE(g_ulIpAddr,3),
SL_IPV4_BYTE(g_ulIpAddr,2),
SL_IPV4_BYTE(g_ulIpAddr,1),
SL_IPV4_BYTE(g_ulIpAddr,0));
lRetVal = BsdUdpServer(PORT_NUM);
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//#ifdef USER_INPUT_ENABLE
// lRetVal = UserInput();
// if(lRetVal < 0)
// {
// ERR_PRINT(lRetVal);
// LOOP_FOREVER();
// }
//
//#else
// lRetVal = BsdUdpClient(PORT_NUM);
// if(lRetVal < 0)
// {
// ERR_PRINT(lRetVal);
// LOOP_FOREVER();
// }
//
// lRetVal = BsdUdpServer(PORT_NUM);
// if(lRetVal < 0)
// {
// ERR_PRINT(lRetVal);
// LOOP_FOREVER();
// }
//#endif
UART_PRINT("Exiting Application ...\n\r");
//
// power off the network processor
//
lRetVal = sl_Stop(SL_STOP_TIMEOUT);
while (1)
{
_SlNonOsMainLoopTask();
}
}
//*****************************************************************************
If I add the delay sentance"delay_us(900)" to the code, the unknown delay time will disappear.If not,it will appear about
16ms delay time,such as the following picture.Why is it?Can you help here?
logic Analyzer log the TX pin of serial port Output waveform :



