ucohen 0 Posted January 13, 2016 Share Posted January 13, 2016 Hello, I use EK-TM4C1294XL, and I want to make a stable TCP connection between the microcontroller and a computer. I use Energia's example "TelnetClient" to do it, when the microcontroller is the client and the computer is the server using Telnet. I succeed to make the connection, but there are a lot of problems with it. 1. Sometimes (I can't diagnose when it happens) the controller enter to infinite loop at tcp_out.c line 937: ? 1 for (; useg->next != NULL; useg = useg->next); When it happens, useg == useg->next. I try to solve it by change the row to: ? 1 for (; (useg->next != NULL)|(useg->next == useg); useg = useg->next); It seems that the problem solved, but I don't know how it affect on other functions. 2. Sometimes, when i close the computer's listener, the function client.connect don't recognize that there is no connection. So, when the listener reurn, the microcontroller don't retry to connect. 3. Sometimes, the software enter to infinite loop at EthernetClient.cpp at line 216 (in EthernetClient::write(const uint8_t *buf, size_t size)). i=0, size = 1, and its values don't change in the loop: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 // Attempt to write in 1024-byte increments. while (i < size) { inc = (size - i) < 1024 ? size - i : 1024; err_t err = tcp_write(cpcb, buf + i, inc, TCP_WRITE_FLAG_COPY); if (err != ERR_MEM) { // Keep enqueueing the lwIP buffer until it's full... i += inc; stuffed_buffer = false; } else { if (!stuffed_buffer) { // Buffer full; force output if (cs->mode) tcp_output(cpcb); stuffed_buffer = true; } else { delay(1); // else wait a little bit for lwIP to flush its buffers } } } Quote Link to post Share on other sites
energia 485 Posted January 13, 2016 Share Posted January 13, 2016 @@ucohen, the change to for (; (useg->next != NULL)|(useg->next == useg); useg = useg->next); does not seem to be right. Did you indeed mean "|" or does this need to be "||". You might have stumbled on a bug in lwip. Can you please post your Sketch so that we can use this to replicate the issue? Thanks, Robert ucohen 1 Quote Link to post Share on other sites
ucohen 0 Posted January 14, 2016 Author Share Posted January 14, 2016 Thanks Robert, How can I send you the sketch? Quote Link to post Share on other sites
spirilis 1,265 Posted January 14, 2016 Share Posted January 14, 2016 Thanks Robert, How can I send you the sketch? If it's short, post it here in the code feature (see the "<>" icon in the formatting toolbar above your entry window, same place where you find the Boldface, Italic, Underline, etc. icons) If it's long or there's multiple files, zip them up and attach the .zip file to a post. Hit "More Reply Options" to get an expansive editor window where you can attach files to your post. Quote Link to post Share on other sites
ucohen 0 Posted January 14, 2016 Author Share Posted January 14, 2016 Attached. The command to start operation - 1,1,1,2,3,4,5,6,7,8,9,10,10, The command to stop operation - 0,1,1,2,3,4,5,6,7,8,9,10,10, The IPs are defined in telnet_client.h LDD3000_Controller.zip Quote Link to post Share on other sites
ucohen 0 Posted January 14, 2016 Author Share Posted January 14, 2016 Unfortunately, the software until enter to the first infinite loop, although the fixing: for (; (useg->next != NULL)|(useg->next == useg); useg = useg->next); Quote Link to post Share on other sites
ucohen 0 Posted January 18, 2016 Author Share Posted January 18, 2016 Is there any way to solve the problems? Quote Link to post Share on other sites
energia 485 Posted January 18, 2016 Share Posted January 18, 2016 I looked at the code but can not spot anything obvious that would cause this issue. Would it be possible for you to reduce the code to a minimal possible while still showing the issue? That will help me a lot to narrow it down and reproduce it here. Quote Link to post Share on other sites
ucohen 0 Posted January 20, 2016 Author Share Posted January 20, 2016 I looked at the code but can not spot anything obvious that would cause this issue. Would it be possible for you to reduce the code to a minimal possible while still showing the issue? That will help me a lot to narrow it down and reproduce it here. A thin code is attached. There is no command requirement to start. I saw that almost the 2nd and 3rd problems are still here. The 1st problem is rare, so it possible that it is still here.EthernetProblems.zip Quote Link to post Share on other sites
ucohen 0 Posted January 25, 2016 Author Share Posted January 25, 2016 Is there any way to solve the problems? Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.