cancel
Showing results for 
Search instead for 
Did you mean: 

[bug fixes] STM32H7 Ethernet

alister
Lead

@Amel NASRI​, @ranran​, @Piranha​, @Harrold​, @Pavel A.​ 

V2 of my fixes and improvements to H7_FW V1.5.0/V1.6.0 Ethernet...

Changes include

  • Decoupling receive buffers from receive descriptors so buffers may be held any length time without choking receive.
  • Optionally queuing transmit, so transmit doesn't need to block until complete.
  • Many bug fixes.

Find full details and source in the attached zip. V1 was posted to another developer's question. Please post any questions about V2 here.

97 REPLIES 97

Hello Alister or ST colleagues. Can somebody tell if the current version of the STM32H7 ETH driver has fixed the issues of 2019 and 2020?. Thanks for your feedback

I don't use a recent HAL driver version and couldn't say.

The low number of issues with the official HAL driver at https://github.com/STMicroelectronics/stm32h7xx_hal_driver suggests it would be ok.

The Ethernet driver attached here contains more than bug fixes; notably decoupling rx buffers from DMA descriptors.

Thanks for your answer Alister. I am trying the newest driver (1.9.0) with mixed results. In my application I send a huge amount of packets from one custom board with several ADC's driven by the STM32H743 and a computer with Labview. My current experience is that if the computer has sufficient processing power and is capable of reacting to the packages the board runs for hours without issues. If it is underpowered though at one point the communication stops and the board does not longer react to TCP packets (it reacts to pings though). I have to reset the STM32H743 to be able to get TCP packets again.

Any clue if this might be related to an issue known to you in the old driver?

Can only guess. Suggest instrument to isolate where the communication stops, and then confirm or add whatever it needs to recover.

Some areas to check:

  • Where are receive and transmit pbufs allocated from? Refer pbuf_alloc and its recommendations.
  • What recovery is there when Ethernet receive is unable to repopulate/reactivate a receive DMA descriptor?
  • What are the dimensions of receive/transmit buffers and DMA descriptors? The driver should continue to work, albeit degraded, if dimensioned too small. But it might assume they would never be exhausted.
  • The lwIP API and thread-safety of your implementation.

As this is discussing 1.9.0. Please post about it to a new thread.

KB.2
Associate II

I would like to start communication between the server and the embedded system.

I am using Hercules as the server and STM32F746Disco as the client.

But my transmission is not working and I don't know why. In the attachment I am sending the program and the report from Wireshark.

I will just add that when I use STM32F746Disco as a server and Hercules as a client, communication works.

Can anyone have a similar problem and can share the solution?

Thank you!

This code, which comes from there, breaks just about all the possible rules there are:

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
	char buf[100];
 
	/* Prepare the first message to send to the server */
	int len = sprintf (buf, "Sending TCPclient Message %d\n", counter);
 
	if (counter !=0)
	{
		/* allocate pbuf */
		esTx->p = pbuf_alloc(PBUF_TRANSPORT, len , PBUF_POOL);
 
 
		/* copy data to pbuf */
		pbuf_take(esTx->p, (char*)buf, len);
 
		tcp_client_send(pcbTx, esTx);
 
		pbuf_free(esTx->p);
	}
 
}

Absolutely ALL of those function calls are forbidden to make from an ISR! The pbuf_free() can be made callable from ISRs, but that's not the default configuration. And sprintf() depends on a platform implementation, but sanely designed software doesn't call printf functions from ISRs anyway. That ControllersTech.com site is just a ridiculously low quality junk from India. The guy just don't understand what he is doing at all. He is even less competent that the already tragic ST's HAL team...

And not only you have to fix the application, but also the broken ST's implementation of Ethernet and lwIP:

https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32

Thank you Sir for information.

Amel NASRI
ST Employee

Dear All,

Our Experts tried to answer almost all the limitations reported in this thread.

Please refer to this post for more details.

At this point, I suggest to close this discussion as it becomes difficult for us to follow it with the great number of comments.

Don't hesitate to submit your new posts asking new questions.

Thanks for all the ones involved to make ST solutions more efficient.

-Amel

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.