October 12, 2026

First experiences with STM32 CubeMX -- CubeMX and network/ethernet - part 2

I made two changes. I installed CubeMX on linux and moved all of my project files to my linux machine. I also moved the H743 board so I could plug the USB cable into my linux machine and so I could plug the board into a visible network switch rather than a mysterious cable. I see two new things: By normal LED, I see a green LED constantly on, and a yellow LED blinking with what looks like the usual random network activity. Before both LED were blinking together at about 1 Hz -- something I have not seen before.

The ETH messages are messages I added to the interrupt handler. I get two or three each time I press the reset button, usually two. I get them after about a 1 second delay, which could be autonegotiation.

I don't think any of this had to do with the Mac versus linux. It all has to do with being connected to a healthy network. I have no idea what was up with that other cable -- something else to look into someday.

What can we learn from these ETH messages?

These come from HAL_ETH_IRQHandler() in Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_eth.c

I add some additional printout to this routine and see:

ETH
ETH rx
ETH dma err
ETH
ETH dma err
That is helpful. We are getting a DMA error. I only see these messages when a network cable is connected.

I get rid of the advised additing to the linker script that sets up the lwip_sec section and now I get only one interrupt:

ETH
ETH dma err
This clearly means something, but I'm not sure what.

Oops, a mistake

I had set the size of the MPU 1 region to 32B not 32KB! I "fix" this, and select 64KB instead. Generate code, recompile, load and test. Now no ETH messages. And ping doesn't work either. Is this progress? I get the same "non-result" with or without the stuff in the linker script.

What about that peculiar addition to the linker script

I search (grep) on the address 0x30000080 and it leads me to LWIP/Target/ethernetif.c -- this is a fairly short file (789 lines) with code for 3 different compilers. For gcc we see:
// #pragma location=0x30000000
/* Ethernet Rx DMA Descriptors */
ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT] __attribute__((section(".RxDescripSection")));

// #pragma location=0x30000080
/* Ethernet Tx DMA Descriptors */
ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT] __attribute__((section(".TxDescripSection")));

// #pragma location = 0x30000100
__attribute__((section(".Rx_PoolSection"))) extern u8_t memp_memory_RX_POOL_base[];
So clearly the section setup in the linker script is required!! The "pragmas" are used for the IAR compiler, but I retain them for a useful and informative comment.


Have any comments? Questions? Drop me a line!

Tom's software pages / tom@mmto.org