Hard fault while sending huge data through ethernet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-09 04:39 AM - last edited on 2025-01-09 04:43 AM by Andrew Neil
"We are facing a hard fault issue in our code when sending a large amount of data. Occasionally, it runs properly, but most of the time, it goes into a hard fault after sending approximately 10,000 bytes. The image data we are sending is around 40 KB. Interestingly, sending 'Hello World' in a loop works successfully without any faults. I have also tried increasing the lwIP options sizes through a trial-and-error approach, but the issue persists. I have been struggling with this problem for the past 20 days and have not been able to resolve it. I am using the STM32H723VGT6 microcontroller. Please help me resolve this issue."
- Labels:
-
Ethernet
-
LwIP
-
STM32CubeIDE
-
STM32H7 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-09 04:46 AM - edited 2025-01-09 04:52 AM
@utkarshchaurasiya36 wrote:I have been struggling with this problem for the past 20 days and have not been able to resolve it.
So what have you tried in those 20 days?
What have you discovered?
Debugging Hard Faults:
LwIP Debugging:
PS:
@utkarshchaurasiya36 wrote:Occasionally, it runs properly, but most of the time, it goes into a hard fault after sending approximately 10,000 bytes.."
If it does work occasionally, that could suggest a timing issue somewhere...
Some general debugging tips:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-13 03:00 AM - last edited on 2025-01-13 03:03 AM by Andrew Neil
Duplicate - merged. Please don't create new threads on the same topic.
"We are facing a hard fault issue in our code when sending a large amount of data. Occasionally, it runs properly most of the time, but sometimes it goes into a hard fault /mem handler fault after sending approximately a few bytes. The image data we are sending is around 10 KB. Interestingly, sending 'Hello World' in a loop works successfully without any faults. I have also tried increasing the lwIP option sizes through a trial-and-error approach, but the issue persists. I have been struggling with this problem for the past 5 days and cannot resolve it. I am using the STM32H723VGT6 microcontroller. Please help me resolve this issue."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-13 05:15 AM
"cam_bsnet Debug [STM32 C/C++ Application]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-13 05:50 AM
So look into the code at that point to see what's going on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-14 06:43 AM
Hello @utkarshchaurasiya36 ,
it seems like you run out of memory at some point or a pointer to a stack is corrupted.
I recommend you follow How to debug a HardFault on an Arm Cortex®-M STM32 - STMicroelectronics Community to determine what is the root cause of the hardfault.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-14 08:12 AM
I have put the lwIP heap and pbuf pool into AXI SRAM / D1, maybe try that.
You won't run out of memory that quick - but I have actually no idea how the OS or you are handling the lwIP pool memory...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-16 04:54 AM
I am working on a project using the STM32H723VGT6 controller with the DP83848VV Ethernet IC (MII interface) and FreeRTOS. I need assistance optimizing the lwipopts file settings to send large data (e.g., 40 KB images) efficiently over Ethernet.
I have attached a screenshot of my current settings, but I believe some values might not be configured correctly. Could you please suggest the best values for key LWIP options like TCP_MSS, TCP_WND, PBUF_POOL_SIZE, etc., to handle large data transmission smoothly? Please suggest the best value and look on the screenshot which I attached.
Thank you for your guidance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-17 12:27 AM
I have been trying to solve the same problem for a few days.
I can read 21500 bytes of ethernet tcp data correctly in Keil. But I still can't do it in STM32CubeIde. If I can solve it, I will share
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-01-17 01:26 AM - edited 2025-01-17 01:29 AM
yes, please can you please share lwipots.c file