{"id":1399,"date":"2013-01-19T23:48:08","date_gmt":"2013-01-19T21:48:08","guid":{"rendered":"http:\/\/sickel.net\/blogg\/?p=1399"},"modified":"2013-11-10T18:10:40","modified_gmt":"2013-11-10T17:10:40","slug":"enc-28j60-ethernet-module-with-arduino","status":"publish","type":"post","link":"http:\/\/sickel.net\/blogg\/?p=1399","title":{"rendered":"ENC 28J60 ethernet module with arduino"},"content":{"rendered":"<p>I recently bought an ENC 28J60 module from <a href=\"http:\/\/www.geeetech.com\/wiki\/index.php\/Arduino_ENC28J60_Ethernet_Module\">geeetech<\/a>. They offered a download for drivers and examples for arduino, but it turned out there were two grave snags:<\/p>\n<p>My debian system had gcc-avr v 4.7.x, there are some resent changes that means that some of the arduino code does not compile. I was told that:<\/p>\n<p><code>\/usr\/share\/arduino\/libraries\/EtherCard\/tcpip.cpp:459:20: error: variable 'c' must be const in order to be put into read-only section by means of '__attribute__((progmem))'<\/code><\/p>\n<p>I don&#8217;t care if it is an error in the compiler or in the arduino system (as it was discussed on some lists), to get it to work, I just downgraded the compiler to version <a href=\"http:\/\/packages.debian.org\/squeeze\/amd64\/gcc-avr\/download\">4.3.5-1<\/a> (if you are using another system, you must download it from somewhere else). Then I installed it with sudo dpkg &#8211;install &lt;package&gt;. avr-libc should be dowgraded to <a href=\"http:\/\/packages.debian.org\/squeeze\/all\/avr-libc\/download\">1.6.8<\/a> (the compiler worked without downgrading the libc, but that made further upgrades of the system impossible). To make those downgrades survive later system upgrades, pin them in \/etc\/apt\/preferences.d\/avr which should contain<\/p>\n<p><code><br \/>\nPackage: avr-libc<br \/>\nPin: version 1.6.8*<br \/>\nPin-Priority: 1001<\/p>\n<p>Package: gcc-avr<br \/>\nPin: version 4.3.5*<br \/>\nPin-Priority: 1001<\/p>\n<p><\/code><\/p>\n<p>It also turned out that the code from geeetech was pre v 1.0 of the arduino SDK. Editing some code and adding in the WConstants.h and wiring.c and wiring.h from v 0.23 of the arduino SDK, i got it all to work (at least so far).<\/p>\n<p>My working library can be found here : <a href=\"http:\/\/sickel.net\/blogg\/wp-content\/2013\/01\/ENC28J60.tar.gz\">ENC28J60.tar<\/a> (132k) (git repo so my changes can be seen)<\/p>\n<p>This works fine with the examples where the arduino acts as a server. I have still not managed to get it to work as a client.<\/p>\n<div id=\"attachment_1408\" style=\"width: 2058px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/sickel.net\/blogg\/wp-content\/2013\/01\/IMG_0899_small.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1408\" data-attachment-id=\"1408\" data-permalink=\"http:\/\/sickel.net\/blogg\/?attachment_id=1408\" data-orig-file=\"http:\/\/sickel.net\/blogg\/wp-content\/2013\/01\/IMG_0899_small.jpg\" data-orig-size=\"2048,1152\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;2.8&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;Canon PowerShot A3350 IS&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1358639257&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;5&quot;,&quot;iso&quot;:&quot;400&quot;,&quot;shutter_speed&quot;:&quot;0.016666666666667&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"ENC28J60 ethernet module connected to an arduino\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;ENC28J60 ethernet module connected to an arduino.The markers onthe PCB may be a tad confusing. Vcc is the leftmost connection at the closest end. (red),&lt;\/p&gt;\n\" data-large-file=\"http:\/\/sickel.net\/blogg\/wp-content\/2013\/01\/IMG_0899_small-1024x576.jpg\" src=\"http:\/\/sickel.net\/blogg\/wp-content\/2013\/01\/IMG_0899_small.jpg\" alt=\"ENC28J60 ethernet module connected to an arduino.The markers onthe PCB may be a tad confusing. Vcc is the leftmost connection at the closest end. (red),\" width=\"2048\" height=\"1152\" class=\"size-full wp-image-1408\" srcset=\"http:\/\/sickel.net\/blogg\/wp-content\/2013\/01\/IMG_0899_small.jpg 2048w, http:\/\/sickel.net\/blogg\/wp-content\/2013\/01\/IMG_0899_small-300x168.jpg 300w, http:\/\/sickel.net\/blogg\/wp-content\/2013\/01\/IMG_0899_small-1024x576.jpg 1024w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><p id=\"caption-attachment-1408\" class=\"wp-caption-text\">ENC28J60 ethernet module connected to an arduino.The markers onthe PCB may be a tad confusing. Vcc is the leftmost connection at the closest end. (red),<\/p><\/div>\n<p>I am now connecting the 28J60 to the arduino using a ribbon cable (Split an old floppy disk cable to have just 10 conductors) The connections will then be:<\/p>\n<table>\n<thead>\n<tr>\n<th># <\/th>\n<th>Arduino pin<\/th>\n<th>28J60<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>GND<\/td>\n<td>GND<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>3v<\/td>\n<td>VCC<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>RST<\/td>\n<td>RESET<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>D10<\/td>\n<td>CS<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>D13<\/td>\n<td>SCK<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>D11<\/td>\n<td>SI<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>D12<\/td>\n<td>SO<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>n.c<\/td>\n<td>WOL<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>D2<\/td>\n<td>INT<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>n.c<\/td>\n<td>CLKOUT<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>How to connect an ENC28J60 ethernet module to arduino using arduino v 1.0.1. <a href=\"http:\/\/sickel.net\/blogg\/?p=1399\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[33,4],"tags":[],"class_list":["post-1399","post","type-post","status-publish","format-standard","hentry","category-arduino","category-data"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pnVtD-mz","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/sickel.net\/blogg\/index.php?rest_route=\/wp\/v2\/posts\/1399","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/sickel.net\/blogg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/sickel.net\/blogg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/sickel.net\/blogg\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/sickel.net\/blogg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1399"}],"version-history":[{"count":18,"href":"http:\/\/sickel.net\/blogg\/index.php?rest_route=\/wp\/v2\/posts\/1399\/revisions"}],"predecessor-version":[{"id":1746,"href":"http:\/\/sickel.net\/blogg\/index.php?rest_route=\/wp\/v2\/posts\/1399\/revisions\/1746"}],"wp:attachment":[{"href":"http:\/\/sickel.net\/blogg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/sickel.net\/blogg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1399"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/sickel.net\/blogg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}