0

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 at 18:27
  • 1
    is ethernet cable connected? – Juraj Aug 23 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 at 19:29
  • @Juraj yes, all connected - and I get a little green light on the shield and on the hub, so I think it's all good there. – SusanW Aug 23 at 19:36
  • 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 at 21:21
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 at 21:47
  • @SusanW, did it help? – Juraj Sep 12 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 at 7:52
  • @SusanW, do not reset it. only set the pin HIGH. do it as first in setup(). – Juraj Sep 13 at 8:11
  • Yep, I tried that first .... – SusanW Sep 13 at 10:25

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.