Hi Mark,
I am having problems when using fnSendBufTCP(), the processor locks up. I am having problems debugging it as you described, but looked at my code and looks fine. As I am not to sure on how the callback function works with partial acks etc, can you let me know if okay?.
Here is a copy of my callback function. There is only about 100 characters at a time being sent (will be more when I get it working) and have the following defines:
#define TCP_BUFFER 2800 // size of TCP buffer (with USE_BUFFERED_TCP) - generous with M5223X
#define TCP_BUFFER_FRAME 1400 // allow this max. TCP frame size
#define SUPPORT_PEER_WINDOW // respect peer's Open Window when sending TCP frames
#define WINDOWING_BUFFERS 4 // we can send 4 frames before requiring ACKs
#define CONTROL_WINDOW_SIZE
And the callback function..
its the TCP_EVENT_ACK and TCP_EVENT_PARTIAL_ACK im not sure about..
int fnTCP(USOCKET Socket, unsigned char ucEvent, unsigned char *ucIp_Data, unsigned short usPortLen)
{
TCP_MESSAGE test_message;
unsigned char Value;
int Loop;
switch (ucEvent) {
case TCP_EVENT_CONNECTED:
Diagnostic_TCPSocket.Diagnostics=1;
ConnectionInfo.DiagHeartbeat=3; //gets decreased in seconds, then send heartbeat to app.
break;
case TCP_EVENT_CLOSE:
case TCP_EVENT_CONREQ: break;
case TCP_EVENT_ACK:
if (fnSendBufTCP(Socket, 0, 0, TCP_BUF_NEXT)) { // send next buffered (if waiting)
return APP_SENT_DATA; // mark that data has been transmitted
}
break;
case TCP_EVENT_ARP_RESOLUTION_FAILED:
break;
case TCP_EVENT_PARTIAL_ACK:
if (fnSendBufTCP(Socket, 0, 0, TCP_BUF_REP)) { // repeat send buffered
#ifdef SUPPORT_PEER_WINDOW
fnSendBufTCP(Socket, 0, 0, (TCP_BUF_NEXT | TCP_BUF_KICK_NEXT)); // kick off any following data as long as windowing allows it
#endif
return APP_SENT_DATA;
}
break;
case TCP_EVENT_REGENERATE:
break;
case TCP_EVENT_DATA:
for(Loop=0;Loop<usPortLen;Loop++)
{
Value=ucIp_Data[Loop];
.. save in buffer here...
}
break;
case TCP_EVENT_ABORT:
case TCP_EVENT_CLOSED:
Diagnostic_TCPSocket.Diagnostics=0;
fnTCP_close(Socket);
break;
}
return APP_ACCEPT;
}
Regards
Neil