Serasidis / Ethernet_STM

WIZnet W5500, W5200, W5100 ethernet library for 8-bit, 32-bit Arduino and STM32F1 (STM32F103) micro-controllers
61 stars 24 forks source link

SPI pin map #3

Open karimiahmad opened 4 years ago

karimiahmad commented 4 years ago

I have an w5500 board that used SPI2 of STM32f103c8t6 for communication with W5500 chip. (PB12.PB13.PB14.PB15)

https://wiznetmuseum.com/portfolio-items/stm32f103c8t6-w5500-learning-board/

Please help me. thanks.

Serasidis commented 4 years ago

Supposing that you use the https://github.com/stm32duino/Arduino_Core_STM32 Core, a quick fix is to edit the Ethernet_STM\src\utility\w5100.cpp file.

  1. Replace: #define STM32_SPI_CS PA4 with #define STM32_SPI2_CS PB12
  2. Replace all _STM32F1_ references to SPI. with SPI2. in w5100.cpp file
  3. Open the Arduino IDE and recompile a library example (e.g. WebClient.ino)
karimiahmad commented 4 years ago

It did not work. :(

Serasidis commented 4 years ago

Do you have you the schematic diagram of that board ?

karimiahmad commented 4 years ago

STM32F103C8T6+W5500 学习板原理图.PDF

This is schematics.

https://wiznetmuseum.com/portfolio-items/stm32f103c8t6-w5500-learning-board/

Serasidis commented 4 years ago

Perhaps PB12 (SCS pin) is not initialized properly. Try to re-initialize it in setup function

void setup() {
  pinMode(PB12, OUTPUT); // <<<<------ HERE --------
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
}
jrcassatec commented 4 years ago

It did not work. :(