{"id":1512,"date":"2025-08-17T21:45:00","date_gmt":"2025-08-17T21:45:00","guid":{"rendered":"https:\/\/pdp2011.sytse.net\/wordpress\/?p=1512"},"modified":"2025-08-18T10:50:55","modified_gmt":"2025-08-18T10:50:55","slug":"enc28j60-works","status":"publish","type":"post","link":"https:\/\/pdp2011.sytse.net\/wordpress\/enc28j60-works\/","title":{"rendered":"ENC28J60 works!"},"content":{"rendered":"\n<p>Just over a year ago I started work on adding support for the enc28j60 ethernet chip &#8211; as an alternative for the enc424j600. <\/p>\n\n\n\n<p>Since Digilent stopped selling the PMODNIC100, boards with the enc424j600 became somewhat difficult to find &#8211; not impossible maybe, and also the bigger enc624j600 version of the chip can be used with the existing XU core. But the major vendors don&#8217;t carry the alternatives for the PMODNIC100, so for most people the only option was to buy directly from a producer, with shipping costs etc spoiling the fun. So the most logical thing to do was to add support for enc28j60 &#8211; essentially the predecessor of, the older variant of the enc424j600, and widely available from many sources.<\/p>\n\n\n\n<p>The XU\/DEUNA needed some attention anyway &#8211; after adding the esp32-based wireless network backend to it, the configuration of which backend should be included had become a bit confusing. I already had a couple enc28j60 in my parts box &#8211; one that was shipped instead of a PMODNIC100 by mistake a long time ago, and another that came as a freebie with another order. So I briefly read the manual, thought it was very similar to the enc424 &#8211; basically, just copy that and make some minor changes, how hard could it be.<\/p>\n\n\n\n<p>Well, it took me a year, that&#8217;s how hard. Not that I worked on it all that time, far from it. But it&#8217;s still one of the most aggravating chips I&#8217;ve ever tried to interface. The worst probably is that the interface is very finicky &#8211; the control registers have different requirements for timing; what works for buffer memory or a regular control register won&#8217;t work for a mac or phy register. The documentation doesn&#8217;t help either, with the errata sheet throwing lots of unhelpful clues &#8211; or the data sheet itself that presents the information in such a confusing way that I needed three or more copies each open on a different page.<\/p>\n\n\n\n<p>Then of course it&#8217;s only 10Mbps &#8211; which brings us back to the time when autonegotiation for half or full duplex was not a given, and just about everything that&#8217;s needed to deal with collisions needs to be set up specifically. And neither does it have a burnt-in MAC address. That made things somewhat difficult because it took a very long time for me to figure out the correct timing to set the MAC- and PHY related registers &#8211; but I could get around that by setting the chip to receive all frames promiscuously and filtering for &#8216;my&#8217; MAC address in software.<\/p>\n\n\n\n<p>It kind of worked &#8211; I could receive frames sort-of ok, and send them out too. Except there was one really weird problem that almost drove me crazy: the chip would keep sending out frames with a destination MAC address of 0x&#8217;46&#8217;:0x&#8217;37&#8217; followed by 4 bytes with the destination IP in them. At first I suspected that the bus masters in my XU design were somehow corrupting data, but I couldn&#8217;t find why or how, and it took a while to figure out how to instrument the hardware to find out &#8211; but when I did, it pointed to an issue in 2.11bsd. Of which we now know that it is caused by an unforeseen effect of patch #490.<\/p>\n\n\n\n<p>Soon after I also found the issues with the interface timing for updating the MAC registers in the chip, and everything now works as expected &#8211; in fact, besides these issues it seems to work remarkably stable. In the test setup I&#8217;m now working with I&#8217;m consistently getting 160KBytes\/s throughput on a long FTP transfer, telnetting feels snappy, and flood pings run almost without packet loss.<\/p>\n\n\n\n<p>There&#8217;s some work left to do &#8211; more testing, some trickery to configure the MAC address and duplex settings, and documentation. But that won&#8217;t take too long.<\/p>\n\n\n\n<p>And there&#8217;s more exciting news for the upcoming release, watch this space for more updates!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Just over a year ago I started work on adding support for the enc28j60 ethernet chip &#8211; as an alternative for the enc424j600. Since Digilent stopped selling the PMODNIC100, boards with the enc424j600 became somewhat difficult to find &#8211; not impossible maybe, and also the bigger enc624j600 version of the chip can be used with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5,6],"tags":[],"class_list":["post-1512","post","type-post","status-publish","format-standard","hentry","category-hardware","category-pdp11","category-update","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/posts\/1512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/comments?post=1512"}],"version-history":[{"count":3,"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/posts\/1512\/revisions"}],"predecessor-version":[{"id":1515,"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/posts\/1512\/revisions\/1515"}],"wp:attachment":[{"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/media?parent=1512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/categories?post=1512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pdp2011.sytse.net\/wordpress\/wp-json\/wp\/v2\/tags?post=1512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}