Connecting an Ethernet PHY to Arduino Due

I thought that it would be a good idea to open this post regarding the connection of an Ethernet PHY to Arduino Due, given that I still revising a couple of approaches I have on hand. The first one belongs to Atmel (doc11153). The second one is my own idea. Let's start talking about the first one which looks realizable and later on, my own approach.

As most of you may know, the core inside Arduino Due (SAM3X8E) integrates an EMAC module to implement a 10/100 MAC compatible with the IEEE 802.3 standard. The approach of Atmel evolves around to the idea of connect an external Physical layer transceiver (or Ethernet PHY) by Media Independent Interface (MII) or Reduced Media Independent Interface (RMII). Then, they made a comparison between both considering frequency, cost and manufacturers. Finally, they present the implementation using a 10/100 Mbps fast ethernet physical layer TX/FX single chip transceiver (DM9161) set in RMII mode with a 50MHZ crystal connected to the development kit SAM3X-EK using a HTTP demo under BeRTOS.

I have planned, as I did with the CAN bus approach, to run the demo to familiarize with their approach.

OK. Now my approach: I'd been thinking to wire directly the Ethernet MAC embedded inside Arduino Due with an off-chip Ethernet PHY (built-in can apply also) and add the correspondent coupler and an Ethernet connector. Then, as I did with the CAN, I will start to port part of the SAM3X-EK 32-b Ethernet libraries to Arduino Due. I haven't made up my mind yet for the phy but it could be like DP83848C.

As you may have noticed, my approach is not original. I did read similar approaches in this forum but I have no heard of anyone working on one yet (ArgusTech? Markus_L811?). So here we go. Any comments and more ideas are very welcome.

April 03, 2013, 10:49:00 PM - I just removed the attachment with a non-working EMAC library (I will publish in github the new working EMAC library very soon).

EDIT [05-15-2016]:

Here a link for the EMAC demo library:

I f someone want to try it, I'd recommend to do it with the TAIJIUINO Due Pro R3 w/ Programmer and Ethernet PHY module.

http://www.elechouse.com/elechouse/index.php?main_page=product_info&products_id=2230

-p

By the way, for those who are asking to themselves how in the world the 8 Ethernet FPGA pins can be reached/connected, the answer is: a customized micro 16-pin clamp that I am designing. 8)

I like the idea of 'native' Arduinoe Due Ethernet. How will you be installing the RJ45 header? Shield? Some sort of Side Car?

Hello ODwyerPW. It will be a side car shield board as follows:

Pins 113,114,115,118,119,120,121 of SAM3X8E of Arduino Due connected via a wedge clip wired to a PHY like DM9161AEP soldered to an Arduino proto-shield board. The board will contain the crystal and necessary circuitry (caps, resistors). The PHY will be wired to a coupler and a RJ45 connector, both also soldered to the shield.

The optimal approach should be a pure shield but the problem lies in the fact that there is not direct access to the Ethernet pins in the SAM3X8E.

My goal here is to develop in a real and practical way an Ethernet interface exploiting the MAC. I believe that in future generations of Due, an embedded PHY should be considered.

I think that for reasons of space, the embedded PHY has no place, thus, at least a mini Ethernet terminal should be re-considered (remember the eagles).

To address the Ethernet PHY, instead of begin to look for a chip transceiver or to cannibalize one of my Foscam ip cameras, I preferred to equip my interface with a Russian mini PHY module (AS-DM9161) as an expedite solution. This module doesn't come with the 50 MHz crystal and not sure if the RJ45 jack has the embedded magnetic coupling but all that should be easy to tinkerer. In the meantime, I have planned to start running these following nights the Atmel Studio demo 'EMAC_EMAC_EXAMPLE1' in my SAM3X-EK. This example enables the SAM3X8H to respond to a ping command sent by a host computer.

I ran the Atmel Studio Ethernet sample (EMAC_EMAC_EXAMPLE1) in SAM3X-EK and worked OK. I still waiting for my AS-DM9161 module from as-kit.ru (Moscow) and half-way done with my wedge.
I will now show a simplified drawing of the Ethernet shield (wedge+PHY) for Due. The wedge will work as a bridge between SAM3X8E's Ethernet pins and the Ethernet PHY.
As I explained before, my goal is to develop an Ethernet API for a future Due version with Ethernet connector.
My next step is to start porting the Atmel code to Arduino IDE.

Do you think we could use this cheap Enc28j60 boards, which are on ebay for 4$ instead of using AS-DM9161?

For connection to SAM3X8E ethernet pins I would go with pogo-pins mounted on the bottom of DIY shield for DUE.

Hello Frenki_. Thank you for your contribution.
I think the PHY board you mentioned and the pogo-ping should also make it.
During my research, I wanted to use DP83848C. Also, somebody recommended me to use the chip KSZ8041NLI TR.
What really counts here is the concept: Due->Bridge->PHY->API.
I am experimenting with something that is already proven: an Atmel Ethernet API that works with a SAM3X8H through an Ethernet PHY based on the DM9161.
Once the Atmel Ethernet class is ported to Arduino IDE, we will have here in the forum a main parent Ethernet class to start as a base for further discussion and improvement.

You may consider TaijiDUE on which The ethernet terminal was supplied.

Hello gaplee and good catch with the TaijiDUE.
Can anybody post a picture showing the Eth terminal? Thanks.

OK. I have good news!. I just ported the Atmel Ethernet API to Arduino IDE. At least the 'EMAC_EMAC_EXAMPLE1' now called 'Arduino_Due_EMAC_Sample_1.ino' is compiling with no errors. My next step now is try to simplify as much as possible the library (34 files) and then wait for my shield to be ready for preliminary tests before upload it to github. Yes!

I want to clarify something regarding this Ethernet PHY development:

The Ethernet API and EMAC sample I am working with, it has emerged from the simplest of three SAM3X-EK Ethernet examples contained in Atmel Studio 6 and it is called "EMAC_EMAC_EXAMPLE1". This example only demonstrates how to configure and use the EMAC peripheral and does not uses Adam Dunkels' lwIP stack.

The other two examples are more elaborated: "LWIP_EXAMPLE1" which is a basic web server and basic TFTP server application with DHCP enabled through the lwIP TCP/IP stack and FreeRTOS of Sam port and finally "THIRDPARTY_FREERTOS_SAM_LWIP_DHCP_EXAMPLE1" which is a basic HTTP web server using also the lwIP TCP/IP stack standalone SAM port (i.e. no OS).

Frenki_:
Do you think we could use this cheap Enc28j60 boards, which are on ebay for 4$ instead of using AS-DM9161?

For connection to SAM3X8E ethernet pins I would go with pogo-pins mounted on the bottom of DIY shield for DUE.

The ENC28J60 is an SPI connected MAC/PHY chip. It would work, if you have a driver for it, but would be a lot slower than a PHY connected to the ETH interface on the SAM3X. If you are doing occasional requests like HTTP, it would probably be OK, if you want to transfer a lot of data I think it would be lacking performance.

It is a cheap and relatively simple way to add Ethernet though.

Don't ask but even though DM9161 is obsolete, expensive and difficult to purchase it, it has been Atmel's workhorse for the SAM family all these years. No "TX underrun" messages under heavy loads with 100M link. I still believe is the best option for now.

Palliser,

Thanks for all your awesome work you are doing on the Arduino Due - Your idea on the wedge is nothing short of awesome! I will be super impressed to see it in action. I'm quite frustrated with the slowness of all of the WIZnet (W5100, W5200) options for Arduino Ethernet capability and I'm down to help test a faster and more reliable solution for the Due.

I just ordered a couple of the TaijiDUE boards and I'll open up both of my Arduino Due's to sacrifice for this project in the meantime since it should take a couple weeks to get them in the USA from where they ship in China.

I also noticed there were several PHY options listed in the following document:
http://www.atmel.com/Images/doc11153.pdf

Are you choosing the Davicom PHY due to it being part of the SAM3X-EK evaluation board from Atmel?

If so, I'll be ordering some of the Davicom PHY as well as a couple of the others just in case we need them on hand for testing.

Hello kcore,

Above all, I am very happy for your willingness to join this project. I am also very pleased with your words of recognition for my work with Arduino Due but sorry that you are facing 'Dum Roma deliberat Saguntum perit Lat' with the other Ethernet solution. I hope you can make more progress very soon.

Now I will get to the point. At this time, I cannot do too much in the shield side. I expect to get the Davicom PHY by the end of next week (the vendor can't ship it directly to America). My wedge will be ready a little before then. Thus, I hope to start tests by the first week of February.

I chose the Davicom PHY because Atmel already developed the API driver for DM9161A (ethernet_phy.c, ethernet_phy.h) and it is proven with SAM3X-EK. In reference to the other PHY options, I do not have enough knowledge or references with which to form a judgement about them but as Atmel states "Due to standardization, the connection between a MAC controller and a PHY is straightforward and simple. Even, any PHY can work with any MAC." It sounds like, "Just do few changes on the DM9161 driver". Regarding the wedge idea....Do you remember the TV series 'The Six Million Dollar man?...I always think of the Arduino Due as Col. Steve Austin. Due looks like another Arduino board but inside contains a lot of power. An unknown power. For me, those Ethernet and CAN shields are like binoculars or hydraulic pliers if compared with the CAN and EMAC controllers embedded inside Due. We need to take advantages of these capacities. This thought made me figure any possible way to reach them...but let's leave my wedge design in mystery for now. So, I will be working these next few days with the Ethernet API. As I mentioned before, it is compiling good but it is not relevant yet in the Arduino context.

Bottom line: Get ready with you Dues and I would recommend you to get the Davicom PHYs. I believe we can start doing official tests, God willing, in about two weeks.

Today I have ordered some DM9161 from ebay so I'll be able to contribute to the progress on arduino due ethernet port. :wink:

Some time ago I wrote tutorial on: arduino + ethenet shield + node.js for udp streaming http://frenki.net/2012/10/remote-logging-with-arduino-and-node-js/
I would like to use the same technique (but faster) to convert DUE into simple oscilloscope and logic analyser. (But this time without W5100 ethernet shield)

Frenki_, I am happy you also embark in this journey. Welcome aboard!
In reference to your arduino + ethenet shield + node.js, shrewd and amazing! You should submit it to the Arduino blog if you have not already done so.

By the way, I just noticed something in the Taijiuino.

The pin 10 (RESET) of its Ethernet terminal is connected to the pin 47 (NRSTB) of the SAM3X8E instead of pin 69 (NRST).
Pin 47 is input only and enables asynchronous reset of the SAM3X8E when asserted low, unlike pin 69 which is bidirectional and can provide a reset signal from SAM3X8E to the external components.

In the SAM3X-EK, pin 69 is connected between SAM3X8E and DM9161.

Palliser:
Can anybody post a picture showing the Eth terminal? Thanks.

Hi all,

First I would like to thank you for all the energy you put is this project , which seems very interesting :slight_smile: !

Then I have one simple (maybe stupid) question :

On one hand, we have Arduino Uno which comes with ethernet shield (with W5100) and is able to do some client/server application with ethernet.
On the other hand, we have Arduino Due which indeed has a SAM3X and thus some ethernet capabilities, but no access to these ethernet pins and it also needs another PHYceiver, which means alse another kind of shield (Am I right?)

So my question is... what is wrong with the existing ethernet shield ? Is it a matter of speed ? In what case would we need to use this new extra shield rather the W5100 existing one ?

You may answer with "it depends on your application, the amount of data you want to transfer, etc.", so here is what I would like to do:
Just one client, one server, ethernet connection. The arduino is the server. The client makes requests, which mean "I want information number X". The servers makes the answer, which is just a few characters for each answer. So it's a lot of small requests - answer, maybe a hundred per seconds. It must be able to run for hours without "bugging or overloading"

=> Is this good with the standard "ethernet W5100 shield" ? Or should I follow in more details your developments which aim at using the SAM3X ethernet hardware with a specific PHYceiver?

Thanks for your answer !