The latest ESP32 can really run Linux, and it is getting uncomfortably near a Raspberry Pi


Espressif has a brand new ESP32, the ESP32-S31, and that ESP32 comes with a gigabit Ethernet MAC, a USB 2.0 High-Speed host controller, an SD card interface with two slots, and a digital camera enter. It’s a fairly commonplace set of options for a Linux single-board laptop, however a slightly unusual checklist of issues to seek out on a microcontroller.

I’ve spent a variety of time with microcontrollers, and it is typical to seek out a few cores, a small quantity of RAM, GPIO pins, and possibly Wi-Fi on one. Something extra superior sometimes makes use of a Raspberry Pi, but the ESP32-S31 comes with a complete lot greater than your typical microcontroller setup. Espressif has additionally made an enormous change to the CPU that makes it extra like an SBC than ever.

Peripherals already change the way it appears

It can do a complete lot extra

Credit: Espressif

The greatest information concerning the ESP32-S31 is its networking capabilities, packing a 1000 Mbps Ethernet MAC and an enormous soar over the slower 100 Mbps discovered on the ESP32-P4. It makes use of an 8P8C connector (generally known as RJ45) and has a PHY that makes use of the chip’s RGMII interface. RGMII is particularly what allows gigabit; in any other case, it might use commonplace RMII.

On high of that, then, there’s USB, however it’s not “commonplace” USB. The S31 has a USB 2.0 High-Speed OTG controller, and it is a full-size Type-A socket that may provide 500 mA in host OTG mode. Alongside that sits an SDIO host controller with two slots, a DVP digital camera interface taking 8 to 16 bits, and a parallel LCD controller that helps as much as 24-bit RGB in addition to I8080 and MOTO6800 panels. There are two I2S controllers with {hardware} Bluetooth audio sync, fourteen capacitive contact channels, a CAN FD controller, and 4 MCPWM models.

A block diagram of the ESP32-S31. The chip sits in the centre and lists its two 320 MHz RISC-V cores, a 40 MHz low-power core, 512 KB of SRAM, and its Wi-Fi 6, Bluetooth 5.4 and 802.15.4 radios. On the left, flash (up to 256 MB) and PSRAM (up to 64 MB) connect over separate buses. On the right, lines labelled with each interface lead to an Ethernet PHY and RJ45 port over RGMII (highlighted), a USB Type-A socket over USB 2.0 High-Speed OTG, two SD card slots over SDIO, a camera over DVP, an LCD p

Just from that checklist alone, it is clear that this can be a new kind of ESP32, and never one which we have actually seen earlier than. Wired networking? A USB host? Camera, show, audio? Everything right here is extra akin to an SBC than a microcontroller, however that is nonetheless not all.

On the CPU aspect, there are two 32-bit RISC-V cores working at as much as 320 MHz and a floating level unit on every, a 128-bit SIMD information path for one in every of them, and a separate 40 MHz low-power core, too. Each core will get 32KB of L1 instruction cache they usually share 64KB of information cache. Memory will get much more fascinating: the S31 helps as much as 64 MB of PSRAM over a 250 MHz 8-bit DDR interface, and helps as much as 256MB of flash, too. On the ESP32-S3 the PSRAM interface was shared with flash, making this a slightly massive step-up.

Espressif put an actual MMU within the ESP32-S31

Very totally different to the outdated “MMU”

A two-part diagram comparing the two things Espressif has called an MMU. The top part, for the ESP32-S3 and ESP32-P4, shows the CPU sending an address to an MMU with one map for the whole chip, which points into SPI flash or PSRAM; all code on the chip uses the same map. The bottom part, for the ESP32-S31, shows an Sv32 virtual address split into VPN[1] (bits 31 to 22), VPN[0] (bits 21 to 12) and a 12-bit offset. Each field indexes one step of the lookup: the satp register (highlighted) points t

Espressif has been utilizing the time period “MMU” for fairly a very long time, together with on the ESP32-S3 and the ESP32-P4. However, the MMU in that case was a block that maps exterior flash and PSRAM to deal with house, nowhere close to the complexity of a contemporary MMU that may additionally do issues like course of isolation and web page tables. As a consequence, when Espressif stated the S31 has MMU help, it gave the impression to be extra of the identical.

However, there is a massive distinction this time round. In the S31’s datasheet, Espressif says that the cores do “Sv32 two-level page-table deal with translation” and implement “Machine, Supervisor and User privilege modes.” Sv32 is the precise RISC-V paging scheme, and having all three privilege modes is what allows a daily kernel to run in supervisor mode with firmware beneath it in machine mode. And that is how RISC-V-based Linux machines work.

A three-layer stack showing how Linux runs on the ESP32-S31’s RISC-V privilege modes. User processes such as the shell and SSH run in U-mode, where each process has its own address space; they make system calls down to the Linux kernel in S-mode, which is highlighted and keeps the Sv32 page tables the hardware uses to translate virtual addresses. The kernel in turn makes SBI calls down to OpenSBI firmware in M-mode, which keeps full access to the chip and provides timer, interrupt and reset serv

Unlike earlier hacky makes an attempt at getting Linux working on previous ESP32 microcontrollers, the S31 has much more out of the field to natively help it. For starters, Espressif already revealed a Linux BSP again in August, constructed on Buildroot and U-Boot, and it features a kernel, machine tree, and root file system. Espressif says that it is “not but advisable for manufacturing use,” however the level is that it works.

That additionally hasn’t stopped the group from iterating quick. One port sees Linux 6.18 working in supervisor mode, full with working drivers for virtually the entire {hardware}. There’s another, primarily based on Linux 7.1, that helps an 800×480 LCD panel linked, able to exhibiting a console. Being capable of plug in a show, use wired Ethernet, and use a mouse and keyboard sound much more akin to an SBC than a microcontroller.

Memory is the largest downfall

Lots lower than would-be SBC rivals

Milk-V-Duo-S-5

The S31 begins to lag behind when wanting on the RAM it carried: there’s 512KB of SRAM on chip, and two variants can be found with both 16MB or 32MB of in-package PSRAM. The most reminiscence it may possibly carry is 64MB, and there is no DRAM controller wherever to be discovered. Compared to the likes of the Milk-V Duo S with its 512MB of RAM, you are reminded by the competitors in a short time that the ESP32-S31 is a microcontroller.

This is strictly why these Linux builds execute the kernel from flash, in an effort to keep away from spending treasured PSRAM on it. As nicely, there is no GPU or NPU on-board, and whereas the ESP32-P4 has video encode and MIPI interfaces, these are traded out for extra radios on the S31. You nonetheless get a JPEG codec, a 2D pixel-processing accelerator, and 2D DMA, however that is probably not sufficient to indicate a full Linux desktop.

The clock pace additionally raises some questions concerning the gigabit Ethernet NIC. At 320 MHz, you get roughly 3,900 CPU cycles per maximum-size Ethernet body, and about 215 per minimum-size body. With a theoretical PSRAM most of 500 MB/s, it could be doable to get nearer to these gigabit speeds in bulk transfers, however I might be skeptical in relation to saturating the reference to a variety of smaller packet transfers.

Those radios are an enormous deal, as comparable SBCs for the worth skip an on-board wi-fi stack. You get 2.4GHz Wi-Fi 6, Bluetooth 5.4 with each LE and Classic BR/EDR, and an 802.15.4 radio for Thread and Zigbee, alongside the gigabit MAC. Matter works over Wi-Fi and Thread, and going again to Bluetooth Classic for a second, the actual fact it is there on an ESP32 is arguably fairly uncommon. But it means older audio gear will work completely.

Power consumption is fairly nice even with these radios, too, as Wi-Fi obtain consumes between 110 mA to 117 mA relying on the mode, transmit peaks at 265 mA on 802.11b at 15 dBm, and each cores in modem-sleep at 320 MHz draw 91 mA with peripheral clocks off or 147 mA with them on. It’s the facility profile of a microcontroller regardless of having an SBC’s set of peripherals.

The “S31” title is a little bit of a large number

But the remaining is fairly good

Two USB-C ports on the ESP32-S3

The indisputable fact that that is known as an “S31” board is just a little bit unusual; “S31” implies an S3 revision, regardless of it basically being completely irrelevant to the common S3. Espressif defines the S collection as “high-performance feature-rich SoCs”, nothing to do with instruction units, however one massive distinction between each lineups had been the RISC-V cores used within the C collection and the Xtensa LX7 cores used within the S collection.

In a remark part on Hackaday, Jeroen Domburg, Technical Marketing Manager for Espressif, stated that “We really by no means meant the CPU structure to be a part of the title.” He additionally states that the core is derived from the P4’s and places the S31 at practically twice the pace of the S3.

Unfortunately, the S31 datasheet continues to be old-fashioned, caught at model quantity 0.5 and an enormous “PRELIMINARY” watermark throughout the primary web page. it is fairly detailed and principally constant, not less than, although one instance of its preliminary standing is that the PSRAM is listed as having an 80 MHz most clock; instantly at odds with Espressif’s revealed 250 MHz PSRAM pace. To be truthful, barely messy documentation is not notably out of the strange for Espressif, however it’s proof of simply how early we’re into the ESP32-S31’s lifecycle. The Linux aspect is basically only a toy to mess around with, and will probably be for fairly some time.

The S31 is not an SBC, however it is the primary ESP32 the place a lot of its options, from the peripherals, bandwidth, and CPU privilege mannequin all occur to be adjoining to a contemporary SBC. The hole between a microcontroller with good I/O and an SBC has been closing over the previous couple of years, and when you nonetheless cannot run a desktop on 16 MB of PSRAM, you will get a Linux terminal up and working on it with out an excessive amount of hassle. And that is step one.



Source link