arduino-libraries / Ethernet

Ethernet Library for Arduino
http://arduino.cc/
259 stars 264 forks source link

Run with any SPI port on boards with multiple SPI #134

Open KooLru opened 4 years ago

KooLru commented 4 years ago

For use another than defined SPI "port", you need:

  1. Declare an SPI class object with appropriate pins

SPIClass SPI_2(PB15, PB14, PB13);

I have try SPI2 on STM32F103xB also known as "Blue pill"

  1. Call Ethernet.init()

Ethernet.init(SPI_2, PB12);

  1. Profit!

I also add this line in DhcpAddressPrinter sample, and define for Serial port, for debug on boards with more than one UART

aaron-neal commented 4 years ago

@KooLru nice! Needed this and it works as described!

CLAassistant commented 3 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Ralf9 commented 3 years ago

do I need this patch too, if I only want change the pins of spi-1? I want at the maple mini use the w5500 lan module at the pins of spi-2 this does not work:

SPIClass SPI_1(28, 29, 30);  // SPI2 pins
Ethernet.init(31);
Ethernet.begin(mac);  // DHCP