Need to connect Mega with internet with ENC28J60 module and UIPethernet library. Problem is where to change cs pint to 53? I looked for it through whole files but or i didn't find where it is declared or it had to be declared inside sketch. I am not sure how to make Mega work with this module with UIPEthernet library.
CS pin is configured in Enc28j60Network.h:
#define ENC28J60_CONTROL_CS SS // this is pin 10 on Uno and pin 53 on Mega256
OK, but should i change SS with 53?
No need to. SS is already defined as 53 when you are compiling for Mega:
#define PIN_SPI_SS (53)
static const uint8_t SS = PIN_SPI_SS;
Then, what could be wrong?
When i use ethercard library everything goes fine when i set SS pin to 53, and with UIPEthernet it is not. Wiring are the same. My guess was that i need to set SS to pin 53 for Mega.
Any suggestion what should i try?
I tried all examples from UIPEthernet and none worked. From Ethercard worked all when i set SS to 53.
It seems my wiring are ok, but problem is that my MEGA can not communicate with ENC28J60 module with UIPEthernet library through SPI pins.
Or i must set SS pin to 53 somewhere, or i must set in driver that i am using MEGA instead of UNO. Something is just not right.
Also posted at:
If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information. When you post links please always use the chain links icon on the toolbar to make them clickable.
Sorry for that, never think about that issue.
Do you know the way to make Mega work this way or not?
I can tell you that I've successfully used the ENC28J60 with Arduino Mega and the UIPEthernet library but it's been a long time since I messed with that chip (I've been using W5100 and W5200 instead) so I can't remember the exact details.
Just for a lark, try wiring the ENC28J60 CS pin to pin 10 on your Mega to see if it might be hardcoded to that pin, as is the Arduino Ethernet library. That would make some sense as UIPEthernet is meant to be a drop in replacement for the Ethernet library.
Tried that. Tried to change pins in Enc28J60Network.h file. Tried sorcery. It just won't work.
Ethercard works well.