Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Nucleo-STM32F429ZI - LwIP

I am trying to set-up a No-OS version of LwIP for the Nucleo-STM32F429ZI. Starting with a new project for the board, adding lwip, the project fails for:
Description Resource Path Location Type
fatal error: config.h: No such file or directory lwip_check.h /Hello-Ethernet/Middlewares/Third_Party/LwIP/test/unit line 6 C/C++ Problem

Did I miss something?

I will answer my own question.
The project was not set up correctly from MXCube. Comparing a similar project found on

http://www.carminenoviello.com/2016/01/22/getting-started-stm32-nucleo-f746zg/Question

the resources for lwip were not completely configured. Once I got it fully configured also using FreeRTOS, config.h is in the project.

However it still falis to compile:
Description Resource Path Location Type
make: *** Middlewares/LwIP/init.o Error 1 Hello_Ethernet C/C++ Problem
Description Resource Path Location Type
redefinition of ‘struct timeval’ Hello_Ethernet line 313, external location: C:\Users\Greg\workspace\AC6\necleo-f429ZI\Hello_Ethernet\Middlewares\Third_Party\LwIP\src\include\lwip\sockets.h C/C++ Problem

When I implemented FreeRTOS I was warned in MXCube regarding the use of systick as a time base source for SYS with the OS selection. I switched the source to TIM1. I am not sure if this has any bearing on what I am seeing. Not even sure if TIM1 is the correct choice since there is a lack of guidence.

Still waiting to know if anyone has gone down this path before.

Stuck in the same place as you, are you able to yourself give guindance now? :-)

- I selected TIM1
- I have the struct timeval issue too

Thanks for your help

Inside /Inc/lwipopts.h make this

/* Within ‘USER CODE’ section, code will be kept by default at each generation */
/* USER CODE BEGIN 0 */

  1. define LWIP_TIMEVAL_PRIVATE 0


/* USER CODE END 0 */


gregreenwood - double check that is it not building. I have had simular errors, but they are editor errors not compiler errors. Eclipse will sometimes determine that a symbol is not defined when it actually is defined. Look at the console at the end of the build, you may be getting a valid ELF file.

I think the problem is that HAL uses some precompiler commands to determine if the include file should be included and sometimes Eclipse’s parsers don’t decode the commands correctly.

-Matt


It is not building.
However, if I go into the file (sockets.h) and change the #define from 1 to 0 for:

  1. ifndef LWIP_TIMEVAL_PRIVATE
  2. define LWIP_TIMEVAL_PRIVATE 0
  3. endif

  1. if LWIP_TIMEVAL_PRIVATE

struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};

  1. endif /* LWIP_TIMEVAL_PRIVATE */

forcing the compiler to skip the definition, and thus the error, the code does compile.
Do not know what impact this will have.
I am sure I am not supposed to have to change the files generated by MXCube but I do not know what controls the defs within the sockets.h file.

-Greg


The defines in this file are controled by Cube depending on if you have lwIP checked in the pinouts tab.

Under configuration -> MiddleWares -> LWIP -> Enabled

If LWIP is grayed out that’s because the etherware port is not set.

-Matt

-SOLVED-
I finally found a permanent fix for this. In the CubeMX repository search for sockets.h. You will likely find it in the ../MiddleWares/Third_Party/LwIP/src/include/lwip directory of the FW version for the family type downloaded. Search “#define LWIP_TIMEVAL_PRIVATE” and change the 1 that follows to a 0. Now whenever CubeMX pulls the source it will correct. Interesting that there is a comment ahead of the code that reads :
/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided
* by your system, set this to 0 and include in cc.h */


If you are working with the STM32CubeMX Tool - open the LWIP configuration dialog and add a user constant LWIP_TIMEVAL_PRIVATE with value 0 for the specific project. So you will get the same result without hacking the shipped libs, even after an update of the CubeMX repositiory.

Chris


I am still facing the problem of not connecting to the network after solving all these compilation issues.
I tried with FreeRTOS+LwIP with DHCP enabled option. But no success.

My board is: NUCLEO-F429ZI
Below are the debug messages:
dhcp_timeout(): restarting discovery
dhcp_discover()
transaction id xid(5851f42d)
dhcp_discover: making request
dhcp_discover: realloc()ing
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, DHCP_SERVER_PORT)
udp_send: added header in given pbuf 0x20007768
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x0000
udp_send: ip_output_if (,,,,0x11,)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 60000 msecs

Any guess, what is happening in this case?

I also tried with Static (DHCP Disabled) option, but still I couldn’t able to see or ping this NUCLEO from my remote PC.

Your help is much appreciated.

Thanks,
Hari

Assuming you are compiling without error:
I would definetly start with DHCP disabled and set an IP that your remote connection can deal with. For example, in the remote machine set the network adaptor in the ipv4 properties for an IP of 192.168.0.100 with a subnet mask of 255.255.255.0, and a gateway of 192.168.0.1. In the MXcube configuration set the lwip IP address to 192.168.0.10. Not that the MXcube IP value is critical but the last octet cannot be the same as the remote (100 vs 10) and the first three octets must match (192.168.0).


I just created another project with Debug Messages enabled and configured with Static IP as suggested above.

Below are the messages I could see it on my Debug Terminal window:

etharp_request: sending ARP request.
etharp_raw: sending raw ARP packet.
etharp_timer
etharp_timer

Configuration details.

Remote Computer (Windows):

IP Address: 192.168.0.100
Subnet Mask: 255.255.255.0
Gateway: 192.168.0.1

NUCLEO:

IP Address: 192.168.0.10
Subnet Mask: 255.255.255.0
Gateway: 192.168.0.1

‘ping’ command response on Remote PC:

ping 192.168.0.10

Pinging 192.168.0.10 with 32 bytes of data:
Reply from 192.168.0.100: Destination host unreachable.
Reply from 192.168.0.100: Destination host unreachable.
Reply from 192.168.0.100: Destination host unreachable.
Reply from 192.168.0.100: Destination host unreachable.

Ping statistics for 192.168.0.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Because of size limitation, I couldn’t be able to attach my project.

Thanks,
Hari

Please note that the connection between remote PC and NUCLEO is through a network switch.

Hello,

Were you able to solve this problem? Because now I’m facing the same situation you mentioned a while back.

Thank you


 

Newest Forum Posts

  1. Монтаж камина с грилем в Москве - установка и барбекю by KpddomErorb, 2025-05-10 18:28
  2. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  9. Build a project in "release" mode by tang, 2025-02-20 10:36
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35

Last-Modified Blogs