cancel
Showing results for 
Search instead for 
Did you mean: 

Cheap way to add Wifi+Ethernet to an STM32 project

SLasn.1
Associate II

Hi dear community! 🙂

My project is based on an STM32, probably one in the F range (have not decided fully yet).

I would like to add Ethernet and WiFi to my project, ideally in a cheap way (in terms of manufacturing costs, for let's say 1000 units), I was thinking there must exist an IC which could do that? Ideally I would also like to have both 2.4GHz and 5Ghz for the WiFi chip.

So far my best solution is to use Wiznet w5500 for Ethernet (about 2$/chip) and ESP8089 for WiFi (about 1$/chip). Unfortunately the ESP can only manage 2.4GHz but it clearly seems to be the cheapest on the market.

I also know some of the STM32 have integrated Ethernet MAC, but I would still need an external PHY and another chip for the WiFi, which I was thinking will raise the cost.

So a lot of debatting, hence why I would love to hear your thoughts on this!

Thank you!

Simon

16 REPLIES 16
SLasn.1
Associate II

I forgot to mention that Gigabit is not a requirement for the Ethernet, 100Mbits is fine 🙂

Piranha
Chief II

For Ethernet an integrated MAC will give the highest possible performance and flexibility. PHY chip at 1000 units from DigiKey - KSZ8081 and DP83825 costs 0,78 and 0,63 USD respectively. Most likely lower cost can be achieved only by a mass order of some RealTek or similar PHY chips.

SLasn.1
Associate II

Thank you for the reply Piranha this is great info 🙂

I am currently looking at my possibilities to find an STM32 with integrated Ethernet MAC but also what I need for the rest of the project (among others USB Host, SDIO, and SAI or I2S able to handle an 8 channel DAC).

Pavel A.
Evangelist III

> I would like to add Ethernet and WiFi to my project, ideally in a cheap way 

WiFi is a terribly complex thing. It depends on what do you really want - to be only a station or WiFi-direct peer, what sort of performance and standard compliance is needed ...

Besides of the ESP, if you get the ethernet working, you can look for WiFi devices with ethernet interface - basically, small routers.

Maybe such routers exist also with USB/CDC interface - I don't know.

Or, abandon STM32 and look for higher class chips that include wi-fi MAC.

-- pa

SLasn.1
Associate II

Thanks for the reply Pavel.

I am a bit confused by your answer though, do you mean using an external device? If so it will not work, my device/project needs to be able to handle WiFi and Ethernet on its own.

Other than that I do not have strong requirements for WiFi (the 5GHz one is only for practical situations - I have seen some places where there is only 5GHz WiFi), the device will only send and receive commands over WiFi so there is absolutely no need for high speed. And only WiFi client ("station") would be enough, but ideally having the possibility to be a WiFi Access Point would be better.

Piranha
Chief II

The Ethernet is present on F1, F2, F4, F7 and H7. F1 is probably the cheapest, but also the oldest and least recommended. For 8 audio channels I highly recommend using SAI peripheral(s), not SPI/I2S. SAI is present starting from F4 (and up). Most likely you will use either TDM mode or 4 x I2S lines. For the latter case you need 2 instances of SAI peripherals. Yes 2, because each of them has 2 separate streams. For 2 SAI peripherals you need at least F7.

To me the cheapest and easiest option seems to be some STM32F42x with TDM capable DAC.

Pavel A.
Evangelist III

> my device/project needs to be able to handle WiFi and Ethernet on its own

AFAIK, no STM32 has internal WiFi controller or is even remotely capable of it.

So, only external solution. Not even mentioning RF part, antennas...

ST has this: https://www.st.com/resource/en/datasheet/spwf01sa.pdf (never seen anyone using it).

> the 5GHz one is only for practical situations - I have seen some places where there is only 5GHz WiFi)

TL;DR the bottom line, if you are budget-oriented, go for 2.4 GHz.

5 GHz only can work either within limited range and direct line of sight to the access point.

Consider also which security protocol your wi-fi should support (up-to-date = more pricey, cheaper = hackable or harder to configure or both).

-- pa

SLasn.1
Associate II

Thanks again guys this is really helpful!

@Piranha​  F4 / F7 is also what I had in mind. Fully agree with not using SPI/I2S especially since I will probably need the SPI lines for something else anyways (like communication with the WiFi chip f.x.). Did not know about TDM, I'll investigate! You got any suggestions for a DAC chip? Only requirements are 8 separate channels and able to handle at least 48kHz PCM audio.

@Pavel A.​  I think I understand what you meant with "external solution" - yes using another chip is perfectly fine. I just want it all in the same device (in the same "box" literally). My knowledge in the RF world is very limited, so yes I'll have to think about antennas and like - my first idea was to simply use a trace on the PCB for that.

Good point about the security protocols, even though again I am not that fuss as long as it will work in most "typical/home" environments. And yes ok maybe I'll stick to 2.4GHz, in this case the best solution seems to be an STM32 with integrated MAC + Ethernet Phy + ESP8089 for WiFi.

If so, for Ethernet consider something like ksz8851 (you need a PHY anyway) - and happily bypass the STM32 ethernet programming experience -

that @Piranha​ surely wants to describe to you in colors 😉

-- pa