Go Down

Topic: Connecting an Ethernet PHY to Arduino Due (Read 114852 times) previous topic - next topic


Jan 15, 2013, 07:14 pm Last Edit: May 16, 2016, 02:24 am by Palliser Reason: Adding Emac demo code link and recommended hardware to test the code.
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.




Jan 15, 2013, 10:03 pm Last Edit: Jan 15, 2013, 10:07 pm by Palliser Reason: 1
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.


Jan 24, 2013, 03:42 am Last Edit: Jan 24, 2013, 03:50 am by Palliser Reason: 1
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).


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.
Please ask questions in the forum so everyone can benefit. PM me for paid work.


Jan 25, 2013, 05:44 pm Last Edit: Jan 25, 2013, 05:47 pm by Palliser Reason: 1
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.



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:

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.

Go Up