04-27-2011 12:27 AM
Thanks for the quick reply.
Could you kindly clarify the following queries:
* I am using Spartan 3E Starter kit (Rev D) board, Xilinx 11.1 EDK and the lwIP library that comes with it. Are there any version mismatches or incompatability issues with these?
* I had exactly followed the steps as outlined by you in Pg 2 of this thread (thanks a lot that really helped). After including the Echo server, SDK complied it automatically. Then, I had programmed the FPGA (Tools -> Program FPGA). Right-clicked the elf file and gave Run as --> Run on hardware. Is this all fine? Or do I need to do something more?
* As I mentioned earlier, I haven't touch my Mac/Phy configurations or the C programs of lwip and echo_server. My objective now is just to ping and see if the FPGA responds to the PC's request. Is there a need to modify any of the configurations (or C files) to do this?
* My PC to PC p-to-p connection didn't work either. I had used a crossover cable only, I could see the color combinations to be different at both ends. However, I was able to ping the second PC when they were connected through a network switch.
Please do provide pointers for debugging lwip which you mentioned in the previous thread.
I am stuck at this for quite sometime now. Your inputs and suggestions would really help.
04-27-2011 07:32 PM
Hello Mr. cfgmgr,
I was able to get the PC-to-PC direct connection working now.
I probed into the PC-FPGA connection little more using Wireshark. As you mentioned, the first time when the FPGA is programmed, I could see the following packet description in Wireshark:
4 10.180909 dd:00:dd:dd:dd:dd df:dd:dd:dd:dd:dd 0xdddd Ethernet II
5 19.657627 Xilinx_00:01:02 Broadcast ARP Gratuitous ARP for 192.168.1.10 (Request)
The Gratuitous packet request is indeed being sent out by Xilinx_00:01:02 (but I don't think it is being received anywhere). When I ping the board again, I still see the echo (ping) request sent to 192.168.1.10 but no reply from it. I hope I am closer to the problem and your inputs could help.
I would add my main.c and echo.c for any reference in the next comment.
04-28-2011 06:14 AM
If the gratuitous ARP is being sent by the FPGA board, then I would say that
you've done well, and the board is working. The problem might now be on the PC
side (maybe firewall issues?)
Keep wireshark running, and try to ping the FPGA board. Before the ICMP (ping)
packets start to flow, you will usually see an ARP request go from your PC to
the board ("who has address 192.168.1.10? Tell XX.XX.XX.XX"), followed by an ARP
reply from the board back to the PC. If you can see this kind of dialog, then
I think the problem you are having may be firewall related. If, on the other
hand, you see the ARP request go out to the board, but no response back from
the board, then something is probably off just a bit with your board or project.
I'm sorry - I don't have my old 3E board handy anymore, and it's been quite a
while since I worked with it, so I don't recall all the specifics. But I do
remeber that it was a rev D board, and I was using software version 11.3 at the
time. Don't give up! It seems that you are very close to success!
04-28-2011 11:23 AM
Hello Mr. cfgmgr,
It finally worked after my prvious post. Missed to update the thread.
The issue was with the platform.c file where the platform_setup_timer() function was called at the end. This was disbling the interrupts because of which the echo server wasn't able to respond. I changed the calling of this function as suggested in the below mentioned thread and was finally able to establish the connection:
Anyways, thanks a real lot for all your inputs and prompt responses.
04-28-2011 11:24 AM
Anyone else facing this issue and using Xilinx 11.1 version and Spartan-3E board, try taking a look at this page:
It worked for me.
04-28-2011 11:05 PM
I am now trying to add my software program to process the data received from the PC.
I am currently adding it to the transfer_data() function in echo.c. I am using the XEmacLite_RecvFrame API defined for emaclite. Somehow, when I add these additional piece of code, it fails to respond.
Is this the right place to do? Do I need to call any timer functions before doing this?
Could you send me some sample working user code where XEmacLite_RecvFrame is used?
BTW, I would appreciate if someone could educate me what the *FramePtr argument should be for XEmacLite_RecvFrame.
04-29-2011 05:54 AM
Actually, you have some great example code already!
Take a look at your lwip echo server example. You will see that the transfer_data()
is just an empty call. The real framework was setup earlier in the "start_application()"
call a few lines before the endless while(1) loop.
Look through the "start_application()" code inside the "echo.c" file. You will
see in there that a TCP port is created, and there is a callback routine called
"accept_callback()" that will be called when someone connects to the TCP port.
If you look in the "accept_callback()"" routine, you can see that a "recv_callback()"
is setup as well (in the tcp_recv() call), and THAT callback will be invoked when
data comes in on the TCP port. You can write your own callback routines to handle
the received data. And in those callback routines, you can issue a tcp_send()
call to reaply back to the PC if desired.
So in a way, your "transfer_data()" routine can be a main loop, and you can use
callback routines to handle the data transfers to and from the ethernet port.
All these callbacks are really "driven" by a single call to "xemacif_input(netif)"
that is inside the endless "while(1)" loop in main.c (and of course the ISR routines
that are invoked from the emac).
Keep in mind that the echo server example just illustrates a TCP connection. You
can change the code to do UDP instead, for example. If you want to get at the
raw ethernet packets, then just start single-stepping through the "xemac_input()"
call, and you will see all the various routines that are invoked. This will
help give you a better understanding of how it all works.
04-29-2011 08:08 PM
Hi Mr. cfgmgr,
Thanks again for the quick and detailed reply.
I would try to modify the subroutines you mentioned. But my objective is, whatever data I send from PC through the ethernet interface should eventually be received by Microblaze which would then do additional processing.
Going by your approach, would i still need to use XEmacLite_RecvFrame command to transfer the data from the emaclite ethernet core to Microblaze? Have you used this XEmacLite_RecvFrame API?
05-01-2011 04:20 AM
Hello Mr. cfgmgr,
I did the single-stepping as suggested by you but I am kind of lost.
Could you pls tell me which function need to be modified if i had to access whatever data i sent through the PC?
Looking forward for your reply.
05-01-2011 06:52 AM - edited 05-01-2011 07:10 AM
Could someone reply to my previous query?
Much of the support on these forums is from volounteers. It is a weekend, and most of the USA correspondents are at home with their families or sleeping.
-- Bob Elkind
05-02-2011 06:08 AM
>> Could someone reply to my previous query?
At this point I think you are really asking an "lwip" question, not a Xilinx
board question. But again - look at your example source code.
Look in the "echo.c" file - you will see a function called "recv_callback()". This is the function that gets called when data comes in from your PC. "p->payload" will contain the data from the PC. Put a breakpoint there and look at the pbuf structure. Look at the call stack. Restart the application and step the the start_application() procedure to observe how the tcp ports are created, and how the callbacks are used.
Step thru some of the code. Do a file search and see how the various modules
interact with each other. Also, look through the lwip documentation (visit www.lwip.org).
04-28-2012 09:27 AM