Skip to main content
Bilge
Associate III
December 5, 2018
Question

Need help to run Ethernet communication correctly with STM32H7 nucleo?

  • December 5, 2018
  • 16 replies
  • 14828 views

 Is there anybody who can ran ethernet communication correctly with stm32h7 nucleo?

This topic has been closed for replies.

16 replies

Technical Moderator
December 5, 2018

Hello @Bilge​ ,

I suggest you to start with a working Ethernet example and follow the recommendations mentioned in this FAQ:

https://community.st.com/s/article/FAQ-Ethernet-not-working-on-STM32H7x3

Kind Regards,

Imen.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Bilge
BilgeAuthor
Associate III
December 5, 2018

Hi,

You don't have an ethernet instance running.I didn't use freertos and there is only http example for nucleo board.I made all steps in docs but it was packets losses when I ping .

KR1
Associate III
December 12, 2018

I can affirm that the Ethernet is, as of 12/12/2018, still buggy in the H7 firmware. I have found that the only remedy to get Ethernet running on H7 MCUs (the NUCLEO-H743ZI development board, to be exact), is to use an older version of STMCube. The HTTP example LwIP_HTTP_Server_Netconn_RTOS (which is suggested as a proper working implementation in the online FAQ) can only properly work with STM32Cube_FW_H7_V1.1.0. The same exact example from the latest firmware package (1.3.0) is only operational for a couple of minutes. After some time, the device simply becomes unresponsive: it does not respond to ping prompts and the MCU-implemented website does not load anymore. I have tested the LwIP_HTTP_Server_Netconn_RTOS example from both FW_1.1.0 and FW_1.3.0 on the same development board and on the same network (I should also add that I didn't add any code of my own), and I can assure that the example from the older firmware works just fine, whereas the newer one is unstable.

I really wish this issue is fixed in the firmware update.

Bilge
BilgeAuthor
Associate III
December 13, 2018

Thank you for reply.I decided to change stm32h7 mcu and I will think to buy i.mx rt 1020 mcu of nxp.ST employees always give same reply about ethernet communication for stm32h7 nucleo board.

Joerg Wagner
Senior III
December 30, 2018

I had a lot of trouble with H743 and sometimes I thought H stands for hobby,

so much time I had to spent with. After 1 year still no status quo to work professional.

You have to insert assembler code in the startup function to use RAM domain D3, hello? (Thanks to @Community member​ )

No IDE prepares the linker script to use Ethernet properly. Very high learning curve for someone who worked with other brands.

The differences in ethernetif.c from @Imen DAHMEN​  are not like "Hey there were important bugs fixed, now I'm sure it works.". It's more like "Okay, we switch off D-Cache and look what the customers are reporting". I wanted to develop a complex board with H743 but I'm so scared about this step. i.MX RT1064 has a linear memory layout for example. H7 has bridges no one knows how the routing works. For example: the reference manual RM0433 says on page 99 "Ethernet DMA can access SRAM4", I'm still not able to use it.

And why are there no CubeMX examples from ST? There were so many bugs in the past in this useful tool. When you work with this every day you would take more care of it. I wish ST the best for 2019, it lacks in software not hardware (except F76x version A).

Technical Moderator
December 13, 2018

Hello @Bilge​ ,

Sorry for the inconvenience it may bring you.

Can you please provide more details on your issue and the steps you have followed that can help us of the further analysis. 

Please check the connection on Jumpers JP6 & JP7 and try to close these jumpers correctly, replacing the header plugs by soldering. Then, keep us informed about your updates.

Thank you for your understanding.

Kind Regards,

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
KR1
Associate III
December 13, 2018

Dear Imen,

This issue has nothing to do with physical connections. Quite a few people in this forum have notified about this issue on the H7 series. It is clearly a firmware fault. I would advise the STM engineers to actually run the LwIP_HTTP_Server_Netconn_RTOS example (on FW 1.3.0) on the NUCLEO-H743ZI development board and to periodically check the board's status by pinging it (or by reloading the pre-programmed webpage). The device will eventually become unreachable. It is hard to pin-point when this failure exactly happens. In my experience the Ethernet crash can occur from several minutes to several hours of device running time.

Technical Moderator
December 20, 2018

Hello All,

We confirm the ping issue with the package STM32Cube_FW_H7_V1.3.0.

The problem was fixed internally and will be available in next release of STM32CubeH7 V1.4.0, which will be available next year.

Attached you will find the ethernetif.c which contains the fix of the issues reported within STM32Cube_FW_H7_V1.3.0.

Please, keep us informed about your progress on this issue and feel free to share feedback with us.

Happy Holiday season!

Kind Regards,

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
JongOk Baek
Associate III
December 21, 2018

Dear imen,

Thanks for your reply.

I was disappointed with the formal response, previously.

I will test your code on my board.

And, I will report for you as result.

Thanks again.

brath
Associate II
December 23, 2018

hello everyone

im new stm32 im using stm32h743zi i want to send udp packet can anyone one suggest the exact procedure to send a udp packet using lwip

Joerg Wagner
Senior III
December 31, 2018

I created a project in CubeMX 5.0 from scratch.

The modified ethernetif.c was not used, just the

one created from CubeMX.

TCP, UDP and Ping work, tested it for 20 hours.

IDE's are SW32STM and TrueStudio.

Joerg Wagner
Senior III
January 2, 2019

Basically there should be no difference to TrueSTUDIO. I built a project in CubeMX 5.0 from scratch and compiled it with TrueSTUDIO. It runs for days without an error, TCP, UDP and ICMP.

You have to take care of the additional sections for ETH in the linker file and the right MPU config, regardless which IDE is used.

KR1
Associate III
January 2, 2019

This is really weird. I tried to follow your suggestions but I did not have any luck. Truth be told, I was not able to get Ethernet running at all. I find this really odd because I can get it running without FreeRTOS. I have done it in the past, as desribd in https://community.st.com/s/question/0D50X00009nM9wPSAS/lwip-problems-from-code-generated-via-stm32cubemx-smt32h7 . I've redone all the steps on CubeMX 5.0 and this approach still seems to be operational (I did not run any long term test on it though). On the other hand, everything seems to go haywire if I enable FreeRTOS. I can reiterate the steps that I take to enable LwIP/FreeRTOS. They are, as follows:

  1. Set the HCLK to 400 MHz (clocked from the HSI);
  2. Enable the ETH peripheral, set it to RMII mode, and set ETH_TXD0 and ETH_TX_EN pins to PG13 and PG11 (others are mapped appropriately);
  3. Set Very High Speed to all the pins (except PC1/ETH_MCD which always defaults to Low);
  4. Enable the CPU ICache and DCache (under Cortex_M7 Configuration);
  5. Enable the LWIP middleware;
  6. Enable FreeRTOS;
  7. Enable global Ethernet interrupt (with the priority of 5);
  8. Select LAN8742/LAN8742 as the Driver_PHY (under LwIP>Platform Settings)
  9. Enable ICMP (LWIP_BROADCAST_PING and LWIP_MULTICAST_PING in LwIP Key Options>IPMP Options).
  10. Set stack/heap to, appropriately, 0x800/0x400;
  11. Generate the code
  12. Edit main.c by adding the MPU_Config function from https://community.st.com/s/article/FAQ-Ethernet-not-working-on-STM32H7x3 . I add a call to this function in the very beginning of my main();
  13. Edit the linker file to partition the RAM from 0x24000000 to 0x2407FFFF;

As I’ve mentioned earlier, everything works if I skip step #6 and add the additional lines of code required for networking in the infinite while loop (see https://community.st.com/s/question/0D50X00009nM9wPSAS/lwip-problems-from-code-generated-via-stm32cubemx-smt32h7 ). I tried enabling MBEDTLS, but that did not seem to have any effect. Am I missing a crucial step, because all of this seems very bizarre?

CodesMagic
Associate II
June 10, 2019

Hi dear KR

May I ask you to upload your file (without rtos) ?

I can't ping my board yet.

Thank you in advance.

Joerg Wagner
Senior III
January 2, 2019

Please post your MPU_Config() and

the section of the linker file where the Ethernet descriptors are defined.

KR1
Associate III
January 2, 2019

OK, I think I have actually found the problem. I retraced my steps and found an additional parameter change that I forgot to mention. In order to regain the IP address whenever the connection is lost, I had both LWIP_NETIF_API and LWIP_NETIF_LINK_CALLBACK enabled (both in LwIP->Key Options->Network Interfaces Options). Defaulting them back to a disabled state got the Ethernet running on H7. I will have find a way to get them running though, because I need the ability to reconnect/gain a a new IP address after a physical connection change or network failure.

Joerg Wagner
Senior III
January 2, 2019

This can be done with the callback function:

void ethernetif_notify_conn_changed(struct netif *netif)
{
 ...
}

MX_Master
Associate
January 3, 2019

Hi, I made a new example project here - <LINK NO LONGER ACTIVE>

This project uses LwIP stack without RTOS. There is a HTTPD (web server) example too.

I spent 3 days to make all settings right.

Configuration info can be found in the README.

Joerg Wagner
Senior III
January 3, 2019

Hi, you forgot one MPU region in MPU_Config().

MX_Master
Associate
January 3, 2019

Did you mean 16 kB for RX buffers starting at 0x30040200?

And one more interesting thing.. why we need to protect the 16kB block starting at 0x30044000? I'm just copypasted the config of this block from the LwIP_HTTP_Server_Netconn_RTOS. I can't find any code using this block of RAM.