tags : Electronics, Computer Architecture, Robotics, Hardware stuff

FAQ

STM32 vs ESP32

FeatureSTM32ESP32
ArchitectureARM Cortex-M (32-bit)Tensilica Xtensa LX6 (dual-core 32-bit)
ManufacturerSTMicroelectronicsEspressif Systems
Primary FocusProcessing power, peripheral varietyWireless connectivity (WiFi/BT)
Wireless CapabilitiesRequires external modulesBuilt-in WiFi and Bluetooth
Price Range$1-15+ depending on model$3-10 depending on module
Power EfficiencyGenerally better for non-wireless applicationsOptimized for wireless with sleep modes
Development EnvironmentSTM32CubeIDE, Keil, IARArduino IDE, ESP-IDF, PlatformIO
MemoryVaries widely (8KB-2MB Flash, 2KB-640KB RAM)Typically 4MB Flash, 520KB SRAM
Industrial Temperature RangeMost variants availableLimited options
Ecosystem MaturityMature, extensive documentationNewer but rapidly growing
Use Case Sweet SpotIndustrial control, precise timing applicationsIoT, wireless networking projects

What IDE to use?

Terminologies/Jargons

Microcontroller Architectures and Families

TermFull NameDescription
AVRAlf and Vegard’s RISC processor8-bit microcontroller architecture developed by Atmel (now Microchip)
PICPeripheral Interface ControllerFamily of microcontrollers made by Microchip Technology
ARMAdvanced RISC MachinesCompany and processor architecture widely used in embedded systems
STM32ST Microelectronics 32-bitFamily of 32-bit ARM Cortex-M microcontrollers from ST Microelectronics
ESP32Espressif Systems Platform 32Dual-core microcontroller with integrated Wi-Fi and Bluetooth
ESP8266Espressif Systems Platform 8266Low-cost Wi-Fi microchip with TCP/IP stack
nRF52Nordic RF 52 seriesBluetooth Low Energy SoCs from Nordic Semiconductor
RISC-VReduced Instruction Set Computer - VOpen-source instruction set architecture
ATmega328PAtmel mega 328P8-bit AVR microcontroller used in Arduino UNO
ATtinyAtmel tinySmaller, simpler AVR microcontrollers with fewer features
RP2040Raspberry Pi MicrocontrollerDual-core ARM Cortex-M0+ microcontroller developed by Raspberry Pi Foundation

Architecture Types

See Computer Architecture

TermDescription
RISCReduced Instruction Set Computer - Simpler processor design with fewer instructions
CISCComplex Instruction Set Computer - More complex processor with many specialized instructions
HarvardArchitecture where program and data memory are separate
Modified HarvardArchitecture that allows some controlled access between program and data memory
Von NeumannArchitecture where program and data share the same memory
SoCSystem on Chip - Integrated circuit with all components of a computer or electronic system

Communication Protocols

TermFull NameDescription
UARTUniversal Asynchronous Receiver/TransmitterSerial communication protocol using TX/RX lines
USARTUniversal Synchronous/Asynchronous Receiver/TransmitterEnhanced UART with synchronous mode option
I2CInter-Integrated CircuitTwo-wire serial bus for connecting low-speed peripherals
TWITwo Wire InterfaceAnother name for I2C, used primarily by Atmel
SPISerial Peripheral InterfaceSynchronous serial communication for short-distance communication
CANController Area NetworkRobust vehicle bus standard for connecting microcontrollers
USBUniversal Serial BusStandard for connecting computers and electronic devices
BLEBluetooth Low EnergyWireless technology for short-range communication with low power requirements
WiFiWireless FidelityWireless networking technology based on IEEE 802.11 standards
MQTTMessage Queuing Telemetry TransportLightweight messaging protocol for small sensors and mobile devices
LoRaLong RangeLong-range, low-power wireless platform
RS-232/485Recommended Standard 232/485Standard for serial communication transmission of data

Peripherals and Hardware Features

TermFull NameDescription
GPIOGeneral Purpose Input/OutputDigital pins that can be configured as input or output
ADCAnalog-to-Digital ConverterConverts analog signals to digital values
DACDigital-to-Analog ConverterConverts digital values to analog signals
PWMPulse Width ModulationTechnique for getting analog results with digital means
JTAGJoint Test Action GroupStandard interface for debugging and programming microcontrollers
SWDSerial Wire DebugTwo-pin alternative to JTAG for debugging ARM processors
PIOProgrammable Input/OutputFlexible I/O system on the RP2040 (Raspberry Pi Pico)
TimerTimer/CounterHardware module that counts clock cycles for timing operations
RTCReal-Time ClockKeeps track of current time
WDTWatchdog TimerTimer that resets the system if the program hangs
FPUFloating Point UnitHardware that performs operations on floating point numbers
DSPDigital Signal ProcessorSpecialized processor for digital signal processing operations
UARTUniversal Asynchronous Receiver/TransmitterHardware for serial communication
PLLPhase-Locked LoopCircuit that generates an output signal whose phase is related to the phase of an input signal

Development Approaches and Environments

TermFull NameDescription
HALHardware Abstraction LayerSoftware layer that bridges hardware and operating system

Specific Development Boards

TermDescription
Arduino UNOPopular development board based on ATmega328P
Arduino NanoCompact version of the Arduino UNO
Raspberry Pi PicoDevelopment board based on RP2040 microcontroller
ESP32-DevKitDevelopment board for the ESP32 microcontroller
NodeMCUDevelopment board based on ESP8266
STM32 NucleoDevelopment board for STM32 microcontrollers
BBC micro:bitEducational development board based on nRF51822
TeensyDevelopment board based on ARM Cortex-M4
Adafruit FeatherFamily of development boards with standardized form factor
SparkFun RedBoardArduino-compatible development board

Tools and Equipment

TermFull NameDescription
Oscilloscope-Instrument that displays signal voltages as a function of time
Logic Analyzer-Device that captures and displays digital signals
Multimeter-Instrument that measures voltage, current, and resistance
Bus Pirate-Universal bus interface tool for debugging
UART-to-USB-Bridge for connecting UART interfaces to USB
ST-Link-Programming and debugging interface for STM32 microcontrollers
J-Link-Debug probe for ARM cores
OpenOCDOpen On-Chip DebuggerOpen-source tool for on-chip debugging, in-system programming

History & Lineage of Microcontrollers

FamilyYear IntroducedArchitectureNotable ExamplesBit WidthKey FeaturesCommunity/SupportBest ForThings to Be Aware Of
AVR1996HarvardATmega328P (Arduino UNO, 2005)8-bit- Simple architectureVery large (Arduino)Beginners- Limited memory
ATtiny Series (1999)- Excellent documentationMany tutorialsBattery-powered- Lower processing power
- Low power modesSimple projects- Slowly being phased out
- Direct memory access
PIC1976HarvardPIC16F (1993)8-bit to 32-bit- Wide varietyStrong but smaller than ArduinoIndustrial applications- Steeper learning curve
PIC18F (2000)- Industrial reliabilityLong-term projects- Less hobbyist-friendly IDE
PIC32 (2007)- Low power- Often requires paid tools
- Many peripherals
ARM Cortex-M2004Modified HarvardSTM32 (2007)32-bit- High performanceGrowing rapidlyComplex projects- More complex
NXP LPC (2003)- Rich peripheral setGood documentationPerformance-critical applications- Steeper learning curve
SAM (2006)- Advanced timers- More difficult debugging
RP2040 (Pi Pico, 2021)- DMA controllers
nRF522015Modified HarvardnRF52832 (2015)32-bit- Built-in Bluetooth 5.xGood Nordic supportWearables, Bluetooth IoTBLE complexity, More expensive than basic MCUs
nRF52840 (2017), nRF52833 (2019)- Ultra-low power
- ARM Cortex-M4F
ESP2014Modified HarvardESP8266 (2014)32-bit- Built-in WiFi/BTLarge and activeIoT projects- Higher power consumption
ESP32 (2016)- Dual-core (ESP32)Many librariesWireless connectivity- Documentation can be inconsistent
ESP32-C3 (2020)- Low cost- Complex WiFi stack
- Deep sleep modes
MSP4302000Von NeumannMSP430G2 (2010)16-bit- Ultra-low powerTexas Instruments supportBattery/energy harvesting- Smaller community
MSP430FR (2014)- FRAM optionsEnergia platformLow-power sensing- Fewer ready-made libraries
- Analog peripherals- Limited processing power
- Simple instruction set
RISC-V2010Harvard/Von NeumannGD32V (2019)32-bit/64-bit- Open architectureGrowing but still smallerFuture-proofing- Still emerging ecosystem
ESP32-C3 (2020)- Growing ecosystemOpen-source projects- Fewer off-the-shelf examples
SiFive FE310 (2017)- Modern design- Some debugging challenges
- Customizable
80511980HarvardAT89S52 (1995)8-bit- Simple architectureLegacy resourcesLearning computer architecture- Outdated architecture
STC microcontrollers (2005)- Historical significanceIndustrial supportSimple control systems- Limited memory addressing
- Still used in industry- Fewer modern tools
- Highly deterministic

Historical Timeline & Significance

EraSignificant MCUsYearImpactLegacy
1970sIntel 80481976First single-chip microcontrollerSet foundation for embedded computing
Intel 80511980First widely adopted MCU8051 architecture still influences many modern designs
1980sMotorola 68HC111984Advanced integrated peripheralsEstablished MCU programming paradigms
PIC16C1985RISC architecture for MCUsPioneered flash-based microcontrollers
1990sAVR series1996Flash memory + RISCAVR became foundation for Arduino
PIC16F1993Low-cost flash MCUsBrought MCUs to hobbyists
8051 derivatives1995+Widespread adoptionEnabled early DIY electronics
2000sARM7TDMI200132-bit becomes accessibleARM dominance begins
Arduino launch2005AVR-based development boardHobbyist revolution
ARM Cortex-M32004Modern 32-bit architectureArduino ecosystem transformed accessibility
2010sARM Cortex-M42010DSP + FPU capabilitiesAdvanced signal processing becomes accessible
ESP82662014$2 WiFi MCUIoT revolution
ESP322016Dual-core WiFi+BTWiFi integration becomes standard
STM32F7/H72015-2016High-performance MCUs32-bit becomes affordable for all applications
2020sRP2040 (Pi Pico)2021$4 dual-core with PIOOpen architectures gain traction
ESP32-C32020RISC-V based WiFi/BTRISC-V enters mainstream
ESP32-S32021AI accelerationAI capabilities in MCUs

How to study microcontrollers?

Other notes

8-bit vs 32-bit

Pro 8-bit: Good for learning fundamentals (AVR/Arduino, PIC) Pro 32-bit: Not harder than 8-bit, more future-proof, competitive pricing Industry view: 8-bit primarily for high-volume cost-sensitive products

Application-Specific Options

Bluetooth: Nordic (best documentation), alternatives: TI, STM32WB, Silabs WiFi: ESP32 (largest hobbyist community) General purpose: STM32 (industry standard) Recommendation: Choose based on project requirements, not preference

Development Methods

Bare-metal: Best for fundamental understanding (no Arduino framework) Framework-based: Easier entry but may hide important concepts Best practice: Start with framework, progress to bare-metal

Skills Progression

Basic peripherals: GPIO, Interrupts, Timers, ADC, PWM Communication protocols: UART, I2C, SPI Advanced topics: RTOS (only after mastering basics)

Learning Roadmap

this is based on the hardware i currently have in lab.

Phase 1: Arduino Nano (8-bit AVR) - Fundamentals (1 month)

  • Week 1-2: AVR Basics

    • Setup development environment (Arduino IDE → PlatformIO → AVR-GCC)
    • Direct register manipulation (no Arduino framework)
    • GPIO control, timers, and interrupts
    • Project: Electronic Dice

      • Roll electronic dice using a button press
      • Display results on LEDs in binary pattern
      • Use timer interrupts for button debouncing
      • Implement true random number generation using analog noise
  • Week 3-4: Communication & Peripherals

    • UART, SPI, and I²C implementation from scratch
    • ADC and sensor integration
    • Power management and sleep modes
    • Project: Weather Monitor

      • Connect temperature/humidity sensor via I²C
      • Implement custom low-level I²C driver (no Wire library)
      • Use sleep modes for power efficiency
      • Create serial protocol for data reporting

Phase 2: Raspberry Pi Pico (32-bit ARM) - Modern MCU (1-2 months)

  • Week 1-2: ARM Architecture

    • Setup Pico SDK environment (C/C++)
    • Understand ARM interrupt model
    • Multicore programming basics
    • Project: Digital Synthesizer

      • Generate waveforms using PWM and DMA
      • Use second core for effects processing
      • Implement MIDI input over USB
      • Create modular architecture for different sound modules
  • Week 3-6: Advanced Peripherals

    • PIO (Programmable I/O) programming
    • DMA for efficient data transfers
    • USB interface implementation
    • Project: Logic Analyzer

      • Use PIO to capture digital signals at high speed
      • Implement circular buffer with DMA
      • Create USB interface for PC visualization
      • Add protocol decoder for common interfaces (I²C, SPI)

Phase 3: ESP32 (32-bit Xtensa) - Connectivity & RTOS (2 months)

  • Week 1-2: Wireless & ESP-IDF

    • Move from Arduino framework to ESP-IDF
    • Wi-Fi and BLE configuration
    • Web server and RESTful API development
    • Project: Home Environmental Controller

      • Monitor multiple environmental factors
      • Create elegant web interface
      • Implement secure API for remote control
      • Use BLE for local control from smartphone
  • Week 3-4: Zephyr & Task Management

    • Zephyr tasks, queues, and semaphores
    • Memory management in multi-threaded environments
    • Power optimization for battery operation
    • Project: Wireless Sensor Network

      • Create mesh network of ESP32 devices
      • Implement efficient sleep/wake cycles
      • Use MQTT for cloud connectivity
      • Visualize data with dashboard
  • Week 5-8: Advanced Integration

    • Capstone Project: Automated Garden System

      • Arduino Nano: Soil sensors and pump control (low-power sentinel)
      • Raspberry Pi Pico: Camera processing for plant health analysis
      • ESP32: Connectivity hub and user interface
      • Custom PCB design for permanent installation
      • Smartphone app for monitoring and control