RFID Reader + Ethernet Shield

Hi Everybody,

I'm currently trying to get the Ethernet Shield + Mifare RC522 running. Each device on it's own is running like charm. But when I put them together they won't work any more. I connected the MISO/MOSI/SCK of both devices. The Shield of course uses Pin 10 for Chip Select. The RC522 is using pin 51. So there shouldn't be any mistake in wiring?

After some googling I found out that the Ethernet shield supposed to have an flaw in its circuit. It doesn't mater if you put HIGH or LOW to the Ethernet Shields chip select pin. It always reads/writes from/to MISO/MOSI. Can you confirm this issue?
Has the current version of the Ethernet shield a fix for that?
Or how can these be fixed?

Some posts in the internet said that using an signal inverter for chip select and connecting it to the SEN pin of the W5100 should fix this. I tried that but it didn't worked. Maybe I made a mistake. I'm not quite sure if I located PIN 31 correctly.

Sorry for my bad english. I hope somebody can help me :slight_smile:

The Shield of course uses Pin 10 for Chip Select. The RC522 is using pin 51.

On which Arduino? The only ones that have 51+ pins are the Mega and the Due, and on them, pin 10 is not the Ethernet shield chip select pin.

The only ones that have 51+ pins are the Mega and the Due, and on them, pin 10 is not the Ethernet shield chip select pin.

PaulS, which pin is the CS for the Ethernet in that case? The arduino docs page seem to suggest it is 10
http://arduino.cc/en/Main/ArduinoEthernetShield

This is on digital pins 10, 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used to select the W5100 and pin 4 for the SD card. These pins cannot be used for general I/O. On the Mega, the hardware SS pin, 53, is not used to select either the W5100 or the SD card, but it must be kept as an output or the SPI interface won't work.

I'm currently trying to get an nrf24l01 and SD card (on ether shield) to work together. They work separately, but not in combination, and CS conflict is what i'm looking into.

MB

The arduino docs page seem to suggest it is 10

OK, so I'm wrong.

I think that you are right about SPI conflicts being the source of the problem, though. Perhaps both devices have different ideas about how SPI should be configured.

Personally, I wouldn't be using the nrfs. Too many problems. I use XBees. No problems. Except cost.

After some googling I found out that the Ethernet shield supposed to have an flaw in its circuit. It doesn't mater if you put HIGH or LOW to the Ethernet Shields chip select pin. It always reads/writes from/to MISO/MOSI. Can you confirm this issue?

No. The ethernet shield and the SD library play well together.

Test each separately with both devices connected to the Mega. Try the RFID code first with this added to the setup.

void setup() {
  // disable w5100 SPI
  pinMode(10,OUTPUT);
  digitalWrite(10,HIGH);

  // disable SD SPI
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  // rest of your setup

Does this do any better?

Yes my arduino is a due. Each device on its own is working perfectly. But when i combine the MOSI/MISO/SCK lines of both devices the Ethernet shield stops working. The rf522 is still working. I can receive data from the RFID chip.
I also tried different chip select pins. This hasn't solved the problem either.
I also tried to do the chip select on my own. Like the code example posted above.

I found the following qoute from wiznet: "One difference between other SPI slave devices compared to the W5100 is that the MISO output is continuously driven in the W5100 whether the /SCS is asserted as high or as low".

So it doesn't matter what Signal to put on the chip select the MISO will be active the whole time.
Is there a fix for that ?

mnoeth93:
I found the following qoute from wiznet: "One difference between other SPI slave devices compared to the W5100 is that the MISO output is continuously driven in the W5100 whether the /SCS is asserted as high or as low".

So it doesn't matter what Signal to put on the chip select the MISO will be active the whole time.
Is there a fix for that ?

That is not true, so it doesn't need a fix. I use the SD card with the w5100 with great success, as do others here, and both are SPI devices.

It may be the RFID library is not controlling the slave select for that device correctly, but I do not have one here to test.

But when i combine the MOSI/MISO/SCK lines of both devices the Ethernet shield stops working.

This would indicate the RFID is not sharing the MISO line, or the RFID would fail and the w5100 would override it.

edit: Post your code and I will try to help you determine the problem.

This forum user got his nRF24 (SPI device also) working with the w5100.
http://forum.arduino.cc/index.php?topic=231493.0

Ok I solved the problem. There were to major problems.

The Ethernet Shield has a hardware flaw. The MOSI line is active the whole time. It ignores it's chip select signal. FIX: I bought a new Ethernet shield that included a fix.

The cable (~7m) between the arduino and the RFID reader had a lot of noise an signal reflection on it. FIX: I replaced the cable with a shielded cable and added two resistors. The first one at the RFID readers side (I connected it with SCK and GND) and the second one on the arduinos side (SCK and GND)

It took some time to get everything to work but now I'm totally happy =)

mnoeth93:
The Ethernet Shield has a hardware flaw. The MOSI line is active the whole time. It ignores it's chip select signal. FIX: I bought a new Ethernet shield that included a fix.

The MOSI line (Master Out, Slave In) should be active the whole time. It would be the MISO line (Master In, Slave OUT) that would cause problems.

Which ethernet shield model had the flaw? Which model did you replace it with?

hello good your contribution'm working with a meja and rfid rc522, I want To connect the ethernet and send data out there but I could not'd help with some of your code I study and to learn you help me please, committed me my workplace to make a rfid locks colsultas and send to server and the worst is that I can not come up with anything bad, I have the rfid working ok I only need to integrate rthernet

BOA NOITE DE NOVO ESTOU TENTANDO ABRIR UMA PORTA PARA ACESSO ESTERNO MAS NÃO ESTOU CONSEGUINDO SEGUNDO INFORMAÇÕES LIDA NA INTERNET É QUE OS PROVEDORES (VIVO) OU (NET) NÃO ESTÃO DEIXANDO ABRIR NENHUMA PORTA SE PUDER DAR UMA AJUDA EU AGRADECERIA AS PROGRAMAÇÃO NO MEU ROTEADOR JÁ REALIZEI SÓ QUE NÃO ABRE A PORTA DESEJADA QUE ESTOU PROGRAMANDO. DESDE JÁ AGRADEÇO.