cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7: Zephyr Ethernet errors after disconnecting and reconnecting ethernet cable

shreyas15
Associate

I'm trying to disconnect a ethernet cable after flashing a code 
Then I'm getting 
[00:01:50.522,000] <err> net_tcp: net_send_data()
[00:01:52.200,000] <wrn> net_if: iface 1 is down
[00:01:52.200,000] <err> net_tcp: net_send_data()
[00:01:52.480,000] <wrn> net_if: iface 1 is down
[00:01:52.480,000] <err> net_tcp: net_send_data()
[00:01:52.900,000] <wrn> net_if: iface 1 is down
[00:01:52.900,000] <err> net_tcp: net_send_data()
[00:01:53.530,000] <wrn> net_if: iface 1 is down
[00:01:53.530,000] <err> net_tcp: net_send_data()
[00:01:54.475,000] <wrn> net_if: iface 1 is down
This is expected since trying to connect it back
When I reconnect ethernet cable 
Im getting an below error 
[00:01:54.475,000] <wrn> net_if: iface 1 is down
[00:01:54.475,000] <err> net_tcp: net_send_data()
[00:01:55.282,000] <inf> phy_mii: PHY (0) Link speed 100 Mb, full duplex
[00:01:56.212,000] <err> os: ***** USAGE FAULT *****
[00:01:56.212,000] <err> os: Illegal load of EXC_RETURN into PC
[00:01:56.212,000] <err> os: r0/a1: 0xaaaaaaaa r1/a2: 0xaaaaaaaa r2/a3: 0xaaaaaaaa
[00:01:56.212,000] <err> os: r3/a4: 0xaaaaaaaa r12/ip: 0xaaaaaaaa r14/lr: 0xaaaaaaaa
[00:01:56.212,000] <err> os: xpsr: 0xaaaaaa00
[00:01:56.212,000] <err> os: Faulting instruction address (r15/pc): 0xaaaaaaaa
[00:01:56.212,000] <err> os: >>> ZEPHYR FATAL ERROR 34: Unknown error on CPU 0
[00:01:56.212,000] <err> os: Current thread: 0x200233f8 (rx_q[0])
[00:01:56.307,000] <err> os: Halting system
The mcu is going halt what is the reason for this issue?
How to resolve this?

 


7 REPLIES 7
mbarg.1
Senior III

which sw are you running ? Some example do not implement interface management, aka cable disconneciton

LCE
Principal II

Already checked the Zephyr ethernet source code?

These errors make sense, and as @mbarg.1 already said, some (dis-) connection management is required.

This means that the MCU periodically asks the PHY if it has some physical connection.

Ethernet Management — Zephyr Project Documentation

Not much there, but a starting point. Try to trace it back to find some periodic connection handler to the PHY.

Guillaume K
ST Employee

Hi

You didn't mention what precise STM32F7 and what HW board you are using.

Did you look for support at Zephyr OS project ?

They have Discord channel and mailing lists:

main@lists.zephyrproject.org | Subgroups

 

Pavel A.
Super User

Hmm looks like a bogus return address in a function, due to thread stack corruption?

 

@Pavel A. @Guillaume K @LCE @mbarg.1 
Im using STM32F767ZI board zephyr is supported 
I'm trying to handle the connection management through below api still Im facing same issue

#include <zephyr/net/net_mgmt.h>
#include <zephyr/net/net_event.h>
#include <zephyr/net/net_if.h>
net_mgmt_init_event_callback(&net_cb, link_event_handler,
NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED);
net_mgmt_add_event_callback(&net_cb);
But above callback is not called when network goes down.
 

As far as I can see ( looking at examples in libs), threre is no code (no thread ) monitoring link status - you have to add your code - that is why call back is never called.

Unless you are running somthing different or proprietary - in that case share it to get better advice.

Pavel A.
Super User

net_mgmt_init_event_callback(&net_cblink_event_handler,

And what do you do in your link_event_handler() ?

Note that the net_cb struct must be valid all the time while the callback is registered (it should be "static" etc. not on a function stack).