I have a clone of the Arduino Ethernet shield R2, and I already hooked it up on an Arduino Uno, as explained in a previous post. But I also have an STM32 Nucleo-F103RB board, which is similar to Arduino with respect to many of its pins, so I wanted to try this shield with it.
The main problem with putting them together is that the Ethernet shield should be connected to the lower board through a special 6-pin connector called ICSP, but the Nucleo board doesn’t have it. I studied the schematics of the Arduino Ethernet shield R2, where it can be seen that the ICSP brings the SPI signals from the Arduino below (which is the SPI master) to the Wiznet W5100 chip on the shield (which is the SPI slave). From the Arduino Uno schematics we can confirm that the ICSP is connected to MISO, MOSI and SCK signal, that are also connected to the usual Arduino pins 11, 12 and 13. Unfortunately, on the Ethernet shields the pins 11, 12 and 13 are disconnected, so if the ICSP is not connected, the SPI communication can’t work. In contrast, the ICSP connects also the RESET, GND and +5V signals, but these signals also pass through the Arduino connectors, so they can work even without the ICSP connector.
Inside Nucleo board user manual there are the schematics of the Nucleo board. From those, we can follow the signals from pins 11, 12 and 13 of the Arduino connectors (here labeled D11, D12 and D13) to see that they are connected to the PA5, PA6 and PA7 pins of the STM32F103RB. From its Datasheet we can then confirm that these pins can be configured as SPI signals, specifically SPI1_SCK, SPI1_MISO and SPI1_MOSI.
My idea is to use jumper wires to bring the SPI signals to the ICSP from the pins 11, 12 and 13 of the Arduino connector on the Ethernet shield. This will connect the SPI1 master pins from the STM32 through the Arduino connector, then through my jumper wires, then through the ICSP connector, finally to the SPI slave pins of the W5100 chip. ICSP pin numbering can be deduced by searching for a dot on one of the 6 pins, on the top side of the shield: that is the pin number 1. So I take three wires and connect:
- MISO: pin 1 of the ICSP to pin 12 of the Arduino connector,
- SCK: pin 3 of the ICSP to pin 13 of the Arduino connector,
- MOSI: pin 4 of the ICSP to pin 11 of the Arduino connector.
The result is shown in the photo below.
Then, in order to see if the connection worked, I wrote a small program for the STM32 that communicates with the W5100 through SPI, to check that the chip internal resources can be accessed. I will explain what I did in a later post because there are many parts in play; if you are impatient, the code is here, on a GitHub repository that I use for these tests.