Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Function of UDP in tcp/ip stack :

Status
Not open for further replies.

nikhilrajg

Member level 3
Joined
Mar 2, 2012
Messages
63
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Manipal,Karnataka,India
Activity points
1,834
Hello all,

I want to send data packets using UDP.. But I am not sure about it. Can anyone help..
How exactly the code or the logic flows ?
As I Could see there are many functions in UDP.c under stack source codes. which functions will be suitable for sending data packets ?

Thank you.
Nikhil Raj
 

Hello Bigdog,

Thanks for your reply.
To what microcontroller and stack source are you referring?

BigDog

I am using PIC24FJ128GA010 MCU with Explorer-16 Board. And I am using TCP stack version v5.10 and C30 compiler.
And ZG2100 wi-fi module.

Want to know how to send data packets using UDP to the remote router.

Thank you.
Nikhil Raj
 

Have you examined the following application note?

Reference: Microchip AN833 The Microchip TCP/IP Stack, Section: User Datagram Protocol (UDP), Page: 61

User Datagram Protocol (UDP)

The UDP layer of the Microchip TCP/IP Stack is imple- mented by the file “UDP.c”. The header file
“UDP.h” defines the services provided by the layer. In this stack architecture, UDP is an active
layer. It fetches UDP packets and notifies corresponding UDP socket of data arrival or
transmission. The UDP module is imple- mented as a cooperative task, performing automatic
operations without the knowledge of the main application.

“UDP.h” provides UDP socket services and hides all UDP packet handling from the caller. The layer
allows up to 254 UDP sockets (the number limited only by available memory and compiler used). With
more than one socket, higher level applications can maintain mul- tiple simultaneous UDP
connections; more than one application could be using this layer. It is important to know that
each socket consumes approximately 19 bytes (check “UDP.h” file for actual consumption)
and increases overall UDP processing time.

Unlike other socket implementations, all sockets in the Microchip TCP/IP Stack share one or more
common transmit buffers. This approach reduces overall RAM requirements, but it may create a
potential problem, where a few sockets reserve all available transmit buffers and do not release
them on time for other sockets to use. Under these circumstances, remote
hosts and/or local applications would not be able to contact the stack. To avoid this, users must
make sure that there are enough transmit buffers for all sockets.

On the receive side, there is only one receive buffer. If a socket receives its data, the owner of
that socket must fetch and discard the receive buffer in one task time in order for the other
sockets to receive their data. This design mandates that once a task detects a packet it is
interested in, it must consume the complete packet in one task time. A task cannot fetch part of a
packet during one task time and expect to fetch the rest of the packet later.

The UDP specifications do not mandate that checksum calculation be performed on UDP packets. To
reduce overall program and data memory requirements, the Microchip TCP/IP Stack does not implement
UDP checksum calculation; instead, it sets the checksum fields to zero to indicate that no checksum
calculation is performed. This design decision requires that all modules utilizing the UDP module
ensure their data
integrity.

The above section also discusses each of the UDP routines and provides examples of their use, along with some sample applications.

AN833 Source Code

The above source code was initially written for C18 and PIC18F, however you should be able to adapt it to the PIC24 family.

You can also use the TCP/IP Configuration Utility found in the Utilities directory within TCP/IP Stack directory:

TCP/IP Configuration Utility


BigDog
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top