0
\$\begingroup\$

I am trying to connect the STM32F103 (blue pill) with the specific w5500 module via the SPI bus. The physical connection I made was

SCS  -> PIN14
SCLK -> PIN15
MISO -> PIN16
MOSI -> PIN17

Uploaded a sample sketch from Ethenet 2 library, but nothing works. It seems like the processor or the module itself, keeps resetting.

I have connected successfully the Ethernet module previously on Arduino nano, with out any issues.

With the blue-pill, I cannot even find the device on the network while port scanning.

So two questions arise:

  • Have I connected correctly the pins?
  • Should I make any changes to the code to enable SPI at the bluepill, since it may serve two different SPI's?

enter image description here

enter image description here

enter image description here

\$\endgroup\$
11
  • \$\begingroup\$ What do you mean by "seems like the processor or the module itself, keeps resetting"? Even if you have nothing connected to the SPI pins or a malfunctioning slave device it should just cause your reads to fail. Do you get the same behavior when you completely disconnect the SPI pins? \$\endgroup\$
    – nvuono
    Commented Sep 12, 2019 at 17:54
  • 1
    \$\begingroup\$ @KingDuken: The W5500 is a complete SPI-to-Ethernet communications module. \$\endgroup\$
    – Dave Tweed
    Commented Sep 12, 2019 at 19:15
  • 1
    \$\begingroup\$ Many STM32 have an integrated Ethernet MAC, and are powerful enough to run an IP stack. Therefore, the crutch which are W5500 (and similar modules that are mostly intended to be used with 8bit micros) are not necessary here. There are several STM32 eval boards available that feature an Ethernet connection. \$\endgroup\$
    – Erlkoenig
    Commented Sep 13, 2019 at 8:05
  • 1
    \$\begingroup\$ @DaveTweed it is not. It is the complete SPI to TCP/IP solution :) /It of course includes the Ethernet*/ \$\endgroup\$ Commented Sep 13, 2019 at 8:30
  • 1
    \$\begingroup\$ 22€ is not a fortune. \$\endgroup\$
    – Erlkoenig
    Commented Sep 13, 2019 at 17:56

1 Answer 1

1
\$\begingroup\$

I decided using SPI1 from the STM32 processor.

So, i mapped the physical connections as

SCS  -> PA4
SCLK -> PA5
MISO -> PA6
MOSI -> PA7

The trick was adding this line

 Ethernet.init(PA4);

before the method.

Ethernet.begin(mac)

By default, the pin used for Arduino is PIN10.

By using Ethernet.init(PA4); we override that pin, with PIN14 (PA4),

suitable for STM32 and have a working solution.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.