Arduino UNO with ENC28J60 module and SD card module

Hi, I'm trying to connect ENC25J60 and SD card module to Arduino Uno at the same time. They work fine separately, but whenever I try to connect them together, they fail.

I have connected the devices as follows: - MISO to pin 12, MOSI to pin 11 and SCK to pin 13 for both modules - CS of ENC25J60 to pin 8 - CS of SD card module to pin 4

For ethernet module I'm using EtherCard library.

To test the modules, I have first connected only one of them to Arduino and they work fine (I've used backSoon example from EtherCard and ReadWrite example from SD library). Then I've connected them together and tested them with the same examples - ReadWrite example works, but backSoon doesn't (unless I unplug SD card cables, then it starts working immediately).

I've tried setting pin 4 to high before attempting to communicate with ethernet module, but still nothing. I have also tried using another Arduino Uno and the problem remained.

Is there something I'm missing about SPI?

do you have pin 10 as output?

Yes, pin 10 is set to output.

However, I think I've just solved the problem. The SD card module was not releasing the MISO line when the CS was set to high. I thought that it might be related to the fact that SD card runs on 5V and ethernet module on 3.3V, so I just added 220 Ohm resistor between SD card MISO and Arduino and apparently it works now both for ethernet and SD card, though I'm not sure if my reasoning was correct.

Anyway, thank you for your help.

Hi Polelum,

Did you fix this problem using 220 Ohm resistor or buy a new sd card reader?

I tried your solution, however my sd module didn't work with this.

Regards,

torm732: Hi Polelum,

Did you fix this problem using 220 Ohm resistor or buy a new sd card reader?

I tried your solution, however my sd module didn't work with this.

Regards,

many SD card adapters don't work with other SPI devices because the logic level conversion doesn't release the MISO line. and the enc28j60 Nano shield has the same problem

Hi Juraj,

Should i buy new different sd card modules and try again? Or have you any suggestions about this issue?

Thanks a lot for your answer.

torm732: Hi Juraj,

Should i buy new different sd card modules and try again? Or have you any suggestions about this issue?

Thanks a lot for your answer.

and what is not working in your case? is it an enc28j60 module? post links to exact module models you use. what Arduino model? what sketch do you use to test it?

Hi Juraj,

I want to make a web server, data logger with ultrasonic sensor and, i2c lcd, rtc module, sd module, enc28j60 module and arduino mega 2560. However, i have a problem using ethernet and sd card module together. My ide v. 1.8.13.

I want to use sd card module and ethernet module together. My code works fine if i remove vcc pin of my SD module from the board. However, if they are connected, my code doesn't work. My lcd ekran shows the requirements of my code until arrive this line "if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0)". Then, lcd screen freezes.

My pins;

Arduino Mega 2560

Rtc module: Clk: 24, dat: 26, rst: 28, vcc: free

Ultrasonic modül: Trig: 34, echo: 32

Sd kart modül: Mosi: 51, miso: 50, sck: 52, cs: 4

Lcd i2c ekran modül: Scl: 21, sda: 20, gnd and 5v vcc

Ethernet modül: Cs: 10, and icsp pins

do you have link where you bought the SD card adapter? follow the MISO trace on the adapter. does it go directly to card holder or it goes to level conversion IC?

Hi Juraj,

My sd card module link is below.

https://www.roboshop.com.tr/arduino-micro-sd-kart-modulu?search=Arduino%20Micro%20SD%20Kart%20Mod%C3%BCl%C3%BC

Could you please check miso line on the adaptor. I can't understand it.

Thank you.

torm732: Hi Juraj,

My sd card module link is below.

https://www.roboshop.com.tr/arduino-micro-sd-kart-modulu?search=Arduino%20Micro%20SD%20Kart%20Mod%C3%BCl%C3%BC

Could you please check miso line on the adaptor. I can't understand it.

Thank you.

I think it is the same adapter as one I have and has the MISO line problem. I can compare it later. do you want to fix it with some trace cutting and fine soldering or a recommendation for a good one? the Adafruit SD card adapter is good, but not so cheap.

I researched to get a better quality sd card adapter. However, all sd card modules sold domestically are of Chinese origin. I found an adaptor (RobotDyn), link is below. Maybe, it can solve this problem. So, i really want to try fix it with some trace cutting and fine soldering, if you direct me.

https://www.robolinkmarket.com/sd-ve-mikrosd-yuksek-hizli-modul?gclid=Cj0KCQjwpNr4BRDYARIsAADIx9yDQLXqyDn0UGPLeSPET-jddulLXfjoUWHUSexLhhwDEIrIQz0XaRgaAryKEALw_wcB

Additionally, i will search sd card adaptors which you will suggest me.

Thank you.

Regards,

the Robotdyn adapter has MISO on logic level conversion 'buffer' IC and it is not a three state buffer. so it has the problem.

Juraj, does the sd card module in the link below work?

https://www.robolinkmarket.com/sd-kart-modulu

How can i fix my sd card adaptor i am using now? If you have any tutorial about this, could you please send me a link.

Thank you.

torm732: Juraj, does the sd card module in the link below work?

https://www.robolinkmarket.com/sd-kart-modulu

How can i fix my sd card adaptor i am using now? If you have any tutorial about this, could you please send me a link.

Thank you.

this one doesn't have proper level conversion. there are voltage dividers or something similar. it is not good for SPI communication.

Hi Juraj,

I found a Sparkfun Sd adaptor, link is below. Will it work for me?

https://www.domirobot.com/sparkfun-sd-mmc-card-breakout-pmu3875?gclid=Cj0KCQjwpNr4BRDYARIsAADIx9zbImDvNo2l0AsdhF3_CZkT-7uHXPYXoPgx96Iu8ibB5_dEs0FHAsMaAqJBEALw_wcB

Also, how can i fix my sd card adaptor i am using now? If you have any tutorial about this, could you please send me a link.

Thank you.

torm732:
Hi Juraj,

I found a Sparkfun Sd adaptor, link is below. Will it work for me?

SparkFun SD / MMC Card Breakout - Uygun Fiyata Satın Al! | DomiRobot.com

Also, how can i fix my sd card adaptor i am using now? If you have any tutorial about this, could you please send me a link.

Thank you.

this is not an adapter. it is only a holder. it can be used only with a 3.3V MCU. 5V MCU would damage the SD card.

the general description of the fix is to cut the trace (or remove a resistor) between the PCB pin labeled MISO and the level conversion IC and then bridge the card holder MISO pin with the PCB MISO pin (or with the trace to it). MISO is “master in slave out” so 3.3 V of SD card to input pin of MCU. the MCU will read 3.3 V as HIGH.

I didn’t after my adapter yet.

Hi Juraj,

My problem was solved by the following post of pollelum. However, I could not understand how this resistance solves this problem. Is this a healthy solution?

polelum: Yes, pin 10 is set to output.

However, I think I've just solved the problem. The SD card module was not releasing the MISO line when the CS was set to high. I thought that it might be related to the fact that SD card runs on 5V and ethernet module on 3.3V, so I just added 220 Ohm resistor between SD card MISO and Arduino and apparently it works now both for ethernet and SD card, though I'm not sure if my reasoning was correct.

Anyway, thank you for your help.

1 Like

I guess that makes the pull-up by the level conversion IC weaker and gives the signal on MISOl from the other SPI device a chance. But it makes signals from both devices weaker then.

Hi Polelum,

I had the same issue with an STM32F103C8 (Blue pill), ENC28J60 module (https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQq3pq7J8ZGbM9m5dPmzmXoASMFMizFsPdtUw&usqp=CAU) and this micro SD card adapter (https://alexnld.com/wp-content/uploads/2015/10/db630567-53c0-4084-86b8-139fb2b4546e.jpg)

I used the 220 Ohms resistor and both devices worked fine.

Thanks a lot, best regards.