12-09-2009 04:10 PM
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.
12-09-2009 06:23 PM
12-10-2009 08:11 AM
WHat type of electrical interface are you trying to use between the PC and the FPGA?
Printer Port? RS232? USB? Ethernet?
RS232 is probably the easiest, but alo the slowest.
You need to be a bit more specific about what your requirements are. High Speed? Long
cable between devices?
Good Luck
John Providenza
12-10-2009 08:27 AM
12-10-2009 08:29 AM
I want to send ethernet packets (TCP/IP) back and forth to the computer via ethernet RJ45 connector. The connection length is physically a short distance.
12-10-2009 08:55 AM
I think you have an interesting learning opportunity in front of you. You need to remember
that FPGAs are basically a bunch of logic gates and, in the case of newer FPGAs like the
Spartan6, some macro blocks.
So to make a change, you need to understand how to design logic that gets converted to
gates by a synthesizer (or you can directly decribe the logic with schematics). Two
common design languages for designing hardware Verilog and VHDL. Simulators exist
for both languages so you can test your designs before actually turning them into gates and
downloading them into the FPGA.
You may also need to learn about programming the PicoBlaze processor since it is used in the
sample design, but you don't need the EDK for that.
These are not tough problems, but if you're new to FPGAs and h/w design in general, this could be
a ambitious starter project.
John Providenza
12-10-2009 09:19 AM
12-10-2009 10:36 AM
It sounds like you are attempting some simple designs, but trying to make it very complicated.
If you just want to see the results of your Frequency counters, then I would suggest that you add a ChipScope VIO core on the output of the counters and then you can display the results in ChipScope. ChipScope can display a wide variety of radix formats include converting signed/unsigned values that are scaled, offset and with different precisions. I have similar design that take a 20-bit value, multiple by 0.0016 and then displays the results with 3 digits of precision.
Ethernet and TCP/IP has a lot of overhead and is complicated. If you don't have EDK I would not suggest that you go down this path any further.
The SP601 includes a USB-to-UART CP2103 controller. You could use this to pass your data back and forth. I believe that the PicoBlaze examples include an RS-232 example that you can start from.
12-10-2009 11:52 AM
If you really want to go the ethernet communication route, then I would suggest that you download the EDK (there is a 30-day trial version). It will save you a lot of effort.
With the EDK, you could build up a system that uses the ethernet port and your custom IP for reading counters. Then, with the SDK, you could generate a Microblaze lwIP "echoserver" test application, which you could use as a starting point to develop your own TCP/IP or UDP communication with your PC. The next step would be to get your custom IP to communicate it's results to the Microblaze application so that the FPGA board could send the counter values over ethernet. You could do this via PLB, FSL or master/slave registers.
It will take some time, but that will definitely be easier than trying to roll our own ethernet support.
-bill
01-04-2010 04:55 AM
hello sir,
i am a b.tech student.
Now i have a similar project as yours(as that of 'ntropy').I have to communicate data from the pc to the board using the ethernet port. I m an amateur in this project. CAN I GET STEP BY STEP GUIDELINES WITH THIS PROJECT. OR ANY MOST SUITABLE LINK. please.
•••••••••
01-04-2010 05:01 AM
hello sir,
i am a b.tech student.
I have to communicate data from the pc to the board using the ethernet port. I m an amateur in this project. CAN I GET STEP BY STEP GUIDELINES ON THIS PROJECT. OR ANY MOST SUITABLE LINK. like can u please tell me completely about this project. or a link where i could get information right from the basics. please sir.
•••••••••
01-04-2010 06:13 AM
Which board are you using? Will you be using the EDK?
We may need a bit more information before we can be of much help!
01-04-2010 09:30 AM
01-04-2010 10:36 PM
i am using SPARTAN 3A kit and coding with vhdl ..
01-05-2010 06:34 AM
I used a 3E starter kit, but I imagine it's probably similar for the 3A. Since you really didn't say, I am assuming that you are using the EDK. Develop your own ethernet IP without the EDK can be done, but it's more work. These steps are based on EDK Version 11.3:
It's a two-part process: You use "XPS" to develop the "hardware platform", and you use the "SDK" to develop C code to run on that platform.
Part 1: XPS -
1) Launch XPS and use the wizard to create a new BSB project base on your board type
2) Choose a single processor system (1 microblaze processor)
3) Choose 16K of local memory, leave the system clock frequency at the default. Do not enable floating point unit
4) On the "peripheral configuration screen", de-select (REMOVE) most of the default peripherals (e.g. you don't need LEDs, buttons, flash, dip switches, etc). I kept only the Ethernet MAC and the SDRAM, the RS232_DCE, dlmb_cntrl and ilmb_cntrlr. Also, make sure to check the "enable interrupts" properties for the Ethernet MAC.
5) On the same screen, ADD the "xps_timer" peripheral, and check the "use interrupt" property of the timer.
6) On the next screen, you can decide if you want instruction or data caches. Not really needed for this demo, but definitely needed in a real-world scenario if you want any kind of performance...
7) Keep hitting the "Next" button until you reach the "Finish" button. You are now done with the wizard.
At this point, click on the "Project" menu item and click on "Export Hardware Design to SDK"; Choose "Export and Launch SDK" option.
Now wait... and wait..... and wait.... while the project builds. You might have time for lunch. These tools are extremely slow... A whole lot of warnings will scroll by. You can ignore these for now. You should NOT get any errors; warnings you can ignore for now, but errors cannot be ignored.
If all goes well, eventually, the SDK will launch. You will use the SDK to write your C-code that runs on the Microblaze processor.
Part 2: The SDK:
1) In the SDK, right click on the Microblaze_0 object, select "New", then "other", then select a "standalone" type of software platform.
2) Next right-click on the new software platform object you just created, and go to teh "Software Platform settings" menu option.
3) At the bottom of the software platfor settings screen, check the "lwip" library. This will cause teh platform to rebuild and include the "lwip" library.
4) Next, right-click on the software platform object, and select "New|Project|Managed Make C application project". From this dialog box, select the "lwIP Echo Server" application.
5) The application will compile.
At this point, you can download the application to the test board. The echo server will use TCP/IP address 192.168.1.10, port 7; 10Mbit ot 100Mbit only - Gigabit doesn't work;
Connect up the ethernet cable (use a crossover cable if you are not using a network switch), start up a hyperterm session and it should all just work.
I hope this helps.
-bill
01-05-2010 09:17 AM
01-05-2010 10:21 AM
Make sure you have your "echo" application object selected when right-click and try to debug.
If that doesn;t work, try regenerating the .ELF file by either changing one of the source files (e.g. add a blank line to main.c),
or by right-clicking on the application object, and selecting "Generate Linker Script".
01-05-2010 10:21 PM
thanks a lot cfgmgr.. i vl try implementing it the same way and will update as my project progresses ..
thanks a tonne for the step by step explanation
01-06-2010 09:01 AM
Going through the steps as specified, I'm encoutering an error when the Software Platform adds the lwip library in SDK. The follwoing errors are received:
ERROR:EDK:3193 - issued from TCL procedure "lwip_elite_hw_drc" line 5
lwip130 () - xps_ethernetlite core Ethernet_MAC does not have its interrupt
connected to interrupt controller. lwIP operates only in interrupt mode, so
please connect the interrupt port to the interrupt controller.
ERROR:EDK:1191 - Error(s) while running DRCs for processor microblaze_0.
make: *** [microblaze_0/lib/libxil.a] Error 2
make: Target `all' not remade because of errors.
Any advice would be helpful.
01-06-2010 09:10 AM
In XPS:
1) make certain that you enabled interrupts on the ethernet MAC (see earlier - Part 1, step 4)
2) make sure that you added a timer to your project, and enabled the interrupts for that as well (Part 1, step 5)
01-06-2010 12:49 PM
Thank you for the help. I was able to run the program and the serial out I receive is:
-----lwIP TCP echo server ------
TCP packets sent to port 6001 will be echoed back
Board IP: 192.168.1.10
Netmask : 255.255.255.0
Gateway : 192.168.1.1
tcp echo server started @ port 7
Where would I be able to have a user input a send and receive message to echo to/from the board?
01-06-2010 12:56 PM
Use a terminal emulation application like HyperTerm or equivalent - (HyperTerm comes with Windows XP).
Setup Hyperterm to use the WinSock (instead of a COM port). Set the host IP address to the board's address (e.g. 192.168.1.10), and set the port number to port 7.
Then, whatever you type into Hyperterm should get sent to the FPGA board, and the board will echo the characters back to you.
01-06-2010 01:06 PM
I received the following error when I tried to connect via HyperTerminal:
"Unable to connect to 192.168.1.10 port 7"
01-06-2010 01:34 PM
Check the obvious things:
1) Make sure the FPGA board is running the app before attempting to connect.
2) Make sure you can ping 192.168.1.10. If you can't ping it, hyperterm wont work either. If you can't ping, make sure that 192.168.1.10 is reachable from your PC - (e.g. is your PC address in this range?)
3) Is there a switch or hub in the network path? If you connect directly from your PC to the board, I would suggest a crossover cable.
4) Make sure your PC isn't trying to negotiate a connection at 1GB. The FPGA board is 10/100 only.
Keep trying - the app does work!
01-06-2010 02:31 PM
Bill,
I've gone through the items listed and have the follow results:
1) Make sure the FPGA board is running the app before attempting to connect.
Com port (rs232 serial port) displays output message. XMD indicates Running.
2) Make sure you can ping 192.168.1.10. If you can't ping it, hyperterm wont work either. If you can't ping, make sure that 192.168.1.10 is reachable from your PC - (e.g. is your PC address in this range?)
I tried ping the IP address, but the message indicates that "Destination host unreachable"
3) Is there a switch or hub in the network path? If you connect directly from your PC to the board, I would suggest a crossover cable.
The current setup is the PC connected directly to the FPGA with a crossover cable.
4) Make sure your PC isn't trying to negotiate a connection at 1GB. The FPGA board is 10/100 only.
Speed is 100.Mbps
Once again your help is greatly appreciated.
01-07-2010 05:43 AM
Ntropy,
If you are getting "Destination host unreachable" then this usually indicates that your PC address is not in the same address range as the device you are trying to "ping". To figure out what your IP address is on a Windows PC, open a DOS box (command prompt) and type "ipconfig" (on a Linux box, I think the command is "ifconfig"). Look at your address - I'll bet it's not quite in the range of "192.168.1.X".
Try changing your PC's NIC address to something like "192.168.1.2". If you can't change your PC's address, then you can always change the address that the FPGA board supplies, so that it's in the range of your PC. To do that, just go in the echoserver code (main.c), and change the lines that assign the IP address (look for a line that reads something like IP4_ADDR(&ipaddr, 192, 168,1,10)). Just change it to a value that is in the range of your PC. For example, if your PC address is 172.16.0.36, then try changing the FPGA address to 172.16.0.40 - you get the idea.
-bill
03-04-2011 03:25 AM
Hi everyone..we are working hard on this echoserver for a week long.i have gone through all the steps as being mentioned by bill.All the steps are working fine.I have downloaded it to the board.But as i am opening the hyperterminal,the same old message displays "Unable to connect to 172.16.1.100 port 7". i had changed the ip address of the board so to match my pc is range which is "172.16.1.99".I am using spartan 3E.any sort of help will be highly appreciated.
03-16-2011 12:10 PM
04-25-2011 10:22 PM
Hi,
We are trying to establish a connection between the host computer and Spartan 3E Starter kit (Rev D) using the in-built lwIP stack.
The IP addresses of the the host computer and the FPGA has been changed appropriately (192.168.1.10 for FPGA and 192.168.1.11 for PC). When the application is run on SDK, we get the following message on Hyperterminal:
The LED on either end seem to glow properly. However, we consistently get a "Destination host unreachable" message when we try to ping or telnet to FPGA's IP address 192.168.1.10.
We haven't changed any of the Phy or Mac configurations.
Could you please let us know what could be the problem? Really appreciate your help in this regard.
Thanks!
04-26-2011 05:54 AM
Hmmm... it certainly SOUNDS like you did everything right...
Since there are two potential sources of problems (the PC and the FPGA board),
I guess I would first try ruling out 1/2 of the sources by connecting your PC
to another PC that has been set to the same IP address as the FPGA card.
If you can get a telnet session going between these two PCs, then it would appear
that the problem is with the FPGA board. If not, then the problem is on the PC
side.
If you suspect that it's the FPGA side, go back to teh previous posts and carefully
retrace the steps. Especially make sure that you have interrupts enabled on FPGA
card, make sure you have a timer assigned, etc. Try using a crossover cable, etc.
Also, try downloading a copy of Wireshark - that can sometimes help. When you
look in wireshark, you should be able to see the FPGA board send out a gratuitous
ARP packet when the application first starts up. If you don't see that, then
you may need to dig down a bit deeper to see if you missed any steps during the
project setup.
Finally, there are a some debuig options that you can enable in lwip to help
trace the program execution.