Carl-SolderSplash wrote:The real issue is that the applications buffer size is bigger than the CC3000 librarys SPI buffer.
UDP_RecvSocket.receiveFrom(client, (char *)UDP_RecvBuffer, UDP_RECV_BUF_LEN);
The receiveFrom call asks the library to fetch more bytes than the SPI buffer can handle. So increasing the SPI buffer fixes it, as would decreasing the UDP_RECV_BUF_LEN define to be less than the CC3000_RX_BUFFER_SIZE (Note the CC3000_RX_BUFFER_SIZE define includes protocol overhead of around 20 bytes)
So, I found that the definition of CC3000_RX_BUFFER_SIZE is in cc3000_common.h by the definition of CC3000_MAXIMAL_RX_SIZE which was defined to be 511 + 1.
I changed that to 1500 + 1 and I then changed my receive buffer in my code to 1500.
I am getting much better results but I still see that after a time it hangs.
My Wireshark trace shows that the maximum UDP packet that is ever sent to port 1900 is 1066 bytes on the wire (1024 bytes of actual UDP packet data), so I should not be exceeding the maximum size or MTU (so no fragmentation)
I know that in your explanation you said that there should be 20 bytes of space for SPI protocol overhead so I then changed the RX_BUFFER to 1520 + 1. With that setup the chip hangs on receiving the very first UDP packet and stop responding to pings as well.
I then set the RX_BUFFER to 1066 + 1 and my program buffer to 1024. I then re-ran my tests and this seems to be a more stable configuration but it crashed after 32 packets received and stopped responding to pings. I then ran the test again and it died after receiving 11 packets.
So either I mis-read what you were saying and did not properly apply the fix that you had in mind or there is still something wonky with the library code.
Please let me know if there is anything I can do to help out and try to find the problem!