1

My Arduino Nano can't get a reply from my new ENC28J60 Ethernet Shield - I can't get any library examples to work. Using the UIPEthernet lib, and running the EchoServer example with logging turned up, I get:

ENC28J60::init DEBUG:csPin = 10
ENC28J60::init DEBUG:miso = 12
ENC28J60::init DEBUG:mosi = 11
ENC28J60::init DEBUG:sck = 13
ENC28J60::init DEBUG:Use Native hardware SPI
Enc28J60Network::writeOp(uint8_t op, uint8_t address, uint8_t data) DEBUG_V3:Function started
ENC28J60::init DEBUG_V3:Before readOp(ENC28J60_READ_CTRL_REG, ESTAT)
Enc28J60Network::readOp(uint8_t op, uint8_t address) DEBUG_V3:Function started
...

so it gets nicely into the Enc28J60Network::init function. But shortly after, it does a phyWrite, tries to read a response, and then times out.

ENC28J60::init DEBUG_V3:Before phyWrite(PHCON2, PHCON2_HDLDIS)
Enc28J60Network::phyWrite(uint8_t address, uint16_t data) DEBUG_V3:Function started
... lots of attempts to read
Enc28J60Network::phyWrite ERROR:TIMEOUT !!

And then it all starts to fail, and it never gets better. I tried the EtherCard lib, too, and it fails in a similar way.

I put the scope on the SPI pins, and I see reasonable stuff: activity on SCK and MOSI, nothing on MISO, and the SS (pin 10) switching ok - and the shield claims to use pin 10 (I briefly tried pin 8 as I flailed in confusion, but no luck there either).

So at this point, either I'm misunderstanding something, or the shield is DOA.

Update: Earlier, I strongly suspected the SCK line because it showed a very poor signal on my scope. But it turned out to be poor grounding on the scope probe, and the signal was actually fine, a red herring. Thanks to @Majenko for drawing my attention to it.

Update 2: After getting no SPI response from the shield under any circumstances, my working hypothesis is that it was DOA. I've gone back to my UNO with W5100: all working fine. I have ordered more Nano ethernet shields, to arrive in a week or two, so I'll try with those, and provide updates/answers then.

  • 1
    How much bandwidth does your scope have? That looks awfully low resolution, and the kind of output I'd expect on a scope with not enough bandwidth to display the waveform correctly. – Majenko Aug 23 '19 at 18:27
  • 1
    is ethernet cable connected? – Juraj Aug 23 '19 at 19:05
  • @Majenko good point - and thanks for the pointer. I'd not earthed the scope probe properly, so fixed, and the SCK line looks perfectly fine now. D'oh, beginner's mistake. I'll edit it out of the question. – SusanW Aug 23 '19 at 19:29
  • 1
    How much current can your 3.3V supply to the ENC28J60 Ethernet Shield? The data sheet says it uses 120mA when it's "Active, not transmitting Ethernet packets". Up to 180mA is required when it's "Transmitting Ethernet packets". – VE7JRO Aug 23 '19 at 21:21
  • 1
    Perhaps this could bring some solution. mikrocontroller.net/topic/477142 – Riad Nov 27 '19 at 20:16
2

The ENC28j60 shield for Nano has reset of the ENC28j60 chip on the pin 7 of the shield/Nano. Try to set the pin 7 HIGH.

  • If this solves it, it would be hilarious... ok, will try it at the weekend - alas I'm away atm. So, I just have to add: pinMode(7, OUTPUT); digitalWrite(7, HIGH); on setup? Hmm, I wonder why the UIP/EtherCard library examples don't have this. Perhaps the reset is non-standard, or there's a (too) weak pull-up? – SusanW Sep 3 '19 at 21:47
  • @SusanW, did it help? – Juraj Sep 12 '19 at 9:33
  • no it didn't, I'm afraid - I added pinMode(7, OUTPUT); digitalWrite(7, LOW); delay(1000); pinMode(7, OUTPUT); digitalWrite(7, HIGH); just to give it the best chance possible, but it still times-out on read and the MISO line is silent. Which is annoying, because what you suggested would be the perfect answer - and on reading around, it appears the pin-7 reset is an under-publicised feature. Anyway, I've ordered some more shields which should arrive any day, so I'll be able to eliminate board failure as a factor. I'll keep you posted... Thanks! – SusanW Sep 13 '19 at 7:52
  • @SusanW, do not reset it. only set the pin HIGH. do it as first in setup(). – Juraj Sep 13 '19 at 8:11
  • Yep, I tried that first .... – SusanW Sep 13 '19 at 10:25
0

Thanks to @Riad, who posted this as a comment. The problem appears to be a design fault in the "DK ectronics" V1.0 Ethernet Shield.

Perhaps this could bring some solution. https://www.mikrocontroller.net/topic/477142

The site is in German, so here's a brief translation of the key parts:

I bought an ENC28J60 for the Arduino Nano, but it does not respond from the programmed IP.

The shield has "NANO Ethernet Shield V1.0 DK ectronics" inscribed on the underside (spelling error in the original). There there is a via on the bottom between pins D11 and D12, missing from a (different) working shield. This via connects D12 line to GND from the AMS1117 on the top (easy to check D12 to GND with a multimeter). If that's the case with your shield, then this is the problem: we just have to cut out the via connection. I have Do this with a 1mm drill by placing the top copper layer in the via very gently (really gently!) Mill it away. If you drill too deep, you break the D12 connection completely and must possibly solder on a new wire. Keep checking D12 and GND for continuity to see whether you've milled away enough. Work really carefully!

After I did that, and tried the TCP Server example in the UIPEthernet library on the Arduino, the shield was reachable.

-- Christoph K

I haven't yet tried to make the changes described above, because they are fiddly and I have a new batch of working shields. But my device is exactly as described by Christoph and his photos, and the fault description matches mine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.