Hacker News new | ask | show | jobs
by LeifCarrotson 2217 days ago
Better support, documentation, and peripherals.

The ESP32 datasheet is 62 pages. The STM32F4 datasheet is 1729 pages, and that's not counting the reference manuals.

The ESP32 datasheet contains about 3 paragraphs about the ADC, which basically say that it has an accuracy of +/-6%, see example code for ways to calibrate it (which probably amounts to a linear interpolation between two sample counts with the pin pulled to ground and AVDD). In the STM32 manual, the section on the ADCs is much longer than the entire ESP32 datasheet, and goes into gory details about every possible nonlinearity/ missing counts/ slope/ offset/ noise/ reference voltage and other various potential sources of error you might encounter. If you wanted to build, for example, a wireless machine that included a precision scale, you can see why you'd want to use the STM32F4 ADC instead of the ESP32 ADC because a thorough understanding of that peripheral is critical to your application.

If you want to drop in someone else's ESP32 code and use it to push bytes over the air, it's a great tool. If you want to actually develop some application for it that doesn't exist yet, you're on your own.

3 comments

Yes, people don't realize how inadequate ESP32 is for commercial use. There are literally no commercial products that use ESP32 (or its older brother ESP8266) besides some chinese cheap toys on Amazon.

There are packages out there that use ESP32 as a "augmentation" chip to do OTA with a main processor being STM32 or NXP. There are also major security flaws and silicon revisions made by ESP32 that makes the whole thing reek of inadequacy beyond anything a hobbyist would do.

ESP32 -> Hobby use only. Don't spin up $500k of tooling and HVM batch relying on a weak CPU that will give you some chance of a complete recall or losing your customer base that took many years to build.

Hobbyists on Youtube and EE Stackoverflow are oblivious to the professional world. Let me know if you would like sources, I don't have time to dig into it but esp32.net is a good place.

> There are literally no commercial products that use ESP32 (or its older brother ESP8266) besides some chinese cheap toys on Amazon.

There are lots of commerical IoT devices that use the ESP chips (Shelly, Sonoff, Tuya e.g.).

And due to popularity of ESP in hobby circles, there are many good open-source firmwares for those devices, such as ESPurna with its very impressive feature set: https://github.com/xoseperez/espurna

The final product is better than almost any "professional" IoT device. I'd rather risk with higher odds of system failures (the Atom bug showed that not even Intel is safe) than suffer daily with slow, buggy, expensive, restricted and privacy-hostile cloud-connected trash from the likes of Logitech.

We use an esp32 commercially to provide a web interface (including doing OTA) to our chip. Works pretty decently.
> The STM32F4 datasheet is 1729 pages

I'm not certain I would consider this a 'feature'.

I have been forced to use F042 and F767 for work, and I must say, I have never seen such convoluted peripheral implementations in my life. There is complexity for complexity's sake, it seems to me. I could write a booklet about this, with each bloated, twisted peripheral as a chapter.

If you're throwing an ESP on there anywhere, wouldn't an I2C or SPI ADC be way cheaper than a whole nother MPU for the same performance?
Actually not that clear cut.

You can get a small STM32 with multiple multiplexed 12bit ADC channels, with ~2MSPS sampling speed and 256x hardware oversampling (~16bit), for less than half a buck (per 1000)[1].

Cheapest independent 12bit ADC with >500kSPS I could find on DigiKey were all over a buck (per 1000)[2], and they were all single-channel parts.

Now keep in mind that the ADC only does ADC, while the STM32G030 has several 16bit hardware timers and other peripherals.

[1]: https://www.digikey.com/product-detail/en/stmicroelectronics...

[2]: https://www.digikey.com/products/en/integrated-circuits-ics/...

What're the comparative impacts on battery life of those?
Kinda hard to compare, since the external ADC doesn't do much without speaking to a microcontroller...

The STMG030 running full tilt at 64MHz, with ADC and one timer (4 channels) enabled takes about 6.7mA at 3.3V according to the simulator.

However looking at consumption in the sim with and without the ADC enabled at full speed, the ADC peripheral itself seems to consume a bit over 100uA. In comparison the ADS7042 datasheet says about 200uA at 1MSPS.

I haven't hooked up the STM32G030 (just got some), so I can't verify the simulator. Would be a fun project though.

Of course the STM32 has power-saving sleep modes etc, which reduces the overall chip consumption to a few uA.

Weirdly, no, a lot of the time.

It's $1 for an STM32F0 or $2.65 for an STM32F4 with a quantity of ten 12-bit 2.4 MSPS ADCs included, but a single-channel SOT23-5 ADC chip is also $1, and if you wanted 10 single-ended channels at 2 MSPS you're looking at $8 per device.

You typically don't use an off-chip ADC peripheral when most every MCU has a few channels of ADC on-board unless you've got special requirements (like sigma-delta high-resolution, simultaneous sampling, very high sample rate, etc), and those requirements cost money.

To be clear, there is a quantity of one ADC in the STM32F4, with a multiplexer in front. You could emulate this with an analog switch like 74HC4051, which costs pennies in quantity.
To the extra clear, there can be either one or three ADCs in the STM32F4, depending on model. The STM32F405/F415 models for example have three.

STM32 models with more than one ADC, they can typically be interleaved to increase effective sampling speed. In the case of the STM32F405/F415, the three 2.4 MSPS ADCs can be interleaved for up to 7.2 MSPS.

The STM32 ADCs are also quite accurate with proper board layout in my experience, so you actually get close to the 12 bits. Some newer STM32 models also support hardware oversampling to effectively get close to 16 bits.

[1]: https://www.st.com/en/microcontrollers-microprocessors/stm32...

There are significant advantages to onboard ADCs, including sampling rate and synchronization.
LPC4370 goes up to 80MSPS!
Yes, those are very nice onboard peripherals.