EmbeddedRelated.com
Forums
Memfault State of IoT Report

UDP over PPP (GPRS)

Started by FiReBiRd May 12, 2006
--- In r..., "FiReBiRd" wrote:
>
> Hello Lix,
>
> I have defined the ff as:
> #define ETH_MTU 1500
> #define BUFF_SIZE (ETH_MTU-28)
> #define UDP_BUF_SIZE (BUFF_SIZE*4)
> #define MAX_UDP_SOCKET_BUFFERS 1
>
> I am not transmitting large packets as of now. The data packet that
> is to be transmitted via UDP is from keyboard input, which is null
> terminated.

Can you be more specific in what "canot upload packets" means? Some examples? You
should get some errors from the udp_send function (or whatever function you use).

I am using the following defines:

#define USE_PPP_SERIAL 4
#define LCP_TIMEOUT 5000
#define ETH_MTU 1500
#define ETH_MAXBUFS 6
#define MAX_UDP_SOCKET_BUFFERS 1

This is how I am sending data on a socket:

udpResult = udp_send(s, buff, udp_msg_len);
if (udpResult < 0)
return WRITEERROR;

And here is the receive (read data from the socket):

udpResult = 0; // init in case we exit the loop with timeout
timeout = (10 * BASE); // about 10 seconds
while ((udpResult = udp_recvfrom(s, buff, TR_MAXFRAG + GUARD, NULL, NULL)) == -1)
{
OSTimeDly(1);
if (!timeout--) // test if we have enough of waiting
{
if (retries--) // ...and retrying
break; // still some trying, do it once again

else
return UDPRECTIMEOUT; // otherwise give up
}
}

if (udpResult == 0 || udpResult == -1)
return TIMEOUT_EMPTY_DGRAM // timeout on receive or empty datagram

if (udpResult < -1)
return READERROR;

This works for me without any problems. I am using a Wavecom GPRS module, but with
hardware protocol enabled (this may also be a problem in your case).

Hope it helps,

Lix


Memfault State of IoT Report