Broadcast Ethernet from F405 and DP83848

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

hybridA
Posts: 40
Joined: Wed Jan 12, 2022 7:15 am
Has thanked: 10 times
Been thanked: 5 times

Re: Broadcast Ethernet from F405 and DP83848

Post by hybridA »

that's exactly what I did - just changed the makefile to use the REV_D config, and the sample app worked great!
Also got udp broadcast messages working.
I noticed it takes a few seconds after calling lwipinit() until the driver is truly ready. If my app does not wait, the sendto() never succeeds.

Since open-loop sleeps are risky, I wrote a little wrapper around netif_is_link_up(), in lwipthread.c:

Code: Select all

bool lwipReady() {
  return netif_is_link_up(&thisif);
}


in my app I then call:

Code: Select all

lwipInit(nullptr);
while (!lwipReady()) {
   chThdSleepMilliseconds(50);
}


Is there already a way of checking if the driver is ready?
mikeprotts
Posts: 166
Joined: Wed Jan 09, 2019 12:37 pm
Has thanked: 19 times
Been thanked: 31 times

Re: Broadcast Ethernet from F405 and DP83848

Post by mikeprotts »

Glad this is now working for you.

I wouldn't expect much delay from lwipinit() to being ready - is it connected to an Ethernet switch or directly to another host? If another host, it may be that it's the other end of the cable that's slow.

Mike
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Broadcast Ethernet from F405 and DP83848

Post by Giovanni »

Hi,

It should be macPollLinkStatus(), it is done at MAC driver level.

Giovanni
hybridA
Posts: 40
Joined: Wed Jan 12, 2022 7:15 am
Has thanked: 10 times
Been thanked: 5 times

Re: Broadcast Ethernet from F405 and DP83848

Post by hybridA »

The delay is the same (or at least very similar) if connected directly to PC or through router. it's around 2sec. Not an issue in my application.
macPollLinkStatus() worked great!
Post Reply