STM32F103 + W5500 + Ethernet 2.0

Post Reply
matrixxx
Posts: 12
Joined: Sat Apr 08, 2017 9:55 am

STM32F103 + W5500 + Ethernet 2.0

Post by matrixxx » Fri Feb 22, 2019 8:42 pm

Hi all,

im trying to get the ethernet 2.0 working on a STM32F103C8. Like Stevestrong mentioned in viewtopic.php?f=15&t=3927, i downloaded the Ethernet2_STM32.zip he posted there.

I was using rogers core until now, but to work with the ethernet 2.0 from steve, i need to change to his core.

I am using linux, a stm32f103c8 blue pill, a w5500 and my path is /home/werkstatt/Arduino/hardware. Rogers core is in that dircetory called arduino_stm32. All is working fine. I can build sketches and work normally.

So i took steves core from github, deleted the subcontent and put everything from steve in to arduino_stm32 like i did with rogers core before.

I just created a sketch with only Serial.begin(9600) in it and got this error message:

Code: Select all

/home/werkstatt/Arduino/WebServer-222/WebServer-222.ino: In function 'void setup()':
WebServer-222:57:3: error: 'Serial' was not declared in this scope
Serial.begin(9600);
^
/home/werkstatt/Arduino/WebServer-222/WebServer-222.ino: In function 'void loop()':
WebServer-222:76:5: error: 'Serial' was not declared in this scope
Serial.println("new client");
^
exit status 1
'Serial' was not declared in this scope
Using the webserver example code, i got the same error. So i started to outcomment all Serial-calls. Doing this, the next error is:

Code: Select all

/home/werkstatt/Arduino/hardware/Arduino_STM32/STM32F1/cores/maple/usb_serial.cpp:140:5: error: redefinition of 'int USBSerial::available()'
int USBSerial::available(void) {
^
In file included from /home/werkstatt/Arduino/hardware/Arduino_STM32/STM32F1/cores/maple/usb_serial.cpp:31:0:
/home/werkstatt/Arduino/hardware/Arduino_STM32/STM32F1/cores/maple/usb_serial.h:53:17: error: 'virtual int USBSerial::available()' previously defined here
virtual int available(void) { return usb_cdcacm_data_available(); }
^
exit status 1
Error compiling for the board Generic STM32F103C series.
What am i doing wrong? I can reproduce it by just changing back and forth the content of the arduino_stm32 content: using rogers content => all is fine. Using steves content => errors.
I followed the instructions http://stm32duinoforum.com/forum/index.php?title=Installation and http://stm32duinoforum.com/forum/index.php?ti ... n_on_Linux on my installation.

What am i doing wrong?

Mike.

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: STM32F103 + W5500 + Ethernet 2.0

Post by stevestrong » Sat Feb 23, 2019 11:30 am

Where have you extracted the Ethernet2 zip file content?
If it is the Arduino/libraries folder, then you have to rename the Ethernet.h file from extracted lib to Ethernet2.h, and change it in each cpp and header file, too, otherwise Arduino will include his default generic Ethernet library. Or you delete the default Arduino lib form your hard drive.

Furthermore, I don't know what is inside your sketch, but the default webserver example from the zip package should give you a type of error different from than you pasted here.
That error you can fix by replacing line 53 of EthernetClinet.cpp with this line:

Code: Select all

	if (ip == IPAddress((uint32_t)0) || ip == IPAddress(0xFFFFFFFF)) return 0;

matrixxx
Posts: 12
Joined: Sat Apr 08, 2017 9:55 am

Re: STM32F103 + W5500 + Ethernet 2.0

Post by matrixxx » Fri Mar 01, 2019 4:19 pm

HI Steve,

thanks for answer. But the first problem is, that i cannot use your fork.

My sketch is just a Serial.begin(9600) in the Setup function. no Library involved... To see how i can get further, i just used the simple webserver example. but i cannot even get to the fix or webserver sketch... 'Serial' was not declared in this scope.

I can reproduce it by just changing back and forth the content of the arduino_stm32 content: using rogers core => all is fine. Using steves core => Serial was not declared in this scope.

Mike.

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: STM32F103 + W5500 + Ethernet 2.0

Post by stevestrong » Fri Mar 01, 2019 6:51 pm

Please paste here a picture of the Arduino ide showing your code and containing the error message.

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: STM32F103 + W5500 + Ethernet 2.0

Post by stevestrong » Sat Mar 02, 2019 7:38 am

I just pushed a fix for conflicting USBSerial.available definition, which was not there on my PC because I use the latest GC version.
Please check if it works now.

matrixxx
Posts: 12
Joined: Sat Apr 08, 2017 9:55 am

Re: STM32F103 + W5500 + Ethernet 2.0

Post by matrixxx » Sun Mar 03, 2019 3:02 pm

Hi Steven,

thanks for helping me. Unfortunatly its still not working. I downloaded the repo and changed to yours. Made a vy basic sketch (blink), but i still have the same problem.
See attached the requested sketch and my setup.

Thanks for digging into it. What should i do next?
Mike.
Attachments
223.jpg
223.jpg (29.7 KiB) Viewed 185 times
222.jpg
222.jpg (34.93 KiB) Viewed 185 times

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: STM32F103 + W5500 + Ethernet 2.0

Post by stevestrong » Sun Mar 03, 2019 3:15 pm

I was expecting a screenshot of the IDE, not a picture of it.
A screenshot gives information about the selected board and other options selected over menu.
-
stm32_IDE.jpg
stm32_IDE.jpg (33.62 KiB) Viewed 184 times

And please post (as code) all the text from the IDE message window.

Be aware, that "Serial" is strictly linked to USBSerial in my core.
For this to work, you have to enable USB serial in boards.txt. By default, it is enabled when you upload over USB DFU (smt32duino bootloader).
In particular, if you select "Serial" as upload method, the USB serial is disabled.
For upload methods other than DFU you have to use the compiler option: -DSERIAL_USB
https://github.com/stevstrong/Arduino_S ... s.txt#L374

Have you tried Serial1?

BTW, your BOOT0 jumper seems to be set to 1, but it should be set to 0 (GND) for DFU upload.

matrixxx
Posts: 12
Joined: Sat Apr 08, 2017 9:55 am

Re: STM32F103 + W5500 + Ethernet 2.0

Post by matrixxx » Sun Mar 03, 2019 4:49 pm

Hello again,

ok, no problem. i added the screenshot. the message windows says (i just did a verify):

Code: Select all

Build-Optionen wurden verändert, alles wird neu kompiliert
/tmp/arduino_modified_sketch_708836/Blink.ino: In function 'void setup()':
Blink:29:20: error: 'begin' was not declared in this scope
   Serial,begin(9600);
                    ^
/tmp/arduino_modified_sketch_708836/Blink.ino: In function 'void loop()':
Blink:38:10: error: 'class USBSerial' has no member named 'printl'
   Serial.printl("mu");
          ^
exit status 1
'begin' was not declared in this scope
Same with Serial1.begin();

As said im using USB2ttl - i do not have the smt32duino bootloader on it. So i added
genericSTM32F103C.menu.upload_method.serialMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG -DSERIAL_USB

Yet no success, Serial1.begin(9600) also made no change - lets see how far we can get :) Thanks so much.
MIke.
Attachments
111.png
111.png (55.17 KiB) Viewed 165 times

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: STM32F103 + W5500 + Ethernet 2.0

Post by stevestrong » Mon Mar 04, 2019 10:32 am

I hope you realized that both are typo errors...

matrixxx
Posts: 12
Joined: Sat Apr 08, 2017 9:55 am

Re: STM32F103 + W5500 + Ethernet 2.0

Post by matrixxx » Mon Mar 04, 2019 7:30 pm

hi steve,

haha, you are right - im in the age i have to use my glasses while programming... i should really wear them. anyway, thanks for your patience. I really didnt see the "," :P so i used

Code: Select all

// Arduino Mega using all four of its Serial ports
// (Serial, Serial1, Serial2, Serial3),
// with different baud rates:
void setup(){
  Serial.begin(9600);
  Serial1.begin(38400);
  Serial2.begin(19200);
  Serial3.begin(4800);
  Serial.println("Hello Computer");
  Serial1.println("Hello Serial 1");
  Serial2.println("Hello Serial 2");
  Serial3.println("Hello Serial 3");
}
void loop() {}
(copy & paste) => Verify is ok. So no more errors. The fix you posted seems to work. Will check ethernet2.0 in the next days. take care and thankyou so much :)

MIke.

Post Reply