cancel
Showing results for 
Search instead for 
Did you mean: 

send TCP data over LwIP stack on STM32F4x7 discovery board

wenbingma2012
Associate II
Posted on September 27, 2013 at 11:22

I have migrated LwIP 1.4.1 to my STM32F4x7 discovery board. I refer to ST software kit STSW-STM32070. My board acts as tcp echo server. I can send data to server and received data from server by TCP tool. Now I want to send TCP data from server side when external conditions is

statisfied

. For testing, I wrote TCP data send function and call in main thread. but does not work. debug message is shown: ''tcp_write: queue too long 10 (8)'' C code:

''tcp_echoserver_pcb'' is global variable when connection is established.
 void tcp_data_send(void)
 {
 char data1[] = { 1, 2, 3, 4}; if( tcp_echoserver_pcb != NULL && |tcp_echoserver_pcb->state == ESTABLISHED))
 {
 /* send data1 */
 err = tcp_write(tcp_echoserver_pcb, (const void *)&data1, 4, 0); err = tcp_output(tcp_echoserver_pcb);
 
 if( ( err == ERR_MEM ) )
 {
 // close_my_conn( my_pcb );
 } 
 
 }}
 int main(void)

{
/*!< At this stage the microcontroller clock setting is already configured to 
144 MHz, this is done through SystemInit() function which is called from
startup file (startup_stm32f4xx.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f4xx.c file
/* Configure ethernet (GPIOs, clocks, MAC, DMA) */ 
ETH_BSP_Config();
/* Initilaize the LwIP stack */
LwIP_Init();

 /* tcp echo server Init */
 tcp_echoserver_init();
/* Infinite loop */
while (1)
{ 
udp_send();
/* check if any packet received */
if (ETH_CheckFrameReceived()) { 
/* process received ethernet packet */
LwIP_Pkt_Handle();
}
/* handle periodic timers for LwIP */
LwIP_Periodic_Handle(LocalTime);
}
 
 // Send TCP data
 tcp_data_send();

}

0 REPLIES 0