Change default pins ENC28j60 Ethernet Module Library

I’m currently using an Arduino Pro Mini (5v version) with the attached EtherCard library in conjunction with an ENC28j60 module. The default pins are listed as comments in the EtherCard.h file as:
SCK – Pin 13
SO – Pin 12
SI – pin 11
CS – Pin 8

A note on CS, Pin 8: In researching this, I have found that pin 8 or pin 10 can be connected to CS. I have CS connected to pin 10.

I have another library for an audio task in this project and unfortunately, it uses some of the same pins – 9, 10, 11 and 3. It would be really great if I could have the ENC28j60 use pins other than the default.

I have looked through the files bundled in the EtherCard zip library, but don’t recognize where the default pin numbers are set. I don’t have a great deal of Arduino experience, so perhaps I’m overlooking something.

Could someone look at the attached EtherCard library and see if it is possible to change these pin assignments.

EtherCard-1.1.0.zip (124.7 KB)

13,12,11 are the hardware SPI bus. You cannot change those.
10 is Slave Select, it must be an output for the Promini to be SPI bus master. You do not have to use it as a slave select/chip select pin, but it must be an output pin. Any other pin can (2-9, 14-19) can also be used in place of 10 for slave select/chip select.

pin 11, 12, 13 are SPI bus so all SPI devices use the same pins. the CS pin can be any pin and it must be different for every device

Thanks CrossRoads and Juraj for your conclusive advice. It looks like I will have to rethink certain aspects of this project.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.