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.

Setting up Ethernet in FPGA

Status
Not open for further replies.

jdhar

Full Member level 5
Full Member level 5
Joined
Aug 16, 2004
Messages
258
Helped
16
Reputation
32
Reaction score
2
Trophy points
1,298
Activity points
2,753
I am working on my project with an Altera Cyclone and National Semi. 10/100 PHY. I have successfully sent loopback packets using an IP MAC on the FPGA. My goal (for now) is to basically send packets to my laptop, and to eventually be able to telnet into the FPGA. I need help with the frame that I should send out from the FPGA.

1) What level of the network model do I need to go up to? I was thinking if I have an IPV4 header (level 3) with the destination IP of my laptop, and a source IP for the FPGA (made up), and some junk data, this should be enough?
2) Can I just make up the MAC address and source IP address of the FPGA in the IPV4 and Ethernet headers?
3) What would I have to change if I were to plug my FPGA into a router and still try to get into my laptop

I am just hoping to run a sniffer of some sort on my laptop and see if packets successfully came in. Do I need to use another layer (ICMP for eg.) for this?
 

Ethernet with FPGA

Hello jdhar,

Good work that you have brought some live into your project. Did you wrote your IP MAC by yourself or did you take a ready one for example from Opencores? Do you want to implement all upper layers in hardware (VHDL/Verilog) or do you want to use a soft-processor like the Nios II for that stuff. Using a soft-processor in conjunction with a ready TCP/IP stack (e.g. lwip) would be the “easy” way. It will be harder to implement the stuff in hardware.

A very good tool for capturing the network traffic is Ethereal (https://www.ethereal.com/).


Bye,
cube007
 
Re: Ethernet with FPGA

Telnet is up to TCP application layer , so it is very hard to do it with HW and very costy, u should stick with the TCP stack and processor idea, much easier and will save a lot of effort, one other thing ICMP is a network layer protocol it can be handle with TCP stack.
 

Re: Ethernet with FPGA

The VIRTEX 4 FX has a ethernet module built in and if you get the memtec module there is an app ready to go !.(i belive that others manufactures also offer it)
 

Re: Ethernet with FPGA

Good work that you have brought some live into your project. Did you wrote your IP MAC by yourself or did you take a ready one for example from Opencores? Do you want to implement all upper layers in hardware (VHDL/Verilog) or do you want to use a soft-processor like the Nios II for that stuff. Using a soft-processor in conjunction with a ready TCP/IP stack (e.g. lwip) would be the “easy” way. It will be harder to implement the stuff in hardware.

A very good tool for capturing the network traffic is Ethereal (h**p://www.ethereal.com/).

Thanks! I guess I should have clarified all of this. I am using the Ethernet MAC provided with Protel DXP's suite, along with their Tasking 51X processor (I'm using C-code). So I would prefer NOT doing any upper-level stuff in a HDL.

Also, I would love to use Ethereal for this. So I will go back to one of my original questions - is going to the IPV4 layer enough, or do I have to go one more in order to get Ethereal to see packets?

Telnet is up to TCP application layer , so it is very hard to do it with HW and very costy, u should stick with the TCP stack and processor idea, much easier and will save a lot of effort, one other thing ICMP is a network layer protocol it can be handle with TCP stack.

I agree, which is why I'm trying this with a processor on the FPGA

The VIRTEX 4 FX has a ethernet module built in and if you get the memtec module there is an app ready to go !.(i belive that others manufactures also offer it)

Great, however, Im' not sure forking out $1000+ just for the FPGA is the answer to my solution, considering I have already carefully designed around the Cyclone and have a board fabbed in front of me.
 

Re: Ethernet with FPGA

No ,nO .NOT $1000 .. memec mini module is just $250 and it comes with DRAM,FLASH and the thernet connector .. The VIRTEX 4 FX has a CPU ..
so all ready for LINUX!
 

Re: Ethernet with FPGA

Hello jdhar,

Also, I would love to use Ethereal for this. So I will go back to one of my original questions - is going to the IPV4 layer enough, or do I have to go one more in order to get Ethereal to see packets?

It might be possible that my following answer is not the one you would like to have. That’s because I didn’t understand the whole question – I should improve my English!
Ethereal will show you all packets which are on the line. The packets will be captured in real-time. Just download and install the tool. It’s really great.

Bye,
cube007
 

Re: Ethernet with FPGA

Ok, let me rephrase my question so I can hopefully make it clearer:

What is the packet that I have to send from the FPGA to my laptop in order for the laptop to recognize that it is the intended destination???

What I was thinking was:

<Destination MAC Address (the laptops)>
<Source MAC Address (some fake one)>
<Length/Type>

--Start of IPV4 header--

<Version/IHL>
<Type of Service>
<Total length>
<ID>
<Fragmentation and Flags>
<TTL>
<Protocol> <= WHAT DO I PUT HERE?
<Checksum>
<Source IP> <= Is a fake IP ok?
<Destination IP> <= The IP of the laptop
<Data>

If I send this header out, will my laptop recognize that it's the destination, or do I need to add another layer to this packet??
 

Ethernet with FPGA

Hello jdhar,

If I understand you correctly you are looking for a protocol which tells your laptop that you FPGA is reachable with a defined MAC address and a defined IP address. This can be done with the ARP (address resolution protocol). The ARP mechanism maps the MAC address (which must be unique in the whole world) to the corresponding IP address. All that stuff will be done by a TCP/IP stack. Now, do you want to make the stack by your own?


Bye,
cube007
 

Ethernet with FPGA

Thanks for your help cube... I am basically writing the stack on my own, one level at a time, and learning quite a bit. right now, I have all of the ethernet, IP, UDP and ARP layers implemented successfully. I do have one question for you or anyone else however - my board is connected to my router, and hte light on the router is blinking like mad, almost like it's constantly sending packets to my board. However, I can see al lthe incoming packets, and none of them are from the router, and definitely not at that rate. I know my board's Tx and Rx works since I am sending and receiving ARP and UDP data to other computers on my network. Could this be a DHCP thing?
 

Ethernet with FPGA

Dear jdhar,
Using Cyclone, OK? I have never used Altera in action however,
Why not to use NIOS embedded processor and then run a small linux on it. after that may be you can have what you are looking for.
Your FPGA will basically become a simple computer.
 

Re: Ethernet with FPGA

Hello jhar,

jdhar said:
my board is connected to my router, and hte light on the router is blinking like mad, almost like it's constantly sending packets to my board. However, I can see al lthe incoming packets, and none of them are from the router, and definitely not at that rate. I know my board's Tx and Rx works since I am sending and receiving ARP and UDP data to other computers on my network. Could this be a DHCP thing?

It is possible that your OS (Windows/Linux) is sending a lot of packets to find out if there are other connected PCs. You can easily find what on the line with Ethereal. Did you install the tool?



Hello mami_hacky,

mami_hacky said:
Why not to use NIOS embedded processor and then run a
small linux on it. after that may be you can have what you are looking for.

Jdhar wrote that he is using a soft-processor, so he is using the FPGA like a “simple computer”:

jdhar said:
Thanks! I guess I should have clarified all of this. I am using the Ethernet MAC provided with Protel DXP's suite, along with their Tasking 51X processor (I'm using C-code). So I would prefer NOT doing any upper-level stuff in a HDL.
 

Ethernet with FPGA

It is possible that your OS (Windows/Linux) is sending a lot of packets to find out if there are other connected PCs. You can easily find what on the line with Ethereal. Did you install the tool?
hey cube - I don't think this is it- Yes, I have installed Ethereal, but the light that is blinking is the port on which my board is connected. So it either means that there are a lot of packets being sent to my board that DONT have my MAC address (or broadcast) since I'm watching all received packets, OR, my board needs to do some negotiation with the router to make the router happy. Any help with this?
 

Ethernet with FPGA

Is only one router light blinking (the link to your board)? I would expect to see two blinking lights, unless your weird traffic is being generated by the router, like this experience:

At my old job, my Windows PC was connected to our company's big HP switch. The connection worked fine, but for some reason, the HP switch kept sending me a continuous stream of some sort of router-to-router control packets. They were small packets, but about 15 per second. I got tired of them flooding my Ethereal display, so I bought a small LinkSys switch and put it between my computer and the HP switch. It filtered out those annoying packets.
 

Ethernet with FPGA

That's what I'm afraid of, some weird control packets that are bombarding my board. Unfortunately, I can't run anything like Ethereal on there, but whatever it's sending it is not being recognized by my MAC - meaning that it's not a broadcast packet, or a packet from any other computer since it's just the one port.. I basically have no way of seeing what is going on that line (and it does seem to be >10 blinks per second.. interestingly enough). Any suggestions on how to find out what I should send to make my router happy?
 

Re: Ethernet with FPGA

I belive that if ethereal can not capture any data on link then there is a problem with your MAC, are u using a soft or hardware MAC?

I believe may be the your MAC didn't generate a proper Frame, or may be it comes from the higher level protocol like LLC or IP, the MAC address is 48 bit with the first two bits indicating the broadcast and local, 22-bits OUI, 24 Vendor specific, may be u are not using a proper address which is less common to happen.

May be also u may configure your FPGA TCP stack IP address so it should be in the same network as your computer.
I am not sure but I believe that ethreal can sniff any L2 data on the ethernet cable, including some standards like ARP, DHCP ... etc regardless of any IP address maintenenace.
 

Re: Ethernet with FPGA

bibo1978 said:
I belive that if ethereal can not capture any data on link then there is a problem with your MAC, are u using a soft or hardware MAC?

I believe may be the your MAC didn't generate a proper Frame, or may be it comes from the higher level protocol like LLC or IP, the MAC address is 48 bit with the first two bits indicating the broadcast and local, 22-bits OUI, 24 Vendor specific, may be u are not using a proper address which is less common to happen.

May be also u may configure your FPGA TCP stack IP address so it should be in the same network as your computer.
I am not sure but I believe that ethreal can sniff any L2 data on the ethernet cable, including some standards like ARP, DHCP ... etc regardless of any IP address maintenenace.

Ok, I think there may be a misunderstanding here. I can run Ethereal on any PC on the network, but Ethereal can only sniff packets that are destined for the PC that is running on, correct? Meaning it can only detect broadcast packets or packets where the destination MAC is the same as the PC's MAC... Ethereal can only help me debug messages that are going from my PC to my board, or my board to a PC.. and there are no problems here. I can send packets both ways fine, and capture them on Ethereal. I do'nt see how Ethereal can capture packets somewhere else on the network since they don't get past the NIC unless the MAC address matches...

But aside from that, this light is blinking continuously. My board isn't sending any packets out, and it's still blinking. This is why I'm thinking it's some physical layer problem - the schematics for my board are here:
**broken link removed**

It may be my termination scheme, since I'm not using controlled impedance.. and that's somehow throwing the router off. When I hook up the board to my laptop using a crossover cable, there are no crazy blinking lights, and all packets are transferred fine.

As for those 'links'.. I do'nt know why people think that switching to another platform completely or buying a new product is the solution to a problem when I have already spent lots of time developing this board :s Thx for those who did help though!
 

Re: Ethernet with FPGA

In fact ethreal can sniff all data on the network and if it doesn't sniff except multi, broad or destinated to u MAC address this may be because the device is directly connected to a switch or dual-speed hup If your machine is not plugged into a switched network or a dual-speed hub, or it is plugged into a switched network but the port is set up to have all traffic replicated to it, the problem might be that the network interface on which you're capturing doesn't support "promiscuous" mode, or because your OS can't put the interface into promiscuous mode. Normally, network interfaces supply to the host only.
Most network interfaces can also be put in "promiscuous" mode, in which they supply to the host all network packets they see. Ethereal will try to put the interface on which it's capturing into promiscuous mode unless the "Capture packets in promiscuous mode" option is turned off in the "Capture Options" dialog box, and Tethereal will try to put the interface on which it's capturing into promiscuous mode unless the -p option was specified. However, some network interfaces don't support promiscuous mode, and some OSes might not allow interfaces to be put into promiscuous mode
Still may be u have a physical error, but sure ethreal can sniff data from network rather than destined data, "that is what a sniffer do"!!
 

Re: Ethernet with FPGA

jai

according to my experience on ethernet, first you should have a look at the wave form on the RJ-45 pins to see whether they seems to be OK, find the bugs in vhdl is the second stage. make sure there's no physical connection problem.

write stack on 51 is boring. I had done to IP layer and single socket TCP layer. but I think it's almost impossible to apply full tcp stack on 8051.

mike
 

Ethernet with FPGA

In fact ethreal can sniff all data on the network and if it doesn't sniff except multi, broad or destinated to u MAC address this may be because the device is directly connected to a switch or dual-speed hup If your machine is not plugged into a switched network or a dual-speed hub, or it is plugged into a switched network but the port is set up to have all traffic replicated to it, the problem might be that the network interface on which you're capturing doesn't support "promiscuous" mode, or because your OS can't put the interface into promiscuous mode. Normally, network interfaces supply to the host only.
Most network interfaces can also be put in "promiscuous" mode, in which they supply to the host all network packets they see. Ethereal will try to put the interface on which it's capturing into promiscuous mode unless the "Capture packets in promiscuous mode" option is turned off in the "Capture Options" dialog box, and Tethereal will try to put the interface on which it's capturing into promiscuous mode unless the -p option was specified. However, some network interfaces don't support promiscuous mode, and some OSes might not allow interfaces to be put into promiscuous mode
Still may be u have a physical error, but sure ethreal can sniff data from network rather than destined data, "that is what a sniffer do"!!

Thanks for the ifno bibo, I wasn't aware of promiscuous mode. However, either my OS (Windows XP) or my NIC doesn't support it, because Promiscuous mode doesn't show me anything else that I don't already see.

according to my experience on ethernet, first you should have a look at the wave form on the RJ-45 pins to see whether they seems to be OK, find the bugs in vhdl is the second stage. make sure there's no physical connection problem.

write stack on 51 is boring. I had done to IP layer and single socket TCP layer. but I think it's almost impossible to apply full tcp stack on 8051.

Unfortunately, I don't have a scope available, so I can't see any waveforms on the board currently. There shouldn't be any bugs in VHDL however, because, well, there is no VHDL :) The MAC I am using is an IP core supplied, and the rest is C-code, which is very simple, so I am positive there is no bug here. Even without a stack, just listening to all the packets that come in on the board, I don't see anything that indicates the router is sending packets.

either way I'm not looking to implement a full stack. I have IP, ARP, ICMP and UDP written and working, so that is good enough for me :) I would just really like to figure out why the damn light is blinking a lot.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top