# Ethernet and SD Card - Dual SPI Connection

**URL:** <https://forum.midibox.org/t/ethernet-and-sd-card-dual-spi-connection/18917>\
**Category:** MIDIbox SEQ\
**Tags:** spi, mbhp\_eth, enc28j60, j16, sd-card\
**Created:** [February 28, 2015, 1:44pm UTC](https://forum.midibox.org/t/ethernet-and-sd-card-dual-spi-connection/18917 "2015-02-28T13:44:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rowan](https://forum.midibox.org/user_avatar/forum.midibox.org/rowan/32/18_2.png) [@Rowan](https://forum.midibox.org/u/Rowan)\
**Post date:** [February 28, 2015, 1:44pm UTC](https://forum.midibox.org/t/ethernet-and-sd-card-dual-spi-connection/18917/1 "2015-02-28T13:44:38Z")

</div>

I haven’t been able to find any reference to this info on [uCapps.de](http://uCapps.de) and the forum so it’s reference info for anyone who wants to connect an external SD card socket and ENC28J60 based ethernet board at the same time.

Both of these devices are connected to the core with SPI. While I have been try to get them both to work at the same time I have learnt that SPI can be connected in two ways, “Star” and “Chain”. The SD card socket and ethernet module need to connected in a “Star” configuration in order to work.

Basically the two devices share Serial In (MOSI) , Serial Out (MISO) and Serial Clock (SCK) signals but each have individual Slave Select (SS) signals. The attached picture illustrates this pretty well.

 ![post-3551-0-01144600-1425130737.gif](https://forum.midibox.org/uploads/default/original/2X/7/790ab4402202c5f84e63f32ca85dabf1ef66f2c1.gif)

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [March 1, 2015, 1:25pm UTC](https://forum.midibox.org/t/ethernet-and-sd-card-dual-spi-connection/18917/2 "2015-03-01T13:25:57Z")

</div>

Thanks for pointing this out!

It could make sense to document this in the Wiki as well.

&nbsp;

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![sneakthief](https://forum.midibox.org/user_avatar/forum.midibox.org/sneakthief/32/55_2.png) [@sneakthief](https://forum.midibox.org/u/sneakthief)\
**Post date:** [March 6, 2015, 11:24pm UTC](https://forum.midibox.org/t/ethernet-and-sd-card-dual-spi-connection/18917/3 "2015-03-06T23:24:25Z")

</div>

Heads up: this is a currently big issue for anybody wanting to use OSC over ethernet with projects like MIDIbox CV V2. When the SD card is inserted, the ethernet module doesn’t function!

&nbsp;

&nbsp;

Seems I have a different issue here than I originally thought. Taking this to a different thread.

---

<div class="post-metadata">

**Author:** ![Rowan](https://forum.midibox.org/user_avatar/forum.midibox.org/rowan/32/18_2.png) [@Rowan](https://forum.midibox.org/u/Rowan)\
**Post date:** [March 7, 2015, 2:27pm UTC](https://forum.midibox.org/t/ethernet-and-sd-card-dual-spi-connection/18917/4 "2015-03-07T14:27:33Z")

</div>

The SD Card uses RC1 as SS and the Ethernet module uses RC2 as SS.

I have both working at the same time configured this way, no changes to the code are necessary.

One thing I did find that the Ethernet module wouldn’t work running off the 3.3v suppy from J16. I had to jump 5V from the discovery board to get it to work.

---

<div class="post-metadata">

**Author:** ![sneakthief](https://forum.midibox.org/user_avatar/forum.midibox.org/sneakthief/32/55_2.png) [@sneakthief](https://forum.midibox.org/u/sneakthief)\
**Post date:** [March 7, 2015, 6:09pm UTC](https://forum.midibox.org/t/ethernet-and-sd-card-dual-spi-connection/18917/5 "2015-03-07T18:09:57Z")

</div>

I tried both 5V and 3.3V. Whenever I insert the SD card, the ethernet just dies:

&nbsp;

[http://discourse.midibox.org/t/topic/18930](http://discourse.midibox.org/t/topic/18930)

---

<div class="post-metadata">

**Author:** ![CJ55](https://forum.midibox.org/user_avatar/forum.midibox.org/cj55/32/407_2.png) [@CJ55](https://forum.midibox.org/u/CJ55)\
**Post date:** [March 7, 2015, 7:35pm UTC](https://forum.midibox.org/t/ethernet-and-sd-card-dual-spi-connection/18917/6 "2015-03-07T19:35:12Z")

</div>

I would not use 5V for the ENC28J60. The absolut maximum rating according to the data sheet is 3.6V

Some other interesting informations from the ENC28J60 data sheet:

Supply Voltage: Min. 3.1V, Typ. 3.3V, Max. 3.6V

Operating Current: Typ. 120mA to 160mA, Max. 180mA

And here some facts from the STM32F4DISCOVERY:

The STM32F4 microprocessor is powered by only 3.0V (that means all outputs are also only 3.0V)

There is a voltage regulator (LD3985M33R) on the board which indeed outputs 3.3V, but there is a diode (BAT60J) after it with a voltage drop of 0.3V =\> 3.0V.

And the max. current the voltage regulator can deliver is 150mA. According to the data sheet of the DISCOVERY board it can provide max. 100mA for external sources.

Conclusion:

To operate the ENC28J60 you need an additional 3.3V source. Maybe another voltage regulator (5V -\> 3.3V).

---

<div class="post-metadata">

**Author:** ![Rowan](https://forum.midibox.org/user_avatar/forum.midibox.org/rowan/32/18_2.png) [@Rowan](https://forum.midibox.org/u/Rowan)\
**Post date:** [March 7, 2015, 10:05pm UTC](https://forum.midibox.org/t/ethernet-and-sd-card-dual-spi-connection/18917/7 "2015-03-07T22:05:08Z")

</div>

The board I’m using has a 5V \> 3.3V circuit so I’m safe there. The point you make about the voltage drop on the diode is valid and could explain why I’m having no dice with the 3.3V supply from J16.

---

<div class="post-metadata">

**Author:** ![CJ55](https://forum.midibox.org/user_avatar/forum.midibox.org/cj55/32/407_2.png) [@CJ55](https://forum.midibox.org/u/CJ55)\
**Post date:** [March 7, 2015, 10:41pm UTC](https://forum.midibox.org/t/ethernet-and-sd-card-dual-spi-connection/18917/8 "2015-03-07T22:41:31Z")

</div>

Ok, I just wanted to point out that the STM32F4DISCOVERY board delivers only 3.0V and not 3.3V and only 100mA.

The schematic of the MBHP CORE\_STM32F4 is wrong in this regard.

The ENC28J60 needs min. 3.1V (and max. 3.6V) and between 120mA and 180mA.

---

<div class="post-metadata">

**Author:** ![sneakthief](https://forum.midibox.org/user_avatar/forum.midibox.org/sneakthief/32/55_2.png) [@sneakthief](https://forum.midibox.org/u/sneakthief)\
**Post date:** [March 9, 2015, 4:44pm UTC](https://forum.midibox.org/t/ethernet-and-sd-card-dual-spi-connection/18917/9 "2015-03-09T16:44:50Z")

</div>

I used a 3.3V bench power supply and I still get errors when the SD is also connected.
