2020-03-01 09:22 AM
Update 4:
The definition of these variables was missing (FW_F4 1.25.0), the generated code did not insert this part:
File Src/lwip.c (line 58)
void MX_LWIP_Init(void)
{
/* IP addresses initialization */
IP_ADDRESS[0] = 192;
IP_ADDRESS[1] = 168;
IP_ADDRESS[2] = 1;
IP_ADDRESS[3] = 111;
NETMASK_ADDRESS[0] = 255;
NETMASK_ADDRESS[1] = 255;
NETMASK_ADDRESS[2] = 255;
NETMASK_ADDRESS[3] = 0;
GATEWAY_ADDRESS[0] = 192;
GATEWAY_ADDRESS[1] = 168;
GATEWAY_ADDRESS[2] = 1;
GATEWAY_ADDRESS[3] = 1;
/* Initilialize the LwIP stack without RTOS */
lwip_init();
Update 3:
STM32CubeMX version 5.6.0 (FW_F4 1.25.0) did not work.
STM32CubeMX version 5.5.0 (FW_F4 ?) did not work.
STM32CubeMX version 5.4.0 (FW_F4 1.24.2) worked.
STM32CubeMX version 5.2.0 (FW_F4 1.24.1) worked.
STM32CubeMX version 4.27.0 (FW_F4 1.19.0) worked.
STM32CubeMX version 4.22.0 (FW_F4 1.16.0) worked.
Update 2:
I downloaded STM32CubeMX version 5.2.0 (FW 1.24.1) and it worked.
STM32CubeMX version 5.6.0 did not work.
I imported the Atollic project (made with FW1.24.1) in STM32CubeIDE (1.3.0) and it worked.
So it's not a problem with the STM32CubeIDE, but with the FW package.
I will download (STM32CubeMX) the versions between 5.2.0 and 5.6.0, it seems that at some point there was some change that should not have occurred.
=========== X ============
Update:
I managed to make it work with STM32CubeMX version 4.22.0 (FW 1.16.0) but it didn't work with STM32CubeIDE 1.3.0 (FW 1.25.0)
=========== X ============
I found an example, step by step, of using the LAN8720, including video, but ping.exe is not receiving responses.
It seems that there were some changes in the automatic code generation.
What could be happening?
The LEDs on the network card are showing activity, the connections between STM32F407VG and LAN8720 show activity only at startup, should there be activity all the time?
(The material is in Russian, but using subtitles and translators it is possible to understand)
Website:
http://narodstream.ru/stm-urok-96-lan8720-lwip-tcp-client-chast-2/
Movie:
https://www.youtube.com/watch?v=L8nLqsp5nSo
I found other tips too, but it didn't work:
https://community.st.com/s/question/0D50X00009XkduA/use-lan8720a-for-phy-init-ethernet
2020-03-01 01:50 PM
Too early. Not enough information. Load your app in a debugger. Put a breakpoint where you receive a packet. Step until you find where it fails or you find some prerequisite of what you're stepping isn't ok. If it doesn't reach your breakpoint, investigate its init.
2020-03-01 02:06 PM
I tested another sample code written for the Arduino platform, and it worked. STM32 was able to access the internet, and ping.exe received the correct answer.
Begin Ethernet
Success to configure Ethernet using DHCP
localIP: 192.168.1.103
subnetMask: 255.255.255.0
gatewayIP: 192.168.1.1
dnsServerIP: 192.168.1.1
Seconds since Jan 1 1900 = 3792088790
Unix time = 1583099990
The UTC time is 21:59:50
Note: Need to edit stm32f4xx_hal_conf_default.h (LAN8720 addr = 0x01)
/* Section 2: PHY configuration section */
/* LAN8742A PHY Address*/
#define LAN8742A_PHY_ADDRESS 0x01U
Source code:
https://github.com/nopnop2002/Arduino-STM32-Ethernet-LAN8720
2020-03-01 02:07 PM
I did exactly what the person who did the tutorial did, around the year 2017. So I believe that there was a change in the code that IDE is generating.
2020-03-03 10:07 AM
I managed to make the ping.exe part work. I downloaded STM32CubeMX version 4.22.0, this version was already with the FW package of version 1.16.0.
The video shows SW4STM32, but I couldn't find instructions on how to install this IDE. So, I compiled with Atollic version 9.3.0.
2020-03-03 10:08 AM
STM32CubeMX old versions, links:
2020-03-03 04:27 PM
If anyone has any problems with this, try version FW_F4 V1.24.2 or earlier (STM32CubeMX 5.4.0 or earlier).
(More details were added in the first post)
Setup:
2020-03-04 09:04 PM
Correction - Package: FW_F4 V1.24.2 worked.
====== X =======
I was unable to get STM32CubeIDE V 1.3.0 to work with FW_F4 V1.24.1, so I uninstalled the IDE.
I installed version 1.1.0, and for some reason, there was some confusion with the FW_F4 packages, and even after starting the project with FW_F4 V1.24.1, FW_F4 V1.25.0 was appearing when compiling, and it didn't work (ping.exe didn't get a response).
So I opened the package repository folder and removed all packages.
I uninstalled everything again, STM32CubeIDE and STM32CubeMX.
I installed STM32CubeMX V5.4.0 again and the reference for the FW_F4 1.24.2 package appeared (instead of 1.24.1).
I tested with this STM32CubeMX V5.4.0 + FW_F4 V1.24.2 configuration and it worked.
2020-03-09 09:06 AM
Hi @Amel NASRI,
Let me know if your team was able to identify the problem with the ping.
I'm trying to use DNS, but FW_F4 1.24.2 doesn't allow DNS functions to be activated when generating the code, I can only activate it manually (does not seem to find the reference in the lwipopts.h file).
In FW_F4 1.25.0 it seems that this problem with DNS has already been resolved. So, I wish I could use the latest version of FW_F4.
Thank you.
2020-03-09 03:39 PM
Oh Boy! Please confirm what was found.
I created two new projects, one with FW_F4 1.24.1 and the other with FW_F4 1.25.0.
I compiled the project with FW_F4 1.24.1 with Atollic (because there I can configure STlink to just download), the ping (ICMP) worked. The FW_F4 1.25.0 project did not work, as expected.
So I was replacing the project files with FW_F4 1.24.1 until it stopped working. I tapered until I got to the lwip.c.
Then, with the help of the ExamDiff program, it was easy to notice something missing in the file created with FW_F4 1.25.0, as follows: