Skip to main content
M3R
Associate II
Jan 8, 2021 9:19 PM UTC
Solved

Ethernet Hard Fault When MACAddr get Value

hi

i Use stm32f107RC and lan8720.

when MX_ETH_Init(); function run i got Hard Fault in This line:0693W000006I4XdQAK.pngHow can I solve this problem?

This topic has been closed for replies.
Vangelis Fortounas
Associate II
Jan 12, 2021 11:39 PM UTC

Hello

heth.Init.MACAddr is not defined as array but just as pointer

In same function, define

uint8_t mcdr[]={0x00,0x80,0xE1,0x00,0x52,0x00};//def and initialize

heth.Init.MACAddr = &mcdr[0];

9 replies

TDK
Jan 8, 2021 9:44 PM UTC

It's an imprecise error, which means the error is probably not on the line that triggered it. Most likely the issue is elsewhere.

But you should verify that heth.Init.MACAddr points to a valid location in RAM.

"If you feel a post has answered your question, please click ""Accept as Solution""."
M3R
M3RAuthor
Associate II
Jan 9, 2021 5:02 AM UTC

yes

i checked the address of the variable, it is in RAM (0x200013B0)

I Changed the microcontroller IC, which is the same problem again.

M3R
M3RAuthor
Associate II
Jan 12, 2021 7:16 PM UTC

Does anyone have an opinion?

Vangelis Fortounas
Associate II
Jan 12, 2021 11:39 PM UTC

Hello

heth.Init.MACAddr is not defined as array but just as pointer

In same function, define

uint8_t mcdr[]={0x00,0x80,0xE1,0x00,0x52,0x00};//def and initialize

heth.Init.MACAddr = &mcdr[0];

M3R
M3RAuthor
Associate II
Jan 13, 2021 6:31 AM UTC

Thanks @Vangelis Fortounas​ 

This Problem has Solved.

When I want to ping, it receives data but does not send data.

What is the problem?

�?Status 0x00D00000 is Not Defined... in Header

0693W000007B1r6QAC.jpg

Vangelis Fortounas
Associate II
Jan 13, 2021 11:22 AM UTC

Hello

Ping uses ICMP protocol that belongs to Internet Protocol layer.

MAC layer can't unterstand what is ping. It just receives and transmits data

There are examples here and here. Not for f107 but you can take an idea what to do.

STM32CubeMX can produce working code by using ethernet interface and LWIP stack.

M3R
M3RAuthor
Associate II
Jan 13, 2021 2:43 PM UTC

HI.

I have used the lwip functions and already got pings in the stm32f429 and lan8720.

But I can't get a ping in f1 Series .

Is there a software problem?

Vangelis Fortounas
Associate II
Jan 15, 2021 3:16 AM UTC

LWIP has some ICMP settings not to respond to broadcast and multicast pings. Send a unicast ping to LWIP.

Update F1 HAL to the latest version.

Compare the LWIP working settins of F429 with those of f107

Activate debuging for UDP, ICMP, and redirect the messages to a console. It will help a lot.

At last put a break inside the icmp_input(...) function and step by step find the cause of this behaviour.