A-Star SPI / Enc28J60 Questions

I have one of the ENC28J60 break out boards - the 12 pin / 5V version (it has a 3.3v voltage regulator on-board). I was able to get it working with an ethernet library on an A-Star 32U4 Mini SV.

  1. I am wondering, however, how the library knows what pins to select for SPI. I believe this is the file that defines pins:

I’m assuming that some of the if statements are checking to see if the board being written to matches a specific model, and then sets pins accordingly.

Right now, hooking the ethernet board up to RXL (SS), SCK, MOSI, MISO - which appear to correspond to pins 17, 15, 16, 14 works as expected with their example TCP server. But… it would be nice to know where in that file it actually happens.

  1. Finally, the ENC28J60 is a 3.3v chip, and the Mini is 5v. I read online that while it needs to be powered by 3.3v, the SPI connection would be tolerant of 5v. I know you carry a logic level shifter - not sure if this is necessary or not.



Some additional info - the datasheet on the ENC280J60 says the SPI pins are 5V tolerant:


The ENC28J60 is a 3.3V part; however, it was designed to be easily integrated into 5V systems. The SPI CS, SCK and SI inputs, as well as the RESET pin, are all 5V tolerant. On the other hand, if the host controller is operated at 5V, it quite likely will not be within specifications when its SPI and interrupt inputs are driven by the 3.3V CMOS outputs on the ENC28J60. A unidirectional level translator would be necessary.

An economical 74HCT08 (quad AND gate), 74ACT125 (quad 3-state buffer) or many other 5V CMOS chips with TTL level input buffers may be used to provide the necessary level shifting. The use of 3-state buffers permits easy integration into systems which share the SPI bus with other devices. Figure 2-5 and Figure 2-6 show example translation schemes.

For the ATmega32U4, documentation says it supports voltages between 2.7-5.5V. However, since the board is running at 5V, does this mean the SPI interface should be driven at 5V as well?


We did not make that Ethernet board, so we are not very familiar with how its Arduino library works. You might consider asking its author about that.

How well SPI works with the 5V ATmega32U4 on the A-Star depends on the VOH (the Output High Voltage) of your Ethernet board. The ATmega32U4 on the A-Star recognizes voltages as low as 1.9V as digital high (when VCC is 5V), so if the ENC28J60 VOH is above that, I would expect SPI to work.


Ok - it sounds like the board will work without level shifters! We’ll have to run it for a while to make sure there are no issues.

As for how the library determines the right set of pins - I realize it isn’t a Pololu library, but I’m mostly curious about how the library chooses the pins to use. I’ll post in an arduino-specific forum to see if anyone there can shed some light on that file.