I am not an ethernet expert and have some idea about MII vs RMII but I see this message during the compile (a warning) which seems a bit serious.

/FreeRTOS-Plus-TCP/portable/NetworkInterface/STM32Fxx/NetworkInterface.c:145:6: warning: #warning Using RMII, make sure if this is correct [-Wcpp]
  145 |     #warning Using RMII, make sure if this is correct
      |      ^~~~~~~

I am wondering:

  • How can I verify what this should be?
  • Should this really be a warning? Maybe use a sane default and document in readme?

MII and RMII are two different possible ways to wire up your MCU to an Ethernet PHY. The main difference is the number of lines used.

Your software configuration must match the wiring. Thus you need to inform your driver at compile time what the wiring is. The same holds for the PHY address.

Your wiring is most likely RMII, so you could try that first and then try MII if your network doesn’t work. The safest bet is to consult with the wiring diagram, though.

The warning is simply a reminder for you to know about this.

It hurts a bit that I’ve been coached for years (hm, perhaps more than two decades) to treat warnings as errors :slight_smile:

I wonder if anyone has thought about an elegant solution to this?

Fire yor coach? :grin:

No seriously, once you’ve figured out what you need, you can safely eliminate the warning from your code base.

It’s true that technically speaking, this is not a warning at the same level as, say, the warning about using a variable uninitialized. It’s unfortunate that C does not support something like #inform as an alternative to #warn. Yet IMHO in this case a warning is better than nothing at all. After all, who reads the docs when adapting a driver?

1 Like

#pragma message wasn’t and maybe isn’t supported (consistently) by all supported compilers. Unfortunately :frowning:
Richard is right, that would be better than #warning.

I have added the #warning in order to make developers aware of their configuration.
The demo’s work fine for the default cases (boards), but any STM32xx part may be hooked up with either an RMII or with a MII PHY. When the wrong choice is made, the user will only observe that “it does not work”.

I think, and I hope that the #warning has prevented a few developers from getting frustrated.

I am not sure, is #pragma message supported by the majority of compilers? I would be happy to replace all #warnng statements with a #pragma message.