This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MAC PHY Communication exaple

Hello everyone!

I'm starting on project consisting of two TM4C1294 Connected Launch Pad connected over ethernet cable and comunicating on that layer, using MAC and PHY. Is there any example for this, of any kind. Just something to start with. Thank you!

  • Hello Djedjica,

    Veikko Immonen has a bare metal Ethernet Code. If you can connect with him on the Forum, that would help you get to your goal faster. I will ping him though

    Regards
    Amit
  • Hi Djedjica,
    Would you like to specify your target a bit more? Ie. what sort of communication are you trying to do etc.

    The programming example in the DriverLib manual will get you very far with transmitting & receiving bare ethernet frames, for anything more you need to write more code. If ethernet frames suffice, let me know and I'll share tips to finalize the programming example. As a forewarning, I'll be mostly offline for the next couple of weeks starting this Friday.
    Best, Veikko
  • Hello Veikko,

    thank you for reply. For now I'm interested in simply transmitting frames from one board to another using ethernet cable. Data would be ethernet frames, nothing in the upper layers. I'm planning to transfer that code later on in custom board that will have this controller and RJ45 socket, I would write more code for interpreting this data, I am aware of that, just need something to start with transferring frames in this layer. In which DriverLib manual is this example you were mentioning? 

    Thank you!

  • Also, I'm wondering, since I'm still waiting for the other board to arrive, can I test comunication of board and laptop, when directly connected, point to point. Is that possible? Are there any projects or examples with that funcionality.
    Thank you!
  • The example I'm referring to is in the TivaWare DriverLib User's Guide, Programming example for the Ethernet controller section.  Please refer to the message below for details on how to modify the Driverlib example - those tips are for the previous release, I haven't had the chance to check if the example has been updated for the current release - perhaps Amit knows about that.

    As to direct board - laptop communication, you'll have a hard time getting your laptop send/receive raw ethernet frames for actual communication. But you can use Wireshark to see all frames, including the ones you send from the board. And Windows (assume that's what you are using) takes care of sending "a few" frames on it's own, you can then look at them in wireshark and compare to what you see in the debugger.

    e2e.ti.com/.../1472318

  • Ok, I assumed you meant on that example. I tried to send some dummy data by just passing some data to "PacketTransmit" function. And acccording to debugger, everything goes without problems EMACTxDMAPollDemand gets called values for variables are ok. But I cannot see anything in Wireshark. This data is send without seting destination MAC address? Because I haven't done much modification to cone, just filled buffer with values and passed it along with the length to the PacketTransmit function. Should I modify something more or??
  • I wouldn't expect "dummy data" to pass through the transmit engine in the MAC. You should format the data buffer to be a proper Ethernet frame (with the trailing CRC omitted, IIRC). Afraid I don't have time to do much hand-holding here, but all I used to get things working was that example, the device datasheet and Wikipedia for referencing the frame structures and such. Also beware of the "big indian" that lurks in all things networking where number fields bigger than one byte are present...

    I assume that the physical link comes up OK and you can see the infestation of Windows-sent packets in Wireshark, correct? (that's a requirement for trying to send anything)

  • Yes, when I test in debuger, until I connect ethernet cable, code holds and waits for link to be active. Also, when I connect cable, wireshark catches packets from WIndows, but I could not find anything related to the board in those packets.
    Ok, I see that the frame needs to be according to the protocol, that was what confused me, so to hard code destiantion MAC or broadcast is sufficient?
    Maybe there could be something useful in examples for upper layer comunication, cause according to my knowledge of TCP/IP stack frame is found in upper layer datagrams only with additional data that for upper layer protocols use?
  • Djedjica said:
    so to hard code destiantion MAC or broadcast is sufficient?

    Yes. You could mimic an ARP packet, for example.

    Djedjica said:
    according to my knowledge of TCP/IP stack frame is found in upper layer datagrams only with additional data that for upper layer protocols use?

    Yep, there's quite a bit of wrapping being done - this message goes out as a HTTP request, wrapped inside (multiple) TCP packets, wrapped inside IP datagrams, each wrapped inside an Ethernet frame, which is then "bit-banged" onto the wire. But I hope your eventual target is not to get TCP working, because if it is then you're wasting your time with the raw examples, go for the lwIP / uIP ones directly.

  • My target will be another board, with same chip, and I need this raw data because I will only be sending some encoded signals using ethernet, no need for anything in upper layers.
  • What about TCP or UDP packets, are there any examples in sending data in theese packets for which I can customize it to send some custom data bits? I assume two boards can also communicate that way to each other when connected with single ethernet cable?