ENC28j60 connection

Hello,
I want to interface ENC28j60 ethernet module with beaglebone green. Is there any user level library or example for it?
I have worked with SPI on linux before, while googling I found driver for the same https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/microchip/enc28j60.c but I don’t have any idea about how to use it,can you please guide me through this?or is there any other way to do the same?any userlevel library reference,which will not make me to do changes in kernel module.I am looking for c references.
following are the details of my beaglebone

cat /etc/dogtag
BeagleBoard.org Debian Image 2018-10-07
cat /etc/debian_version
9.7
uname -a
Linux beaglebone 4.14.71-ti-r80 #1 SMP PREEMPT Fri Oct 5 23:50:11 UTC 2018 armv7l GNU/Linux

any kind of help is highly appreciated

Thanks & Regards

can’t give you a comprehensive tutorial here. your can google spidev stuff, have a look how other’s git diff have done it (DTS or board file diff). read: http://linux-sunxi.org/SPIdev

BTW Can’t you use a usb ethernet?

Take a look at, this overlay:

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-mBC1-ETH-CLICK.dts

Which add's support for this combination:

BeagleBone +
https://www.mikroe.com/beaglebone-mikrobus-cape +
https://www.mikroe.com/eth-click

So use that to help figure out how your need to wire your module..

Regards,

thank you for responding…so as overlay is for pin functioning and ENC28j60 properties definition…what should I do next for actual c coding? as I am looking for any available c library which can help me to build tcp/ip connection.as there is a lot of register initialization using SPI to activate ENC28j’s MAC PHY as per datasheet.as well I am totally unaware about how should I implement a TCp socket using this.My ultimate aim is to implement a TC/ip modbus. Please guide me through this please let me know if I am missing any basic concepts in this I will work on it.

Thanks & Regards

Sounds like fun, my directions where to "utilize" the already
"pre-built" kernel driver..

But feel free to do what you want..

Good Luck!

On Tue, 26 Mar 2019 11:56:43 +0530, tanvi gore
<tanvi20394@gmail.com> declaimed the
following:

thank you for responding....so as overlay is for pin functioning and
ENC28j60 properties definition....what should I do next for actual c
coding? as I am looking for any available c library which can help me to
build tcp/ip connection.as there is a lot of register initialization using
SPI to activate ENC28j's MAC PHY as per datasheet.as well I am totally
unaware about how should I implement a TCp socket using this.My ultimate
aim is to implement a TC/ip modbus. Please guide me through this please
let me know if I am missing any basic concepts in this I will work on it.

  Sounds like you want to explore https://en.wikipedia.org/wiki/LwIP (
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.109.1795&rep=rep1&type=pdf
)