cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746G-Discovery – HardFault during LwIP Init + Netif setup

Vivek711
Associate II

Hello everyone,

I am working with the STM32F746G-Discovery board and trying to send ADC sensor data to a cloud server over Ethernet using LwIP (RMII mode). The goal is to send a JSON payload via HTTP POST.

What I have implemented so far

  • Enabled Ethernet (RMII) in CubeMX

  • Enabled LwIP (static IP)

  • Enabled ADC1 and UART6 for debugging

  • Generated code using AC6/GCC

  • Added JSON formatting + http_post() call

Issues I am facing

1) HardFault during LwIP initialization

The system crashes right after:

MX_LWIP_Init();
netif_set_up(&gnetif);

A HardFault occurs before DHCP/static IP becomes active.

2) DMA descriptor memory placement errors

The compiler/linker shows errors such as:

  • DMARxDscrTab memory out of range

  • aggregate value used where integer expected

The descriptors are currently placed like this:

ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT] __attribute__((section(".RxDecripSection")));
ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT] __attribute__((section(".TxDecripSection")));

I suspect the MPU configuration, alignment, or linker script memory section is incorrect for STM32F746 (DCache enabled MCU).

3) Need guidance on the correct CubeMX LwIP/Ethernet configuration

I am unsure whether my .ioc settings are correct, specifically:

  • Ethernet clock configuration

  • Required RMII pins on F746G-DISCO

  • Proper static IP settings in LwIP

  • Key parameters in lwipopts.h

  • Whether mbedTLS is required for HTTPS POST

  • Whether an official ST example exists for F746 + LwIP + HTTP/HTTPS client

    What I am looking for

               I would appreciate help with:

    • ✔ Correct CubeMX .ioc configuration for STM32F746 + RMII + LwIP

    • ✔ Correct linker script placement for Ethernet DMA descriptors

    • ✔ Working example project (preferably for F746G-Discovery)

    • ✔ Any documentation on debugging HardFaults in LwIP init

      Goal

      Send ADC value as JSON to a cloud server:

{
  "adc_value": 1024,
  "device": "stm32f746"
}

Any guidance, examples, or recommended configurations are greatly appreciated.

Thank you



1 REPLY 1
Andrew Neil
Super User

Debugging Cortex-M (including STM32) Hard Faults.

LwIP debug & diagnostic options.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.