STM32 series of 32-bit ARM Cortex MCUs is one of the most useful MCU families out there. They are used in every domain from medical to industrial applications. However, STM32 WiFi capabilities are limited.
To use Wi-Fi with STM32, you will need to add some sort of Wi-Fi/BT module or SoC that handles all the wireless networking. In this article, I talk about some options that I have tried.
STM32 WiFi and Wireless Networking: Some Notes
Before we dive into the options, it is important that I put down some notes on my past experiences with STM32 and Wi-Fi and other wireless applications. ST Micro offers a couple of options for adding Wi-Fi to STM32 designs. Those solutions are well documented and also have everything you need to get started – sample code, examples, APIs, etc.
However, here is the catch – the Wi-Fi modules they use NEVER seem to be in stock!
For example, an STM32L4 IoT kit here uses an Inventek Systems module which is almost always out of stock if you need 100+ pcs.
I had great expectations from the STM32WB series of wireless STM32 chips. But they rolled those out with Bluetooth support, and skipped Wi-Fi altogether. But I don’t blame them for that – the Espressif ESP32 has dominated the market. Unfortunately, the ESP32 cannot match an ARM Cortex with hundreds of GPIOs and parallel SDRAM.
I list some other options below that I have used before.
#1: Atmel ATWINC1500 SoC and Modules (Wi-Fi only)
Atmel’s ATWINC15x0 is a good series of networking SoCs that you can definitely use with the STM32 for getting Wi-Fi added to your STM32 applications. Some advantages of this solution are:
- Decent community support
- Moderately expensive solution
- Extremely small footprint
- Decent documentation and firmware support
- Easy connection to STM32 via high speed SPI interface (no communication bottleneck)
- Reasonably good stocks available to buy online
I came across a document that presented benchmark results for ATWINC1500.
The TCP and UDP maximum data rate or throughput of ATWINC1500 is 3 Mbps and 9 Mbps respectively, considering both upload and download speed.
#2: Silicon Labs WF200 SoC and Modules (Wi-Fi only)
Silicon Labs has rolled out some great sub-GHz RF SoCs and I have worked with many of their Gecko series sub-1 GHz chips (see portfolio).
The advantages of using WF200 chip or module are:
- Good availability of open source host driver code for STM32
- Low cost solution
- Small footprint
- Easy connection to STM32 via SDIO interface (speed no bottleneck)
- Reasonable numbers available to buy online
- Allows co-existence of other 2.4 GHz radios
The SDIO port becomes a highlight here because SDIO based communication is painless and very fast. The STM32 chips are almost always armed with an SDIO port. If your SDIO port is being used to interface to an SD card, you can always pick an SPI interface and configure the WF200 to operate in SPI mode. The SPI speed should still not be a bottleneck here.
Data throughput is not too impressive, but is more than enough for most STM32 applications (even streaming compressed 720p video).
The WF200 can achieve over 8 Mbps over TCP and 30 Mbps over UDP when the SDIO host interface is implemented properly.
If you are looking to add support for Wi-Fi networking to your STM32 application without too much hassle and customization, WF200 is a good solution to use.
#3: Espressif Systems ESP8266 (Wi-Fi only)
You just cannot forget the ESP series of Wi-Fi SoCs that have swept over the IoT market and absolutely demolished all other competition – of course for good reason.
The ESP8266 is the little brother of the much more powerful ESP32. However, in my experience, the maximum TCP and UDP data rates offered by ESP8266 is almost the same as that of the ESP32.
The advantages of using ESP8266 are:
- Great community support and open knowledge
- Very low cost solution
- Extremely small footprint
- Good documentation for UART interface (scanty Chinese documentation for SDIO mode though!)
- Plenty of stocks available everywhere
If you want to use the UART interface to add Wi-Fi feature to STM32 boards, ESP8266 modules are the best solution to do it. The AT firmware is easy to add and use, with plenty of examples and AT command documentation available on Espressif’s website.
ESP8285 is a good ESP8266 + embedded flash solution if you want a more compact solution.
You can use the UART AT commands at up to 2 mbps without much trouble. However, as you can guess – that absolutely ruins the data throughput.
The SDIO AT command set documentation is a total mess in this case. Using SDIO mode AT firmware involves using ESP-WROOM-S2 module (with no flash inside). It involves loading a firmware blob to boot the module – with scanty documentation on how to do it.
If you want to use SDIO mode, do NOT use the ESP8266!
If you somehow get the SDIO port working (I actually did), you will get 8 Mbps of TCP throughput and 20 Mbps of UDP throughput using ESP8266 or ESP8285 and SPI/SDIO interface.
#4: Espressif Systems ESP32 (Wi-Fi and Bluetooth)
The Espressif Systems ESP32 is your best bet if you want everything – low cost, high flexibility, high data rates, and small footprint.
The advantages of using ESP32 are many:
- Very low cost
- Great community support and examples
- Small footprint (single chip, no peripherals if you use ESP32-PICO-D4)
- Easy to work with firmware
- High throughput even over UART interface
- Always in stock if you need very large quantities
I have been able to get about 10 Mbps TCP and 35 Mbps UDP throughput with ESP32 and STM32. In fact, this arrangement is something that works very well for streaming audio or JPEG camera streams with ESP32.
There is a catch though – there is no good support on the STM32 host side code for using the AT commands on the ESP32 via UART, SPI or SDIO.
You have to do the parsing and take care of everything that can go potentially wrong.
The LwIP stack of the STM32 is not used when using ESP32 as the networking chip. Therefore, it is up to you to send and parse AT commands and responses based on your application requirements rather than use a full-fledged AT host library.
A potential workaround could be to implement a PPPoS library for STM32 that helps bridge LwIP and ESP32 AT commands. This is a project in progress for now and will work with the ESP32 microSD form factor AT command module that I recently designed (see below).
The plan is to have an AT module that plugs into an ordinary SD card socket on your STM32 board and the STM32 can connect with the ESP32 via 4-bit SDIO mode, 1-bit SDIO mode or legacy SPI mode.
#5: Generic USB Wi-Fi Modules
This is only for those who have very good knowledge of USB hosts and how the STM32 USB stack works. You can in fact connect an USB Wi-Fi adapter to STM32 and use it for all networking purposes.
This is extremely low cost and simple in terms of hardware, which is typical of USB devices.
However, the firmware or software side of things can be complicated to the point of being scary.
Here is a lead on using USB Wi-Fi adapters with STM32 with uCLinux.
Again, I warned you – this is not fun.
#6: Cypress CYW43xxx (Wi-Fi and Bluetooth)
I happened to notice that Infineon has now developed a public STM32 Connectivity repository on GitHub that aims to add support for interfacing their CYW43xxx modules with STM32. The library STM32 Connectivity Expansion Pack 1.3.0 (as of 7 January 2023) has support for both Wi-Fi and Bluetooth.
The connectivity pack adds wireless connectivity to STM32 devices, regardless of the compiler or STM32 core type that you may be using.
You can simply configure the pack within CubeMX to work with any STM32 MCU of your choice, as long as you have the hardware peripherals and flash/RAM required to communicate with the Cypress (Infineon) CYW43xxx module of your choice.
Unfortunately, the CYW4343x, which is one of the more popular chips, is only available in a 0.4mm CSP package. Documentation still remains sketchy and the CYW43xxx chips and modules are in very short supply.
- 23 June 2021
– Initial release
- 7 December 2023
– Added Cypress (Infineon) CYW43xxx