• 0
rivermoon

How can I send data from one board to another using LWIP (tcp)?

Question

So I have the artyz7-20 and I want to send data via ethernet using the lwip library to another board (zc706).

How do I go about doing this? I have successfully tested the 'echo server' example on both boards.

Can any one guide me in the right direction?

Any help is appreciated.

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 1
Posted (edited)

@rivermoon

Normally, I'd reply to this question by pointing out that the Ethernet PHY is a great full-duplex point-point communications pipe all by itself; basically a digital modem.

Both of your boards have the Ethernet PHYs connected to the MAC on the PS. You can still connect a cable between the two Ethernet PHYs and send data back and forth. You just need to do it through MACs. This constrains your options in terms flexibility.

Either way you do it, you can't avoid learning the basics of Ethernet including all of the layers. You also need to carefully study the software support that your tools provide in order to figure out what the code generated does; if you want to use that approach.

It is possible to establish a data link between a PC parsing packets as raw data and an FPGA board with a PHY connected to logic, no MAC, and non-standard packets; I've done it.

Edited by zygot

Share this post


Link to post
Share on other sites
  • 0

@zygot
Thanks for the update. What I am trying to build on top of is the 'Echo Server Example' which uses the Zynq IP on Vivado and the TCP connection and data transfer is done on the SDK via the LWIP library. I think this is a good example to build off of for me. Do I gotta change anything on the Vivado design to get this to work? [see attached pic] My assumption is that the IP design is done and all the changes needed are on the SDK part of project.

Share this post


Link to post
Share on other sites
  • 0
25 minutes ago, rivermoon said:

My assumption is that the IP design is done and all the changes needed are on the SDK part of project.

I can't recall an assumption that I've made using generic tools that hasn't bitten me in the posterior; perhaps I just tend to remember the bad experiences.

So you have two boards that can function as an echo server. That's a start. If the only thing between your two boards is a CAT 5e cable then that are a lot of complexities that you might be able to ignore. One of the nice things about the SDK is that it provides a lot of example and source code. It doesn't make up for a lack of knowledge about a particular protocol. I assume that you will want to send UDP packets as your setup should be ideal for this. Start with conceptualizing how exactly a conversation between the two boards might play out. Is one controlling the other? Is there a format for request and reply that can be imposed? How do you plan on making this as simple as possible?

Edited by zygot

Share this post


Link to post
Share on other sites
  • 0

@zygot

So I spent some time looking 'under the hood' on the TCP/IP protocol and the lwip library and from what I read, I needed a Server and a Client. Then I looked at an example (iperf client) that is given and I adjusted that example to my application and was able to transmit data from a client to the server. So for now, I am sending TCP packets from the client to the server. My next step is to have the communication line be bidirectional and hopefully build some type of front-end website for my application.

 

If I need more help, I will be making another post. Thanks!

Share this post


Link to post
Share on other sites
  • 0

@rivermoon

You'll figure it out. Pouring through texts, on-line content and example code will help clarify what's involved.

Once you figure this out you can step back and make a fresh analysis of what it is that you want to do and how to do it simply. I doubt that you need a full client server implementation on both boards; but since you mention website it sounds like you'll need to figure out a lot of stuff before you system meets your goals. As I mentioned before, if you can set rules for the conversation and limit the scope of the network only a few packet types and limited functionality need to be used. It's hard to make that assessment if the basic concepts are fuzzy.

If you intend to expose your application to the web I hope that you'll educate yourself about security issues. The vast majority of companies that sell internet connected products do an extremely bad job at this, to everyone's detriment. Implementing most things for educational purposes is great. Deploying systems with some capabilities imposes a responsibility that not everyone is willing or able to accept. If your hardware operates in a limited universe you can have complete control over what it does. If you don't have complete control over what it's doing, well... I'll let you complete the thought.

Edited by zygot

Share this post


Link to post
Share on other sites
  • 0

@rivermoon,

Go for it, and good luck!

I've found that wireshark was very useful when debugging network interactions.  Let me take a moment and suggest you look into it and try it out.  Also, I'd love to hear back from you regarding your success when everything works like it should.  So often these forum posts only discuss problems and we never hear successes here.  That said, it's your call what you want to share.

Dan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now