Change NFC Shiled Chip Select

Hello Guys,

I would like to know how to change the NFC Shile Chip Select to be 7, for example, instead of the default 10? I want to use the NFC Shiled with the official ethernet shiled which uses at the same time pin 10 for the ethernet and 4 for the SD card make SPI communication.

I have tried to write 7 in defining the SS constant in the sketch but without any success. I also tried to hack the PN532.cpp and added in the begin function the following:

pinMode(10, OUTPUT);
digitalWrite(10, HIGH);

as recomended by arduino, so PIN 10 (the SS hardware designated PIN) keeps in output mode even if isn’t used but still without any success.

It only works in I define the SS constant as 10 in my sketch. I use Arduino UNO

Thank you and any help would be highly appreciated

Hello,

if you want to use another pin for CS you must cut the wire to arduino pin 10 on your shield pcb and make a jumper wire to your new pin.
You can also use a pin matrix (sparkfun.com/products/11002) to make shields with same pinusage compatible.

Rony

Hello Rony,

I thought I could do it using software…

Anyway, thank you so much the quick replay.

I just did what Rony suggested and it worked perfectly (used a jumper wire).

Now when I mount the NFC shield over the Ethernet official shield it seems that I cant read the Mifare Card using teh same same skech that woked with Arduino + NFC shield (without the ethernet shiled).

I’m sure I’m missing something because I’m completely new to all of these :slight_smile:

Thank you a lot in advance

I think the problem could be that neither the NFC Shield nor Th Ethernet shield have ICSP connector (in the same position as the ICSP on Arduino boards) that passes the signals along ?

Any help would be appreciated… Thank you

You must cut the CS wire (conductor?) to pin 10 on your NFC Shield. Any SPI device need a wire to a free digital pin.
Ethernet and NFC use the same pin so they dont want work together.

edit
The ICSP header on NFC Shield only is a ISP combatible breakout for pins 10,11,12 and 13. If it is not connected to arduino this have no effect.

edit2
Oh you must pull down pin 4 and pin 10 to use another SPI device. Only one device can be active same time.
Just set 10 and 4 LOW and it would work.

// set all CS as output
pinMode(4, OUTPUT);
pinMode(7, OUTPUT);
pinMode(10, OUTPUT);

// only one device can be active
digitalWrite(4, LOW);
digitalWrite(7, HIGH);
digitalWrite(10, LOW);

Thank you Rony, I will give it a try and will give you a feedback.

Unfortunately it doesn’t work.

It does alone with the Arduino but not all together (Ethernet, NFC, Arduino).

With all of them mounted I have tried a Sketch that only deals with the ethernet shield and it works. But when I try to upload a sketch that only deals with the NFC shield, this doesn’t work. I set the pins 10 and 4 as ouput and set them to HIGH (I think HIGH is the correct way to get them down and not LOW, according to the Arduino documentation). But anyway I have tried both ways without any success.

Anway, Thank you so much, Rony for trying to help…

Sorry you are right. SS Pin must be HIGH.
Take a look in the ethernet shield schematic. Pin 4 state is controlled via pin 10 state with a logic device.
Google says there is no way to get this combination work… :frowning:
You can try “bit banging” SPI. Ask Google :wink:

Still not working :frowning:

Can any body help with this taking in the consideration that we did all the above steps?

Freetonics says about the official ethernet shield: “The W5100 has a design flaw that causes it to maintain control of the SPI bus even when another device has been selected”

Someboday knows some hack to solve this?

Edit 1

I think I figured out the problem and it is that The standard Arduino shield uses the Wiznet5100 chipand this chip has a flaw in that the CS signal does not tri-state the MISO line. Has a look here: john.crouchley.com/blog/archives/662
I hope we can fix it so we may help others to do the same.

hi,the SPI pins on the NFC Shield doesn’t connect to the pin 10,11,12,13, they just connect to the ICSP. So, you must mount the NFC Shield above the Ardunio Uno not the Ethernet Shield.

Hi wenyihou,

You are completely right. I have connected the ICSP pins and guess what? it works :slight_smile:

Thank you so much. You have mad my day, man!!!

PS: is this mentioned in the schematic?