I tried your method. I am not lucky...
I went back to xilnet and it works. I am so glad to make it work after 3 weeks of struggling. now, what I have to do is to increase the speed.
thanks for the reply!
On 10/8/06, Mumtaz Ahmad <[EMAIL PROTECTED]> wrote:
I also did got this problem ,though it gets resolved by having some delay after sending first UDP packet .------- Original Message -----From: Haori YangSent: Monday, October 09, 2006 8:25 AMSubject: [lwip-users] sending out udp, receiving arp?Hi, there
the goal of this design is to implement a UDP client on fpga, sending data out to a PC, connected by a crossover ethernet cable.
I download the following source into my xilinx virtex4 fpga (avnet virtex4LX evaluation board.) I had two problems.
first, the mem_malloc function doesn't work. is this related to how I configure the memory of the fpga? say, where the program starts?
I bypass this problem, somehow.
second, I use "Colasoft Capsa" to monitor the packets I received at the PC end. the software gives out the content received. it seems to be arp packet instead udp packet. I am a newbie, but is this right?
the packet has such a structure:
dest. mac addr
src. mac addr
protocol: 0x0806
hardware type: 0x01
protocol type: 0x0800
hardware addr. len.: 6
protocol addr. len :4
type: 1
src mac:
src. ip
dest mac
dest ip
data:
fcs:
The code is below. any suggestion is appreciated. thanks.
#include " xparameters.h"
/* lwIP Includes */
#include "netif/xemacif.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/memp.h"
#include "lwip/mem.h"
#include "netif/etharp.h"
#include "lwip/sys.h"
#include "lwip/netif.h"
#include "stdio.h"
#include <mfs_config.h> // this file references memory specified in library/os parameters ...vg
extern XEmacIf_Config XEmacIf_ConfigTable[];
int main(void)
{
struct udp_pcb *local_pcb;
struct udp_pcb *remote_pcb;
struct ip_addr ipaddr, netmask, gateway, remoteip;
struct netif *default_netif;
unsigned char fullmac[6] = {0x00, 0x0A, 0x35, 0x00, 0x22, 0x38};
unsigned char ip_address[4] = {149,199,6,108};
unsigned char ip_remote[4] = {149,199,6,107};
unsigned char subnet[4] = {255,255,255,0};
unsigned char gateway_addr[4] = {149,199,6,254};
struct pbuf *p;
void *tmpPtr;
unsigned char buffer[4096] = "beetje flauw\n";
unsigned char *buffPtr;
u16_t port = 8080;
print("beginning of the code\n");
print("initialize memory\n");
buffPtr = mem_malloc(sizeof(buffer));
if (buffPtr == NULL)
print("memory not allocated");
print("memory allocated\n");
memcpy(buffPtr, buffer, sizeof(buffer)); //copy's from buffer to buffer
print("memory copied\n");
//mfs_init_fs(MFS_NUMBYTES, (char*) MFS_BASE_ADDRESS, MFS_INIT_TYPE);
//mfs_init_fs(25*sizeof(struct mfs_file_block), (char*) mfs_file_system, MFS_INIT_TYPE)
sys_init();
mem_init();
memp_init();
pbuf_init();
print("done with init: sys, mem, memp, pbuf\n");
unsigned int init_wait = 15000000;
while(init_wait--);
xemacif_setmac(0, (u8_t *)fullmac);
IP4_ADDR(&ipaddr, ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gateway, gateway_addr[0], gateway_addr[1], gateway_addr[2], gateway_addr[3]);
IP4_ADDR(&remoteip, ip_remote[0], ip_remote[1], ip_remote[2], ip_remote[3]);
netif_init();
ip_init();
udp_init();
print("done with init: netif, ip, udp\n");
default_netif = (struct netif *)mem_malloc(sizeof(struct netif));
default_netif = netif_add(default_netif,
&ipaddr,
&netmask,
&gateway,
&XEmacIf_ConfigTable[0],
xemacif_init,
ip_input);
netif_set_default(default_netif);
print("set default netif\n");
//local_pcb = udp_new();
remote_pcb = udp_new();
udp_bind(remote_pcb, &ipaddr, port);
print("udp bound\n");
udp_connect(remote_pcb, &remoteip, port);
print("udp connected\n");
p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
if (p== NULL)
print("pbuf not allocated");
print("pbuf allocated\n");
p->payload = buffer;
//p = pbuf_alloc(PBUF_TRANSPORT,4096,PBUF_RAM);
int i;
for (;;)
{
// print("prepare sending\n");
udp_send(remote_pcb, p);
// print("packet sent!\n");
//for (i = 0; i<10000; i++);
}
pbuf_free(p);
return 0;
}
This message has been scanned for viruses and
dangerous content by Streaming Networks, and is
believed to be clean.
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users
--
This message has been scanned for viruses and
dangerous content by Streaming Networks, and is
believed to be clean.
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
