2024-10-17 09:12 PM - last edited on 2024-10-18 01:59 AM by SofLit
Hi
Using the following tools:
TouchGFX Designer 4.24.0
CubeIDE 1.16.1 and
CubeMx 6.11.0
I have attempted to build a system with ethernet capability.
I added the ethernet peripheral, LwIP compiled it without any errors, but the ethernet does not work. The router it is connected to does not "see" the MAC address and fails to assign an IP address. I have DHCP enabled.
I bolted Adam Berlinger's code into one of my projects
and that worked fine, with DHCP but the I cannot get the latest CubeMX build to work.
I have used the same board and cable that I used with Adams ethernet code for the new build so it's not the hardware.
Is the latest CubeMX build supposed to at least connect to a router and allow a ping test or do I have to do something else. The touchGFX code is working fine.
To be quite frank I find the ST Ethernet firmware and builds to be a nightmare. You basically have to be an experienced network engineer first to understand the jargon. SMTP, DHCP etc which is never spelled out in full in the cube help panel and secondly to work your way through the code which is like spaghetti to find out what is going wrong. LwIP is very clever, but its documentation is a joke considering how widely it is used. Compared to a system like FreeRTOS which has excellent documentation, a vibrant forum and heap and heaps (pardon the pun) of examples, LwIP is more like a hackers bad dream. Its been around for over twenty years yet the documentation is sparse to say the least.
The Wiki content for the socket API is just a regurgitation of the header file for the macro or function. Here is the entry for setsocketopt:
Now I'm guessing that setsockopt sets some options for the socket the application programmer is trying to instantiate. But it doesn't explain that, or what the various macro parameters do and what valid inputs they can be.
I am guessing that s is the socket handle, but what the rest of them are is beyond me. An application Programming Interface needs a lot more than code it needs an explanation of what the function does, when you should use it and what its parameters are.
Surely someone in ST could come up with some code that would provide simple things like ubiquitous for ethernet such as DHCP, mDNS, SNTP and a simple socket interface without the applications programmer needing to do a PhD in advanced network engineering. The hardware works fine, but the software...
From my little rant the perceptive among you probably sense I am just a little frustrated. I reckon I have spent more time trying to get ethernet to work than I have spent on all the other peripherals combined.
Am I being silly, am I missing something? What do others think?
Kind regards
Rob
Solved! Go to Solution.
2024-10-24 07:50 PM
2024-10-30 04:55 PM
Hi STea,
Have you had a chance to look at my last post. I continued trying to get the Ethernet to work with my TouchGFX build without success.
Kind Regards
Rob
2024-11-03 10:47 PM
Hello @Garnett.Robert ,
sorry for the delayed response. yes, indeed the tow files seem to be quite different and I suspect this may be the issue. could you replace the one generated by TouchGFX with the one From CubeMX ?
Regards
2024-11-07 10:40 PM
Hi
I did that and it stopped the rand() error, but I still couldn't get the ethernet to ping. It did show up on my router network map screen, but when I pinged it the ping kept timing out. I also tried it using Advanced IP Scanner and in that case it didn't get logged as active. I have spent hours tracing the code through and comparing it with the working Adam B version, but I cannot see where it is failing.
Kind reagards
Rob