cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Ethernet on STM32 H723ZG

shuyu_vk
Associate

Hi all!

 

I have been using a F446RE board to communicate with an encoder using SPI. I get back a 16-bit value every ms (the process runs at 1kHz). However, I now need to transfer the acquired data over ethernet (it has to be ethernet, not UART or another communication, as it goes through a switch) to a computer in packages ~once per second. I bought an H723ZG board because it comes with a ethernet port, but I have been having a lot of trouble setting up ethernet, as I have had very little prior experience with it. 

 

I have researched more into how ethernet works, and tried the following things:

1. I followed this tutorial, with the difference that I changed "RMII_TX_EN" to PG11 and "RMII_TXD0" to PG13 as per the schematic for my board. I set up my CPU, ETH:First Rx/Tx Descriptor Addresses, and LWIP:Ram Heap Pointer as per the video (respectively, 0x30000000, 0x30000080, 0x30002000 for rx/tx/lwip ram heap). The code compiles and when I debug there is no hard fault, but I am unable to ping the device. I have my mac set to 192.168.000.030 and the device to 192.168.000.123 with subnet mask 255.255.255.000 and gateway address 192.168.000.001

2. I tried using the STM32 H723ZG example projects "LWIP_UDP_Echo" and "LWIP_TCP_Echo". When I turned off DHCP in lwipopts.h and set my mac to ip 192.168.000.030 and subnet 255.255.255.000 I was able to ping the microcontroller successfully, but I could not get it to echo using the command echo -n "Testing LwIP UDP echo server" | nc -u 192.168.0.10 7

I also spent a lot of time scrolling this community/stackoverflow/reddit, where a lot of people suggested giving up on LWIP and CubeMX and instead just using FreeRTOS + TCP. I am not very familiar with FreeRTOS although I understand the principles, and I have not coded an STM32 microcontroller using anything other than CubeMX or PlatformIO (Arduino). Furthermore, my code for communicating with the encoder/collecting data was written in CubeMX so I am hesitant to try and port it. 

 

I am starting to get really confused and don't know what to do next, so I thought I'd make my own (first time!) post. I am really hoping someone could point me in the right direction:

1. For my (relatively simple) purpose, would you recommend continuing with LWIP/CubeMX or abandoning it and trying to use FreeRTOS.

2. If FreeRTOS is the solution, can this be easily implemented with CubeMX or do I have to use another software?

3. If continuing with LWIP/CubeMX is the solution, can someone point me towards what I might be doing wrong? I have uploaded screenshots of all the relevant configurations/code I used following the tutorial I linked.
4. Am I using the right board? I have heard lots of people complain about H7. Would my task be easier to accomplish on an F7?


Thank you all immensely for your help in advance!

Screen Shot 2024-06-21 at 2.07.16 PM.png

Screen Shot 2024-06-21 at 2.07.44 PM.png

Screen Shot 2024-06-21 at 2.08.06 PM.png

Screen Shot 2024-06-21 at 2.08.19 PM.png

Screen Shot 2024-06-21 at 2.08.40 PM.png

Screen Shot 2024-06-21 at 2.08.55 PM.png

Screen Shot 2024-06-21 at 2.09.07 PM.png

Screen Shot 2024-06-21 at 2.10.43 PM.png

3 REPLIES 3
STOne-32
ST Employee

Dear @shuyu_vk ,

First welcome in STCommunity and posting the first message . Our members for sure will interact with your case .

 

This is my contribution: if you can share please your hardware setup I mean the schematics or which board issued and especially the PHY routing and clocks, we need first to eliminate any hardware issue and to run an exemple from the templates .

The  , please refer to this Knowledge Article and the GitHub Hot spot code here 

https://community.st.com/t5/stm32-mcus/how-to-create-a-project-for-stm32h7-with-ethernet-and-lwip-stack/ta-p/49308

 

@STea  your help is appreciated.

Ciao

STOne-32

Pavel A.
Evangelist III

@shuyu_vk Note that ethernet controllers in STM32F4, STM32H7, F7 are different and the examples are not interoperable. Start from an example for a board similar to yours. Unfortunately most of these examples were made without CubeMX/IDE GUI support and do not have .ioc file. 

The FreeRTOS project has their own fork of low level drivers, it may be better than LwIP if you're going to use FreeRTOS. But CubeMX/IDE does not provide much help with this library.

Bottom line, a project with ETH on a custom board  (especially with a different PHY) is not a good choice for a beginner. You may want to find a consultant or invest more time and effort.

 

 

STea
ST Employee

Hello @shuyu_vk ,

this command you trying to use is trying to send UDP packets "echo -n "Testing LwIP UDP echo server" | nc -u 192.168.0.10 7"  and" LWIP_TCP_Echo "what server or client?

you will need to test it with something generating TCP packets for the TCP server example and UDP packet for the UDP server example.

you can find a working example on this Github link in which you can find template projects for different H7 Boards with Ethernet Support.

Please Let us know if you are facing issues running those examples.

You can build on this template working your way to construct a packet and implement proper memory management of your Data to speed up the sending process.

Regards

 

 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.