Skip to main content

STM32F042G4

ARM Cortex-M0 MCU

The STM32F042G4 is a arm cortex-m0 mcu from STMicroelectronics. View the full STM32F042G4 datasheet below including key specifications, electrical characteristics, absolute maximum ratings.

Manufacturer

STMicroelectronics

Category

ARM Cortex-M0 MCU

Key Specifications

ParameterValue
ADC Channels (Resolution)10-Ch 12-Bit
Case/PackageLQFP
China RoHSCompliant
ConnectivityCANbus, HDMI-CEC, I2C, IrDA, LINbus, SPI, UART/USART, USB
Core ArchitectureARM
Core ProcessorARM® Cortex®-M0
Core Size32-Bit
Data Bus Width32 b
Data ConvertersA/D 13x12b
DigiKey ProgrammableNot Verified
DigiKey ProgrammableNot Verified
EEPROM Memory Size0 B
Flash Memory Size32 kB
Frequency48 MHz
Height - Seated (Max)1.6 mm
InterfaceCAN, I2C, I2S, IrDA, LIN, SPI, USB
Lead FreeLead Free
Length7 mm
Lifecycle StatusProduction (Last Updated: 4 months ago)
Max Frequency32 MHz
Max Operating Temperature85 °C
Max Power Dissipation351 mW
Max Supply Current23.4 mA
Max Supply Voltage3.6 V
Memory Size32 kB
Memory TypeFLASH
Min Operating Temperature-40 °C
Min Supply Voltage2 V
Mounting TypeSurface Mount
Nominal Supply Current1.7 µA
Number of A/D Converters1
Number of ADC Channels13
Number of Channels10
Number of D/A Converters0
Number of I/O26
Number of I/Os26
Number of I2C Channels1
Number of Pins32
Number of Programmable I/O26
Number of SPI Channels1
Number of Terminals32
Number of Timers/Counters7
Number of UART Channels0
Number of USART Channels2
Operating Supply Voltage3.3 V
Operating Temperature-40°C ~ 85°C (TA)
Oscillator TypeInternal
Oscillator TypeInternal
Oscillator TypeInternal
Package / Case32-LQFP
PeripheralsDMA, I2S, POR, PWM, WDT
PeripheralsPOR
Flash Memory Size32KB (32K x 8)
Program Memory TypeFLASH
Radiation HardeningNo
RAM Size6K x 8 B
RAM Size6 kB
REACH SVHCYes
RoHSCompliant
Schedule B8542310000
Clock Speed48MHz
Supplier Device Package32-LQFP (7x7)
Supplier Device Package32-LQFP (7x7)
Temperature GradeIndustrial
Terminal Pitch800 µm
Supply Voltage1.65V ~ 3.6V
Watchdog TimerYes
Weight773.99868 mg
Width7 mm

Overview

Part: STM32F042x4/x6 — STMicroelectronics

Type: ARM Cortex-M0 MCU

Description: 32-bit ARM Cortex-M0 CPU operating at up to 48 MHz, with up to 32 KB Flash memory, 6 KB SRAM, crystal-less USB FS 2.0, CAN, 9 timers, 12-bit ADC, and various communication interfaces.

Operating Conditions:

  • Supply voltage: 2.0–3.6 V
  • Operating temperature: -40 to 85 °C (suffix-dependent — see Table 21 for grade-specific ranges)
  • Internal AHB clock frequency: 0–48 MHz

Absolute Maximum Ratings:

  • Max supply voltage: 4.0 V
  • Max continuous current: 120 mA (total into all VDD power lines)
  • Max junction/storage temperature: 150 °C

Key Specs:

  • CPU: ARM 32-bit Cortex-M0
  • Max CPU frequency: 48 MHz
  • Flash memory: 16 to 32 Kbytes
  • SRAM: 6 Kbytes
  • ADC: 12-bit, 1.0 μs, up to 10 channels
  • I/O supply voltage (VDDIO2): 1.65–3.6 V
  • I2C interface speed: 1 Mbit/s (Fast Mode Plus)
  • SPI interface speed: 18 Mbit/s

Features:

  • Crystal-less USB 2.0 full-speed interface
  • CAN interface
  • Nine timers (including advanced-control, 32-bit, 16-bit, watchdog, SysTick)
  • Communication interfaces: I2C, USART, SPI/I2S, HDMI CEC
  • Up to 38 fast I/Os, up to 24 with 5 V tolerant capability
  • 5-channel DMA controller
  • Capacitive sensing channels for touch applications
  • Calendar RTC with alarm and periodic wakeup
  • Serial wire debug (SWD)
  • 96-bit unique ID

Applications:

Package:

  • LQFP48
  • UFQFPN48
  • WLCSP36
  • LQFP32
  • UFQFPN32
  • UFQFPN28
  • TSSOP20

Features

  • Core: ARM ® 32-bit Cortex ® -M0 CPU, frequency up to 48 MHz
  • Memories
  • -16 to 32 Kbytes of Flash memory
  • -6 Kbytes of SRAM with HW parity
  • CRC calculation unit
  • Reset and power management
  • -Digital and I/Os supply: V DD = 2 V to 3.6 V
  • -Analog supply: V DDA = from V DD to 3.6 V
  • -Selected I/Os: V DDIO2 = 1.65 V to 3.6 V
  • -Power-on/Power down reset (POR/PDR)
  • -Programmable voltage detector (PVD)
  • -Low power modes: Sleep, Stop, Standby
  • -VBAT supply for RTC and backup registers
  • Clock management
  • -4 to 32 MHz crystal oscillator
  • -32 kHz oscillator for RTC with calibration
  • -Internal 8 MHz RC with x6 PLL option
  • -Internal 40 kHz RC oscillator
  • -Internal 48 MHz oscillator with automatic trimming based on ext. synchronization
  • Up to 38 fast I/Os
  • -All mappable on external interrupt vectors
  • -Up to 24 I/Os with 5 V tolerant capability and 8 with independent supply V DDIO2
  • 5-channel DMA controller
  • One 12-bit, 1.0 μs ADC (up to 10 channels)
  • -Conversion range: 0 to 3.6 V
  • -Separate analog supply: 2.4 V to 3.6 V
  • Up to 14 capacitive sensing channels for touchkey, linear and rotary touch sensors
  • Calendar RTC with alarm and periodic wakeup from Stop/Standby
ReferencePart number
STM32F042x4STM32F042F4, STM32F042G4, STM32F042K4, STM32F042T4, STM32F042C4
STM32F042x6STM32F042F6, STM32F042G6, STM32F042K6, STM32F042T6, STM32F042C6

Pin Configuration

Figure 3. LQFP48 package pinout

Figure 4. UFQFPN48 package pinout

39

Figure 5. WLCSP36 package pinout

  1. The above figure shows the package in top view, changing from bottom view in the previous document versions.

Figure 6. LQFP32 package pinout

Figure 5. WLCSP36 package pinout

Figure 7. UFQFPN32 package pinout

Figure 8. UFQFPN28 package

  1. Pin pair PA11/12 can be remapped in place of pin pair PA9/10 using the SYSCFG_CFGR1 register.

39

Figure 9. TSSOP20 package

  • 26&B287 1567 9''$ 3$
  • 3$
  • 3$
  • 3$
  • 3$

Table 12. Legend/abbreviations used in the pinout table

NameNameAbbreviationDefinition
Pin namePin nameUnless otherwise specified in brackets below the pin name, the pin function during and after reset is the same as the actual pin nameUnless otherwise specified in brackets below the pin name, the pin function during and after reset is the same as the actual pin name
SSupply pin
Pin typePin typeI/OInput / output pin
FT5 V-tolerant I/O
FTf5 V-tolerant I/O, FM+ capable
TTa3.3 V-tolerant I/O directly connected to ADC
I/O structureI/O structureTCStandard 3.3 V I/O
RST Bidirectionalreset pin with embedded weak pull-up resistor
NotesNotesUnless otherwise specified by a note, all I/Os are set as floating inputs during and after reset.Unless otherwise specified by a note, all I/Os are set as floating inputs during and after reset.
Pin functionsAlternate functionsFunctions selected through GPIOx_AFR registersFunctions selected through GPIOx_AFR registers
Pin functionsAdditional functionsFunctions directly selected/enabled through peripheral registersFunctions directly selected/enabled through peripheral registers

Table 12. Legend/abbreviations used in the pinout table

Table 13. STM32F042x pin definitions

Pin numbersPin numbersPin numbersPin numbersPin numbersPin numbersPin functionsPin functions
LQFP48/UFQFPN48WLCSP36LQFP32UFQFPN32UFQFPN28TSSPOP20Pin name (function upon reset)Pin typeI/O structureNotesAlternate functionAdditional functions
1-----VBATS--Backup power supplyBackup power supply
2A6----PC13I/OTC(1) (2)-WKUP2, RTC_TAMP1, RTC_TS, RTC_OUT
3B6----PC14- OSC32_IN (PC14)I/OTC(1) (2)-OSC32_IN
4C6----PC15- OSC32_OUT (PC15)I/OTC(1) (2)-OSC32_OUT
5B52222PF0-OSC_IN (PF0)I/OFTf-CRS_ SYNC I2C1_SDAOSC_IN
6C53333PF1-OSC_OUT (PF1)I/OFTf-I2C1_SCLOSC_OUT
7D54444NRSTI/ORST-Device reset input / internal reset output (active low)Device reset input / internal reset output (active low)
8D63201615VSSAS(3)Analog groundAnalog ground
9E55555VDDAS-Analog power supplyAnalog power supply
10F66666PA0I/OTTa-USART2_CTS, TIM2_CH1_ETR, TSC_G1_IO1RTC_ TAMP2, WKUP1, ADC_IN0,
11D47777PA1I/OTTa-USART2_RTS, TIM2_CH2, TSC_G1_IO2, EVENTOUTADC_IN1
12E48888PA2I/OTTa-USART2_TX, TIM2_CH3, TSC_G1_IO3ADC_IN2, WKUP4
13F59999PA3I/OTTa-USART2_RX, TIM2_CH4, TSC_G1_IO4ADC_IN3

Table 13. STM32F042x pin definitions

39

Table 13. STM32F042x pin definitions (continued)

Pin numbersPin numbersPin numbersPin numbersPin numbersPin numbersPin functionsPin functions
LQFP48/UFQFPN48WLCSP36LQFP32UFQFPN32UFQFPN28TSSPOP20Pin name (function upon reset)Pin typeI/O structureNotesAlternate functionAdditional functions
14C310101010PA4I/OTTa-SPI1_NSS, I2S1_WS, TIM14_CH1, TSC_G2_IO1, USART2_CK USB_NOEADC_IN4
15D311111111PA5I/OTTa-SPI1_SCK, I2S1_CK, CEC, TIM2_CH1_ETR, TSC_G2_IO2ADC_IN5
16E312121212PA6I/OTTa-SPI1_MISO, I2S1_MCK, TIM3_CH1, TIM1_BKIN, TIM16_CH1, TSC_G2_IO3, EVENTOUTADC_IN6
17F413131313PA7I/OTTa-SPI1_MOSI, I2S1_SD, TIM3_CH2, TIM14_CH1, TIM1_CH1N, TIM17_CH1, TSC_G2_IO4, EVENTOUTADC_IN7
18F3141414-PB0I/OTTa-TIM3_CH3, TIM1_CH2N, TSC_G3_IO2, EVENTOUTADC_IN8
19F215151514PB1I/OTTa-TIM3_CH4,TIM14_CH1, TIM1_CH3N, TSC_G3_IO3ADC_IN9
20D2-16--PB2I/OFT-TSC_G3_IO4-
21-----PB10I/OFTf-SPI2_SCK, CEC, TSC_SYNC, TIM2_CH3, I2C1_SCL-
22-----PB11I/OFTf-TIM2_CH4, EVENTOUT, I2C1_SDA-
23F11601615VSSS--GroundGround
24---1716VDDS--Digital power supplyDigital power supply
25-----PB12I/OFT-TIM1_BKIN, SPI2_NSS, EVENTOUT-

Table 13. STM32F042x pin definitions (continued)

Table 13. STM32F042x pin definitions (continued)

Pin numbersPin numbersPin numbersPin numbersPin numbersPin numbersPin functionsPin functions
LQFP48/UFQFPN48WLCSP36LQFP32UFQFPN32UFQFPN28TSSPOP20Pin name (function upon reset)Pin typeI/O structureNotesAlternate functionAdditional functions
26-----PB13I/OFTf-SPI2_SCK, TIM1_CH1N, I2C1_SCL-
27-----PB14I/OFTf-SPI2_MISO, TIM1_CH2N, I2C1_SDA-
28-----PB15I/OFT-SPI2_MOSI, TIM1_CH3NWKUP7, RTC_REFIN
29E21818--PA8I/OFT(4)USART1_CK, TIM1_CH1, EVENTOUT, MCO, CRS_SYNC-
30D119191917PA9I/OFTf(4)USART1_TX, TIM1_CH2, TSC_G4_IO1, I2C1_SCL-
31C120202018PA10I/OFTf(4)USART1_RX, TIM1_CH3, TIM17_BKIN, TSC_G4_IO2, I2C1_SDA-
32C2212119 (5)17 (5)PA11I/OFTf(4)CAN_RX, USART1_CTS, TIM1_CH4, TSC_G4_IO3, EVENTOUT, I2C1_SCLUSB_DM
33A1222220 (5)18 (5)PA12I/OFTf(4)CAN_TX,USART1_RTS, TIM1_ETR, TSC_G4_IO4, EVENTOUT, I2C1_SDAUSB_DP
34B123232119PA13I/OFT(4) (6)IR_OUT, SWDIO USB_NOE-
35-----VSSS--GroundGround
36E117171816VDDIO2S--Digital power supplyDigital power supply
37B224242220PA14I/OFT(4) (6)USART2_TX, SWCLK-

Table 13. STM32F042x pin definitions (continued)

39

Table 13. STM32F042x pin definitions (continued)

Pin numbersPin numbersPin numbersPin numbersPin numbersPin numbersPin functionsPin functions
LQFP48/UFQFPN48WLCSP36LQFP32UFQFPN32UFQFPN28TSSPOP20Pin name (function upon reset)Pin typeI/O structureNotesAlternate functionAdditional functions
38A2252523-PA15I/OFT(4)SPI1_NSS, I2S1_WS, USART2_RX, TIM2_CH1_ETR, EVENTOUT, USB_NOE-
39B3262624-PB3I/OFT-SPI1_SCK, I2S1_CK, TIM2_CH2, TSC_G5_IO1, EVENTOUT-
40A3272725-PB4I/OFT-SPI1_MISO, I2S1_MCK, TIM17_BKIN, TIM3_CH1, TSC_G5_IO2, EVENTOUT-
41E6282826-PB5I/OFT-SPI1_MOSI, I2S1_SD, I2C1_SMBA, TIM16_BKIN, TIM3_CH2WKUP6
42C4292927-PB6I/OFTf-I2C1_SCL, USART1_TX, TIM16_CH1N, TSC_G5_I03-
43A4303028-PB7I/OFTf-I2C1_SDA, USART1_RX, TIM17_CH1N, TSC_G5_IO4-
44--31--PF11-BOOT0I/OFT--Boot memory selection
-B431-11PB8-BOOT0I/OFTf-I2C1_SCL, CEC, TIM16_CH1, TSC_SYNC, CAN_RXBoot memory selection
45--32--PB8I/OFTf-I2C1_SCL, CEC, TIM16_CH1, TSC_SYNC, CAN_RX-

Table 13. STM32F042x pin definitions (continued)

Electrical Characteristics

The definition and values of input/output AC characteristics are given in Figure 24 and Table 52 , respectively. Unless otherwise specified, the parameters given are derived from tests performed under the ambient temperature and supply voltage conditions summarized in Table 21: General operating conditions .

Table 52. I/O AC characteristics (1)(2)

OSPEEDRy [1:0] value (1)SymbolParameterConditionsMinMaxUnit
x0f max(IO)outMaximum frequency (3)C L = 50 pF, V DDIOx ≥ 2 V-2MHz
x0t f(IO)outOutput fall timeC L = 50 pF, V DDIOx ≥ 2 V-125ns
x0t r(IO)outOutput rise timeC L = 50 pF, V DDIOx ≥ 2 V-125ns
x0f max(IO)outMaximum frequency (3)C L = 50 pF, V DDIOx < 2 V-1MHz
x0t f(IO)outOutput fall timeC L = 50 pF, V DDIOx < 2 V-125ns
x0t r(IO)outOutput rise timeC L = 50 pF, V DDIOx < 2 V-125ns
01f max(IO)outMaximum frequency (3)C L = 50 pF, V DDIOx ≥ 2 V-10MHz
01t f(IO)outOutput fall timeC L = 50 pF, V DDIOx ≥ 2 V-25ns
01t r(IO)outOutput rise timeC L = 50 pF, V DDIOx ≥ 2 V-25ns
01f max(IO)outMaximum frequency (3)C L = 50 pF, V DDIOx < 2 V-4MHz
01t f(IO)outOutput fall timeC L = 50 pF, V DDIOx < 2 V-62.5ns
01t r(IO)outOutput rise timeC L = 50 pF, V DDIOx < 2 V-62.5ns
11f max(IO)outMaximum frequency (3)C L = 30 pF, V DDIOx ≥ 2.7 V-50MHz
11f max(IO)outMaximum frequency (3)C L = 50 pF, V DDIOx ≥ 2.7 V-30MHz
11f max(IO)outMaximum frequency (3)C L = 50 pF, 2 V ≤ V DDIOx < 2.7 V-20MHz
11f max(IO)outMaximum frequency (3)C L = 50 pF, V DDIOx < 2 V-10MHz
f(IO)out Output fall timeC L = 30 pF, V DDIOx ≥ 2.7 V-5
f(IO)out Output fall timeC L = 50 pF, V DDIOx ≥ 2.7 V-8
tf(IO)out Output fall timeC L = 50 pF, 2 V ≤ V DDIOx < 2.7 V-12
f(IO)out Output fall timeC L = 50 pF, V DDIOx < 2 V-25
t r(IO)outOutput rise timeC L = 30 pF, V DDIOx ≥ 2.7 V-5ns
t r(IO)outOutput rise timeC L = 50 pF, V DDIOx ≥ 2.7 V-8ns
t r(IO)outOutput rise timeC L = 50 pF, 2 V ≤ V DDIOx < 2.7 V-12ns
t r(IO)outOutput rise timeC L = 50 pF, V DDIOx < 2 V-25ns

Table 52. I/O AC characteristics (1)(2)

90

Table 52. I/O AC characteristics (1)(2) (continued)

OSPEEDRy [1:0] value (1)SymbolParameterConditionsMinMaxUnit
Fm+ configuration (4)f max(IO)outMaximum frequency (3)C L = 50 pF, V DDIOx ≥ 2 V-2MHz
Fm+ configuration (4)t f(IO)outOutput fall timeC L = 50 pF, V DDIOx ≥ 2 V-12ns
Fm+ configuration (4)t r(IO)outOutput rise timeC L = 50 pF, V DDIOx ≥ 2 V-34ns
Fm+ configuration (4)f max(IO)outMaximum frequency (3)C L = 50 pF, V DDIOx < 2 V-0.5MHz
Fm+ configuration (4)t f(IO)outOutput fall timeC L = 50 pF, V DDIOx < 2 V-16ns
Fm+ configuration (4)t r(IO)outOutput rise timeC L = 50 pF, V DDIOx < 2 V-44ns
-t EXTIpwPulse width of external signals detected by the EXTI controller-10-ns
  1. Guaranteed by design, not tested in production.
  2. The maximum frequency is defined in Figure 24 .
  3. When Fm+ configuration is set, the I/O speed control is bypassed. Refer to the STM32F0xxxx reference manual RM0091 for a detailed description of Fm+ I/O configuration.

Figure 24. I/O AC characteristics definition

Absolute Maximum Ratings

Stresses above the absolute maximum ratings listed in Table 18: Voltage characteristics , Table 19: Current characteristics and Table 20: Thermal characteristics may cause permanent damage to the device. These are stress ratings only and functional operation of the device at these conditions is not implied. Exposure to maximum rating conditions for extended periods may affect device reliability.

Table 18. Voltage characteristics (1)

SymbolRatingsMinMaxUnit
V DD -V SSExternal main supply voltage- 0.34.0V
V DDIO2 -V SSExternal I/O supply voltage- 0.34.0V
V DDA -V SSExternal analog supply voltage- 0.34.0V
V DD -V DDAAllowed voltage difference for V DD > V DDA-0.4V
V BAT -V SSExternal backup supply voltage- 0.34.0V
V IN (2)Input voltage on FT and FTf pinsV SS - 0.3V DDIOx + 4.0 (3)V
V IN (2)Input voltage on TTa pinsV SS - 0.34.0V
V IN (2)Input voltage on any other pinV SS - 0.34.0V
\∆ V DDx \Variations between different V DD power pins-
\V SSx - V SS \Variations between all the different ground pins-
V ESD(HBM)Electrostatic discharge voltage (human body model)see Section 6.3.12: Electrical sensitivity characteristicssee Section 6.3.12: Electrical sensitivity characteristics-

Table 19. Current characteristics

SymbolRatingsMax.Unit
Σ I VDDTotal current into sum of all VDD power lines (source) (1)120mA
Σ I VSSTotal current out of sum of all VSS ground lines (sink) (1)-120mA
I VDD(PIN)Maximum current into each VDD power pin (source) (1)100mA
I VSS(PIN)Maximum current out of each VSS ground pin (sink) (1)-100mA
I IO(PIN)Output current sunk by any I/O and control pin25mA
I IO(PIN)Output current source by any I/O and control pin-25mA
Σ I IO(PIN)Total output current sunk by sum of all I/Os and control pins (2)80mA
Σ I IO(PIN)Total output current sourced by sum of all I/Os and control pins (2)-80mA
Σ I IO(PIN)Total output current sourced by sum of all I/Os supplied by VDDIO2-40mA
I INJ(PIN) (3)Injected current on FT and FTf pins-5/+0 (4)mA
I INJ(PIN) (3)Injected current on TC and RST pin± 5mA
I INJ(PIN) (3)Injected current on TTa pins (5)± 5mA
Σ I INJ(PIN)Total injected current (sum of all I/O and control pins) (6)± 25mA
  1. This current consumption must be correctly distributed over all I/Os and control pins. The total output current must not be sunk/sourced between two consecutive power supply pins referring to high pin count QFP packages.
  2. A positive injection is induced by V IN > V DDIOx while a negative injection is induced by V IN < V SS . I INJ(PIN) must never be exceeded. Refer to Table 18: Voltage characteristics for the maximum allowed input voltage values.
  3. Positive injection is not possible on these I/Os and does not occur for input voltages lower than the specified maximum value.
  4. On these I/Os, a positive injection is induced by V IN > V DDA . Negative injection disturbs the analog performance of the device. See note (2) below Table 56: ADC accuracy .
  5. When several inputs are submitted to a current injection, the maximum Σ I INJ(PIN) is the absolute sum of the positive and negative injected currents (instantaneous values).

Table 20. Thermal characteristics

SymbolRatingsValueUnit
T STGStorage temperature range-65 to +150°C
T JMaximum junction temperature150°C

Table 20. Thermal characteristics

90

Thermal Information

The maximum chip junction temperature (T J max) must never exceed the values given in Table 21: General operating conditions .

The maximum chip-junction temperature, T J max, in degrees Celsius, may be calculated using the following equation:

Package Information

In order to meet environmental requirements, ST offers these devices in different grades of ECOPACK ® packages, depending on their level of environmental compliance. ECOPACK ® specifications, grade definitions and product status are available at: www.st.com . ECOPACK ® is an ST trademark.

Related Variants

The following components are covered by the same datasheet.

Part NumberManufacturerPackage
STM32F042C4STMicroelectronics
STM32F042C6STMicroelectronics
STM32F042F4STMicroelectronics
STM32F042F6STMicroelectronics
STM32F042G6STMicroelectronics
STM32F042K4STMicroelectronics
STM32F042K6STMicroelectronics
STM32F042K6T6STMicroelectronics32-LQFP
STM32F042T4STMicroelectronics
STM32F042T6STMicroelectronics
STM32F042XSTMicroelectronics
Data on this page is extracted from publicly available manufacturer datasheets using automated tools including AI. It may contain errors or omissions. Always verify specifications against the official manufacturer datasheet before making design or purchasing decisions. See our Terms of Service. Rights holders can submit a takedown request.

Get structured datasheet data via API

Get started free