ENC28J60 Spi Ethernet library - Possible Bug

Beta Testing discussion on mikroBasic PRO for PIC.
Post Reply
Author
Message
Ikefu42
Posts: 24
Joined: 06 May 2010 04:00
Location: Wyoming, USA
Contact:

ENC28J60 Spi Ethernet library - Possible Bug

#1 Post by Ikefu42 » 13 Jul 2012 03:55

Greetings,

I recently ran into an issue where I could not communicate with an ENC28J60 over SPI when I increased the SPI clock speed of my PIC18F26K22 from 4Mhz to 16Mhz and believe I have found the problem that might be able to be fixed with a library code update.

Project Background:
I am using a PIC18F26K22 at 3.3V running at 64Mhz and have it connected via SPI to an ENC28J60.
The Ethernet communication ran perfectly when I had SPI clock set at 4Mhz (Fosc/16) but when I increased the SPI clock speed to 16Mhz (Fosc/4) the ENC28J60 would stop communicating on the network and was not sending out a signal anymore. The 28J60 works at SPI speeds up to 20Mhz according to its datasheet so 16Mhz should work correctly.

Probable Issue:
I did a lot of research on this problem and finally came across this post on the microchip forums: http://www.microchip.com/forums/m634249.aspx
According to the post the high SPI speed can violate the AC Characteristic Limits of the ENC28J60 by not allowing the CS Setup and Disable times to be greater than 50ns (See the ENC28J60 Datasheet Table 16-6)

Possible Fix:
A small delay needs to be added to the SPI library to ensure the CS Setup and Disable Times are longer than 50ns. This could be done automatically at certain SPI speeds or it could be an advanced parameter option that could be set in the code.


Please take a look at this as I would love to be able to use the MikroBasic SPI libraries to run the SPI speeds at 16Mhz for the ENC28J60 on my project. Thanks!

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: ENC28J60 Spi Ethernet library - Possible Bug

#2 Post by janko.kaljevic » 13 Jul 2012 15:33

Hello,

Thanks for the detailed explanations.

We will inspect this matter thoroughly.

Best regards.

joh.nguyen
Posts: 30
Joined: 17 Jul 2013 16:35

Re: ENC28J60 Spi Ethernet library - Possible Bug

#3 Post by joh.nguyen » 16 Oct 2013 17:02

janko.kaljevic wrote:Hello,

Thanks for the detailed explanations.

We will inspect this matter thoroughly.

Best regards.
Hi Janko,

Could you possibly tell me status of matter?

Thanks,

Post Reply

Return to “mikroBasic PRO for PIC Beta Testing”