cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Adventurer
Adventurer
14,420 Views
Registered: ‎09-16-2009

Spartan 6 or Spartan 3E

LOOKING FOR HELP!!!!

 

I've been working on the same project for about 3 months now and have gotten no where.  I'm trying to create a communitcation betwen my PC and FPGA board.  I would like to send packets of data with information.  My initial idea is just to have some type of gui on the computer that will send "Hello World" to the board and the board can respond.  This would give me access to send and receive data back and forth.  Any help would appreciated and step by step as you can see thats what I need at this point.

0 Kudos
Reply
43 Replies
Visitor
Visitor
7,469 Views
Registered: ‎04-25-2011

Hi cfgmgr,

 

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.

 

Thanks!

0 Kudos
Reply
Visitor
Visitor
7,443 Views
Registered: ‎04-25-2011

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.

 

Thanks!

 

 

0 Kudos
Reply
Visitor
Visitor
7,442 Views
Registered: ‎04-25-2011

main.c and echo.c could be found in the attached document.

 

0 Kudos
Reply
Contributor
Contributor
7,431 Views
Registered: ‎09-28-2009

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! 
 

0 Kudos
Reply
Visitor
Visitor
7,423 Views
Registered: ‎04-25-2011

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:

 

http://forums.xilinx.com/t5/EDK-and-Platform-Studio/MicroBlaze-lwIP-Echo-Server-Application-on-Spartan-3E-Rel-11-4/td-p/58138

 

Anyways, thanks a real lot for all your inputs and prompt responses.

0 Kudos
Reply
Visitor
Visitor
7,422 Views
Registered: ‎04-25-2011

Anyone else facing this issue and using Xilinx 11.1 version and Spartan-3E board, try taking a look at this page:

http://forums.xilinx.com/t5/EDK-and-Platform-Studio/MicroBlaze-lwIP-Echo-Server-Application-on-Spartan-3E-Rel-11-4/td-p/58138

 

It worked for me.

Thanks!

0 Kudos
Reply
Visitor
Visitor
7,407 Views
Registered: ‎04-25-2011

Hi,

 

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.

 

Thanks!

0 Kudos
Reply
Contributor
Contributor
7,394 Views
Registered: ‎09-28-2009

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.

0 Kudos
Reply
Visitor
Visitor
7,386 Views
Registered: ‎04-25-2011

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?

 

Thanks!

0 Kudos
Reply
Visitor
Visitor
7,366 Views
Registered: ‎04-25-2011

Hi,

 

Could someone reply to my previous query?

 

Thanks!

0 Kudos
Reply
Visitor
Visitor
4,095 Views
Registered: ‎04-25-2011

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.

 

Thanks!

0 Kudos
Reply
Instructor
Instructor
4,088 Views
Registered: ‎07-21-2009

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

SIGNATURE:
README for newbies is here: http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

Summary:
1. Read the manual or user guide. Have you read the manual? Can you find the manual?
2. Search the forums (and search the web) for similar topics.
3. Do not post the same question on multiple forums.
4. Do not post a new topic or question on someone else's thread, start a new thread!
5. Students: Copying code is not the same as learning to design.
6 "It does not work" is not a question which can be answered. Provide useful details (with webpage, datasheet links, please).
7. You are not charged extra fees for comments in your code.
8. I am not paid for forum posts. If I write a good post, then I have been good for nothing.
0 Kudos
Reply
Contributor
Contributor
4,077 Views
Registered: ‎09-28-2009

>> 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). 

 

0 Kudos
Reply
3,767 Views
Registered: ‎04-28-2012

hi 

 

Tags (1)
0 Kudos
Reply