[Solved] Suggestions for troubleshooting ethernet chip (ENC28J60)

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've got a circuit board with the ENC28J60 and a mega644 talking to each other through a buffer chip due to the voltage differential (5V mega -> 3.3V ethernet).

 

The board works great and returns pings as I expect.  Trouble is, the ethernet chip decides to shut down after 10 to 60 minutes (pretty random).  I have a few identical boards and they all share this problem.  I can solve this by resetting the ENC28J60 via the mega644 bringing its reset line high every 30 seconds or so which is not ideal but does keep things going but I'd really like to find out what's going on.  My mega644 keeps working just fine and continues to do other non-related things no problem.

 

I thought it might be my 3.3V regulator which feeds the Ethernet chip so I scoped it during a test ping session and there were no fluctuations outside a 50mV window when the Ethernet chip stopped working.  I also have a big 470uF electrolytic next to the ethernet chip along with a 100nF as well.  Everything looks stable.

 

All the components relating to the ethernet chip appear to match the spec on its datasheet (49.9 ohm +/- 1%, etc...)

 

I'm thinking about adding a serial interface to my mega644 and adding commands to query the ethernet chip about what's going on but that will take a lot of code and might not even help.  Just looking for some other tests to try.

Last Edited: Mon. Feb 16, 2015 - 08:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There seems to be some traffic that upsets my enc device. As to what that is, i've not determined it. I used the tuxgraphics code which was used in the arduino driver as well. Maybe someone has identified the cause?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Any of the errata applicable?

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Most likely! The spi clock rate caused me some issues. Forwarned was to be forearmed.

It was a fair solution 10 years ago, but today I would not entertain using that chip - there are much better solutions available.

 

Last Edited: Thu. Feb 12, 2015 - 02:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, it's another Microchip antique.

 

WizNet 812MJ or 820 - offloads all the protocols from the microprocessor to the ethernet NIC. Huge simplification.

They just work. THey present a socket interface to your software. RAM buffers are on the NIC for 4 or 8 sockets, TX and RX.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Was your spi clock rate too fast?  I'm talking to it at around 7MHz.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Turns out the library I found for this chip didn't adequately address errata point #12.  Here's the working code now (the top three transmit reset lines are my addition):

 

void enc28j60PacketSend(uint16_t len, uint8_t* packet)
{
	// Reset the transmit logic problem. See Rev. B4 Silicon Errata point 12.
	enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_TXRST);
	enc28j60WriteOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_TXRST);
	enc28j60WriteOp(ENC28J60_BIT_FIELD_CLR, EIR, EIR_TXERIF);
	
	// Set the write pointer to start of transmit buffer area
	enc28j60Write(EWRPTL, TXSTART_INIT&0xFF);
	enc28j60Write(EWRPTH, TXSTART_INIT>>8);
	// Set the TXND pointer to correspond to the packet size given
	enc28j60Write(ETXNDL, (TXSTART_INIT+len)&0xFF);
	enc28j60Write(ETXNDH, (TXSTART_INIT+len)>>8);
	// write per-packet control byte (0x00 means use macon3 settings)
	enc28j60WriteOp(ENC28J60_WRITE_BUF_MEM, 0, 0x00);
	// copy the packet into the transmit buffer
	enc28j60WriteBuffer(len, packet);
	// send the contents of the transmit buffer onto the network
	enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_TXRTS);
}

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have two of these left.  Never used from a larger order.  PM me your address and I will send them off to you.

 

They have the ENC28j60 on them

 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Don't put that evil on him!!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey! I kind of like that chip.   You know, once all the errata are accounted for.  I also like making my own ethernet packet, ICMP stack and so forth.  It's fun.

 

@jgmdesign:  Thanks for the offer but I have plenty of these chips.  You're very kind.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

fizgig wrote:

Hey! I kind of like that chip.   You know, once all the errata are accounted for.  I also like making my own ethernet packet, ICMP stack and so forth.  It's fun.

 

@jgmdesign:  Thanks for the offer but I have plenty of these chips.  You're very kind.

Ok, no problem

 

 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user