English
English
简体中文
日本語

M5IOE1 I2C Control Protocol


1. Basic Information

Item Description
Product M5IOE1
Bus I2C, slave mode
I2C address (7-bit) 0x6F–0x76 (selected by the power-on sampled voltage on IO7)
Communication rate 100 kHz (default) / 400 kHz
Register address width 8 bit
Register data width 8 bit

M5IOE1 is an IO expansion management chip programmed with M5Stack custom IO firmware. It provides 14 GPIOs, four 12-bit ADC channels, four PWM channels, an internal temperature sensor, a 32-byte RAM protection/retention area, Neopixel output, and GPIO interrupt management. The chip also supports I2C idle sleep, AW8737A pulse control, and programmable GPIO pull-up/pull-down, open-drain/push-pull output, and interrupt polarity settings.

1.1 Pin Description

Chip pin Signal Default function Alternate function Description
1 NRST NRST — Active-low reset
2 INT_OUT Interrupt output — Pulled low when an external interrupt is triggered; released high after GPIO_IS is cleared; open-drain and requires an external pull-up
3 IO14 GPIO Neopixel output Interrupt-multiplexed with IO10
4 VSS VSS — Ground
5 IO12 GPIO SWDIO SWD is disabled by default; interrupt-multiplexed with IO7
6 VCC VCC — Positive power supply
7 IO1 GPIO — Interrupt-multiplexed with IO6
8 SDA I2C — I2C data line, open-drain, requires an external pull-up
9 SCL I2C — I2C clock line, open-drain, requires an external pull-up
10 IO11 GPIO PWM3 Interrupt-multiplexed with IO13
11 IO2 GPIO ADC1 Interrupt-multiplexed with IO3; the pin interrupt is disabled when ADC is enabled
12 IO8 GPIO PWM2 Interrupt-multiplexed with IO9; the pin interrupt is disabled when PWM is enabled
13 IO9 GPIO PWM1 Interrupt-multiplexed with IO8; the pin interrupt is disabled when PWM is enabled
14 IO3 GPIO — Interrupt-multiplexed with IO2
15 IO13 GPIO SWCLK SWD is disabled by default; interrupt-multiplexed with IO11
16 IO4 GPIO ADC2 The pin interrupt is disabled when ADC is enabled
17 IO5 GPIO ADC3 The pin interrupt is disabled during I2C idle sleep or when ADC is enabled
18 IO6 GPIO — Interrupt-multiplexed with IO1
19 IO7 GPIO ADC4 Its power-on voltage is sampled to select the I2C address; interrupt-multiplexed with IO12; the pin interrupt is disabled when ADC is enabled
20 IO10 GPIO PWM4 Interrupt-multiplexed with IO14

The pull-up and pull-down columns in the datasheet pin table are marked as “none” for all 20 physical pins above. GPIO internal pull-ups and pull-downs are configured through the GPIO_PU_x and GPIO_PD_x registers.

All GPIO outputs, including Neopixel and PWM outputs, use open-drain mode by default. Configure the corresponding GPIO as push-pull when no external pull-up is available. SDA, SCL, and INT_OUT also use open-drain mode and require external pull-up resistors.

1.2 Resources and Functions

Resource Quantity/range Description
GPIO IO1–IO14 Configurable input, output, pull-up/down, drive mode, and interrupt
ADC 4 channels IO2, IO4, IO5, and IO7, 12-bit conversion
PWM 4 channels IO9, IO8, IO11, and IO10
Temperature sensor 1 channel Built-in 12-bit temperature value in degrees Celsius
Neopixel Up to 32 RGB565 data output on IO14
RTC RAM 32 bytes RAM retention / power-off retention area
I2C address 0x6F–0x76 Selected by the power-on voltage range on IO7

2. I2C Access Rules

2.1 Access Permissions

Permission Meaning
R Read-only
W Write-only
R/W Read/write
Reserved Reserved; do not depend on its contents

2.2 General Access Procedure

Register Write

The host sends a 1-byte starting register address followed by one or more data bytes:

START + SlaveAddr(W) + RegAddr + Data0 [+ Data1 ...] + STOP

Register Read

The host first writes a 1-byte starting register address, then reads the data using a repeated start:

START + SlaveAddr(W) + RegAddr + RESTART + SlaveAddr(R) + Data0 [+ Data1 ...] + STOP

For continuous reads and writes, M5IOE1 increments the register address from the starting address. A single transaction must remain within the same continuous read/write block.

2.3 Continuous Read/Write Blocks

M5IOE1 supports the following burst continuous read/write blocks. Access that crosses two blocks or exceeds a block boundary must be split into multiple I2C transactions.

Continuous block Contents
0x00–0x2F System, GPIO, ADC, temperature, and PWM registers
0x30–0x6F Neopixel RGB565 buffer
0x70–0x8F RTC RAM storage
0x90 AW8737A pulse control register

Addresses 0x2A–0x2F and 0x91 and above are not defined as valid function registers in the manual. Do not treat data at undefined addresses as valid configuration, and do not rely on readback values from reserved bits.

2.4 Data Types and Byte Order

  • All registers are transferred one byte at a time.
  • Consecutive 16-bit values use little-endian order, with the low byte at the lower address:
value = LowByte | (HighByte << 8)
  • ADC and temperature sensor results are 12-bit values: the upper 4 bits are in bits[3:0] of the high byte, and the lower 8 bits are in the low byte.
  • PWM duty is 12-bit, ranging from 0x000 (0%) to 0xFFF (approximately 100%).
  • Each Neopixel buffer entry uses 2 bytes of RGB565 data.

3. Register Overview

Address/range Module Length Permission Default Description Details
0x00–0x02 System 3 R — / A UID and firmware version See Section 4
0x03–0x14 GPIO 18 R/W or R See register table Direction, level, pull-up/down, IRQ, and drive mode See Section 5
0x15–0x17 ADC 3 R/W or R 0x00 ADC control and 12-bit conversion result See Section 6
0x18–0x1A Temperature 3 R/W or R 0x00 Temperature sampling and 12-bit result See Section 6
0x1B–0x22 PWM 8 R/W 0x00 Four PWM duty values See Section 7
0x23 I2C_CFG 1 R/W 0x00 Speed, wake type, pull-up/down, and idle sleep See Section 8
0x24 LED_CFG 1 R/W 0x00 Neopixel count and refresh See Section 10
0x25–0x26 PWM_FREQ 2 R/W 0x01F4 PWM frequency in Hz See Section 7
0x27–0x28 REF_VOLTAGE 2 R Runtime ADC reference voltage in mV See Section 6
0x29 RESET 1 W — Restore factory configuration See Section 4
0x2A–0x2F — 6 Reserved — Undefined addresses —
0x30–0x6F LED_RAM 64 R/W 0x00 RGB565 data for 32 Neopixels See Section 10
0x70–0x8F RTC_RAM 32 R/W 0x00 32-byte storage area See Section 10
0x90 PULSE 1 R/W 0x00 AW8737A pulse control See Section 10
0x91–0xFF — 111 Reserved — Beyond the manual-defined range —

4. System Registers

4.1 Device Information (0x00–0x02)

Address Name Permission Default Bits/format Description
0x00 UID_L R — UID[7:0] Lower 8 bits of the factory UID
0x01 UID_H R — UID[15:8] Upper 8 bits of the factory UID
0x02 REV R A SW[7:0] Firmware version; the current default is ASCII A

UID[15:0] is the 16-bit factory UID. Read 0x00 and 0x01, then combine them in little-endian order:

UID = UID_L | (UID_H << 8)

4.2 Restore Factory Configuration (0x29)

Address Name Permission Write value Description
0x29 RESET W 0x3A Triggers factory restore

Writing 0x3A to RESET (0x29) triggers a factory restore. Other write values must not be used as valid reset commands.

5. GPIO Registers

5.1 Direction, Level, and Drive Mode (0x03–0x14)

Address Name Permission Default Bit definition Description
0x03 GPIO_M_L R/W 0x00 M1–M8 GPIO1–GPIO8 direction
0x04 GPIO_M_H R/W 0x00 M9–M14; upper 2 bits reserved GPIO9–GPIO14 direction
0x05 GPIO_O_L R/W 0x00 O1–O8 GPIO1–GPIO8 output level
0x06 GPIO_O_H R/W 0x00 O9–O14; upper 2 bits reserved GPIO9–GPIO14 output level
0x07 GPIO_I_L R — I1–I8 GPIO1–GPIO8 real-time input level
0x08 GPIO_I_H R — I9–I14; upper 2 bits reserved GPIO9–GPIO14 real-time input level
0x09 GPIO_PU_L R/W 0x00 PU1–PU8 GPIO1–GPIO8 pull-up control
0x0A GPIO_PU_H R/W 0x00 PU9–PU14; upper 2 bits reserved GPIO9–GPIO14 pull-up control
0x0B GPIO_PD_L R/W 0x00 PD1–PD8 GPIO1–GPIO8 pull-down control
0x0C GPIO_PD_H R/W 0x00 PD9–PD14; upper 2 bits reserved GPIO9–GPIO14 pull-down control
0x0D GPIO_IE_L R/W 0x00 IE1–IE8 GPIO1–GPIO8 interrupt enable
0x0E GPIO_IE_H R/W 0x00 IE9–IE14; upper 2 bits reserved GPIO9–GPIO14 interrupt enable
0x0F GPIO_IP_L R/W 0x00 IP1–IP8 GPIO1–GPIO8 interrupt polarity
0x10 GPIO_IP_H R/W 0x00 IP9–IP14; upper 2 bits reserved GPIO9–GPIO14 interrupt polarity
0x11 GPIO_IS_L R/W 0x00 IS1–IS8 GPIO1–GPIO8 interrupt status
0x12 GPIO_IS_H R/W 0x00 IS9–IS14; upper 2 bits reserved GPIO9–GPIO14 interrupt status
0x13 GPIO_DRV_L R/W 0xFF DRV1–DRV8 GPIO1–GPIO8 drive mode
0x14 GPIO_DRV_H R/W 0x3F DRV9–DRV14; upper 2 bits reserved GPIO9–GPIO14 drive mode

When the corresponding bit in GPIO_M_x is 0, the pin is in input mode; when it is 1, the pin is in output mode. GPIO_O_x is effective only when the corresponding pin is configured as a GPIO output; GPIO_I_x is the real-time input level and is read-only.

When the corresponding bit in GPIO_DRV_x is 0, push-pull output is used; when it is 1, open-drain output is used. The default is open-drain. After a GPIO is occupied by an ADC, PWM, I2C, SWD, or Neopixel function, its GPIO input/output register configuration is no longer effective.

Therefore, M[n]=0 indicates input mode and M[n]=1 indicates output mode; all direction registers default to input. DRV[n]=0 indicates push-pull output and DRV[n]=1 indicates open-drain output.

5.2 Pull-up and Pull-down Configuration (0x09–0x0C)

Each bit in GPIO_PU_x and GPIO_PD_x controls the pull-up and pull-down of the corresponding GPIO. The combinations are as follows:

PU[n] PD[n] Mode
1 0 Pull-up enabled
0 1 Pull-down enabled
0 0 No pull-up/down
1 1 No pull-up/down

5.3 Interrupt Enable, Polarity, and Status (0x0D–0x12)

  • GPIO_IE_x: write 1 to the corresponding bit to enable the pin interrupt, or write 0 to disable it.
  • GPIO_IP_x: when the corresponding bit is 1, use rising-edge/high-level triggering; when it is 0, use falling-edge/low-level triggering.
  • GPIO_IS_x: a corresponding bit of 1 indicates that an interrupt has been triggered; write 0 to clear that interrupt status. After the related GPIO_IS_x is cleared, INT_OUT is released high.

In other words, IE[n]=1 enables the pin interrupt, IP[n]=1 selects rising-edge/high-level triggering, IP[n]=0 selects falling-edge/low-level triggering, and IS[n]=1 indicates that an interrupt has been triggered.

5.4 Drive Mode and Interrupt Mutual Exclusion

The following GPIO groups cannot have interrupts enabled at the same time:

Pin group Mutual exclusion
IO1 and IO6 Cannot enable both interrupts
IO2 and IO3 Cannot enable both interrupts
IO7 and IO12 Cannot enable both interrupts
IO8 and IO9 Cannot enable both interrupts
IO10 and IO14 Cannot enable both interrupts
IO11 and IO13 Cannot enable both interrupts

When alternate functions such as ADC or PWM are enabled, the interrupt of the corresponding pin is disabled automatically. When I2C idle sleep is enabled, the interrupt of IO5 is also disabled automatically.

6. ADC and Temperature Sensor Registers

6.1 ADC Control and Conversion Result (0x15–0x17)

Address Name Permission Default Bit definition Description
0x15 ADC_CTRL R/W 0x00 BUSY, START, CH[2:0] ADC channel selection and start
0x16 ADC_D_L R — ADC Data[7:0] Lower 8 bits of conversion result
0x17 ADC_D_H R — ADC Data[11:8]; upper 4 bits reserved Upper 4 bits of conversion result

The bit definitions of ADC_CTRL (0x15) are as follows:

Bit Name Description
bit7 BUSY 1 during conversion, 0 after completion; read-only
bit6 START Write 1 to start a 12-bit conversion; automatically cleared by hardware
[5:3] — Reserved
[2:0] CH ADC channel selection
CH[2:0] Channel Result
000 Disabled ADC conversion is not started
001 ADC1 12-bit ADC value of IO2
010 ADC2 12-bit ADC value of IO4
011 ADC3 12-bit ADC value of IO5
100 ADC4 12-bit ADC value of IO7

The ADC conversion flow is: write the channel and set START to 1, wait for BUSY=0, and then read ADC_D_L/H. Combine the result in little-endian order:

adc_raw = ADC_D_L | ((ADC_D_H & 0x0F) << 8)

6.2 Temperature Sampling and Result (0x18–0x1A)

Address Name Permission Default Bit definition Description
0x18 TEMP_CTRL R/W 0x00 TBUSY, TSTART Temperature sampling control
0x19 TEMP_D_L R — TEMP Data[7:0] Lower 8 bits of temperature result
0x1A TEMP_D_H R — TEMP Data[11:8]; upper 4 bits reserved Upper 4 bits of temperature result

Write 1 to TSTART in TEMP_CTRL (0x18) to start sampling; it is cleared automatically, and TBUSY is 1 during sampling. Combine the 12-bit temperature value in degrees Celsius:

temperature = TEMP_D_L | ((TEMP_D_H & 0x0F) << 8)

6.3 Reference Voltage (0x27–0x28)

Address Name Permission Bits/format Description
0x27 REF_VOLTAGE_L R REF_V[7:0] Lower 8 bits of reference voltage, in mV
0x28 REF_VOLTAGE_H R REF_V[15:8] Upper 8 bits of reference voltage, in mV

Combine the reference voltage in little-endian order. It can be used to convert ADC results to actual voltage.

7. PWM Registers

M5IOE1 provides four PWM channels: PWM1 outputs to IO9, PWM2 outputs to IO8, PWM3 outputs to IO11, and PWM4 outputs to IO10. When no external pull-up is available, configure the corresponding GPIO as push-pull output.

Address Name Permission Default Description
0x1B PWM1_L R/W 0x00 Lower 8 bits of PWM1 duty
0x1C PWM1_H R/W 0x00 PWM1 enable, polarity, and upper 4 bits
0x1D PWM2_L R/W 0x00 Lower 8 bits of PWM2 duty
0x1E PWM2_H R/W 0x00 PWM2 enable, polarity, and upper 4 bits
0x1F PWM3_L R/W 0x00 Lower 8 bits of PWM3 duty
0x20 PWM3_H R/W 0x00 PWM3 enable, polarity, and upper 4 bits
0x21 PWM4_L R/W 0x00 Lower 8 bits of PWM4 duty
0x22 PWM4_H R/W 0x00 PWM4 enable, polarity, and upper 4 bits
0x25 PWM_FREQ_L R/W 0xF4 Lower 8 bits of frequency, in Hz
0x26 PWM_FREQ_H R/W 0x01 Upper 8 bits of frequency, in Hz

The bit definitions of each PWM high byte are the same:

Bit Name Description
bit7 EN 1 = enable PWM, 0 = stop
bit6 POL 1 = active low, 0 = active high
[5:4] — Reserved
[3:0] DUTY[11:8] Upper 4 bits of duty

The 12-bit duty value is assembled from the high and low registers and ranges from 0x000 (0%) to 0xFFF (approximately 100%):

PWMx_duty = ((PWMx_H & 0x0F) << 8) | PWMx_L
Duty cycle (%) = PWMx_duty / 0xFFF × 100

The PWM frequency registers use little-endian order. The default value 0x01F4 is 500 Hz. The high and low bytes of a PWM configuration should be written in one permitted continuous write transaction to avoid two different duty or frequency settings being applied briefly.

8. I2C Configuration and Idle Sleep

8.1 I2C Configuration Register (0x23)

Bit Name Value Description
bit7 Reserved — Reserved
bit6 INTERNAL_PU/PD 0 / 1 0 = enable internal pull-up/down, 1 = disable
bit5 WAKE_TYPE 0 / 1 0 = wake on falling edge, 1 = wake on rising edge
bit4 SPD 0 / 1 0 = 100 kHz, 1 = 400 kHz
[3:0] SLEEP 0–15 Idle sleep time in seconds; 0 = no sleep

The SLEEP setting controls the I2C bus idle sleep time. Write 0 to disable sleep. After entering I2C idle sleep, the interrupt of IO5 is disabled automatically. I2C idle sleep is unavailable when PWM is enabled.

9. GPIO Interrupts and Alternate Functions

9.1 Alternate Function Priority

When a pin is occupied by an ADC, PWM, I2C, SWD, or Neopixel function, the corresponding GPIO input/output mode and output-register configuration are ineffective. When an alternate function is enabled, the interrupt of the corresponding pin is also disabled automatically according to the manual.

Alternate function Pin Interrupt effect
ADC1 IO2 IO2 interrupt disabled
ADC2 IO4 IO4 interrupt disabled
ADC3 IO5 IO5 interrupt disabled
ADC4 IO7 IO7 interrupt disabled
PWM1 IO9 IO9 interrupt disabled
PWM2 IO8 IO8 interrupt disabled
PWM3 IO11 IO11 interrupt disabled
PWM4 IO10 IO10 interrupt disabled
Neopixel IO14 Interrupt-multiplexed with IO10
I2C idle sleep IO5 IO5 interrupt disabled
SWDIO/SWCLK IO12/IO13 SWD disabled by default

9.2 Interrupt Output

When an external interrupt is triggered, INT_OUT is pulled low. After the host clears the related GPIO_IS_x status, INT_OUT is released high. INT_OUT is an open-drain output and must be connected to an external pull-up resistor.

10. Neopixel, AW8737A, and RTC RAM

10.1 Neopixel (0x24, 0x30–0x6F)

The bit definitions of LED_CFG (0x24) are as follows:

Bit Name Description
bit7 Reserved Reserved
bit6 REFRESH Write 1 to refresh LED_RAM data immediately; automatically cleared
[5:0] LED Neopixel count 0–32; 0 = all off

LED_RAM (0x30–0x6F) contains 64 bytes. Each LED uses 2 bytes of RGB565 data, supporting up to 32 LEDs. Data is stored consecutively in LED order, with the low byte of each LED first. After writing pixel data, set LED_CFG.REFRESH to 1 to refresh the output. The Neopixel output pin is IO14, and its output uses open-drain mode by default.

10.2 AW8737A Pulse Control (0x90)

The bit definitions of PULSE_CTRL (0x90) are as follows:

Bit Name Description
bit7 REFRESH Write 1 to refresh the pulse configuration and execute it immediately
[6:5] NUM[1:0] Number of pulses, 0–3
[4:0] GPIO[4:0] Target GPIO number, 0–13

When REFRESH=0, no refresh occurs and the device waits for the next trigger. When REFRESH=1, the pulse configuration is refreshed and executed immediately; the target GPIO is used to pulse-modulate the AW8737A audio signal amplitude.

GPIO numbers 0–13 correspond to hardware IO1–IO14, respectively. After the pulse configuration succeeds, the target GPIO switches to output mode and outputs the specified number of pulses. GPIOs use open-drain mode by default and require an external pull-up; the corresponding GPIO can also be configured as push-pull first.

10.3 RTC RAM Storage (0x70–0x8F)

Address range Name Permission Description
0x70–0x8F RTC_RAM R/W 32-byte RAM storage

This area can store counters, calibration parameters, and other data. Continuous reads and writes must stay within the 0x70–0x8F block boundary.

11. I2C Address Selection

At startup, the device reads the voltage on IO7 (PA6) and selects a 7-bit I2C address according to the voltage range. The voltage-to-address mapping is as follows:

IO7 voltage range I2C address
Floating 0x6F–0x76 (random address)
0 mV–412.5 mV 0x6F
412.5 mV–825 mV 0x70
825 mV–1237.5 mV 0x71
1237.5 mV–1650 mV 0x72
1650 mV–2062.5 mV 0x73
2062.5 mV–2475 mV 0x74
2475 mV–2887.5 mV 0x75
2887.5 mV–3300 mV 0x76

To prevent voltage fluctuations from affecting address selection, do not set the IO7 voltage near a range boundary. When IO7 is floating, the address is assigned randomly; IO7 must not be left floating during power-on sampling.

12. Host Access Examples

The examples below use ADDR for the current 7-bit address selected by the IO7 voltage; W and R indicate the write and read directions.

12.1 Read UID and Firmware Version

Write: [ADDR(W)] [0x00]
Read: [ADDR(R)] [UID_L, UID_H, REV]
Combine: UID = UID_L | (UID_H << 8)

12.2 Start ADC1 and Read the Result

ADC1 corresponds to IO2, and the channel-selection value is 001:

Write: [ADDR(W)] [0x15] [0x41]   // START = 1, CH = 001
Read: [ADDR(W)] [0x15]
Read: [ADDR(R)] [ADC_CTRL]
Repeat read until BUSY = 0
Read: [ADDR(W)] [0x16]
Read: [ADDR(R)] [ADC_D_L, ADC_D_H]
Calculate: adc_raw = ADC_D_L | ((ADC_D_H & 0x0F) << 8)

12.3 Configure PWM1

The following example sets the PWM1 duty to 0x080 and enables the output:

Write: [ADDR(W)] [0x1B] [0x80, 0x80]

Here, 0x1B is PWM1_L and 0x1C is PWM1_H. bit7=1 of PWM1_H enables PWM, and bits[3:0]=0 sets the upper 4 duty bits to 0. In actual use, write the corresponding high and low bytes for the target duty.

12.4 Refresh Neopixel

Write: [ADDR(W)] [0x24] [0x03]       // LED = 3, REFRESH = 0
Write: [ADDR(W)] [0x30] [PIX0_L, PIX0_H, PIX1_L, PIX1_H, PIX2_L, PIX2_H]
Write: [ADDR(W)] [0x24] [0x43]       // LED = 3, REFRESH = 1

12.5 Restore Factory Configuration

Write: [ADDR(W)] [0x29] [0x3A]

13. Usage Notes

  • 1. Continuous reads and writes must remain within the blocks listed in Section 2.3. Do not cross a block boundary or treat 0x2A–0x2F or addresses 0x91 and above as valid registers.
  • 2. When modifying the 16-bit PWM frequency or other multi-byte fields, complete the update in one permitted continuous write transaction to avoid a brief intermediate configuration.
  • 3. All GPIO, Neopixel, and PWM outputs use open-drain mode by default. Configure them as push-pull when no external pull-up is available.
  • 4. When a GPIO is occupied by an ADC, PWM, I2C, SWD, or Neopixel alternate function, the normal GPIO direction and output configuration no longer apply.
  • 5. ADC, PWM, and I2C idle sleep disable the corresponding pin interrupts according to the manual. Do not determine the final interrupt state only from the read/write value of GPIO_IE_x.
  • 6. IO1 and IO6, IO2 and IO3, IO7 and IO12, IO8 and IO9, IO10 and IO14, and IO11 and IO13 are interrupt-multiplexed pairs; interrupts cannot be enabled simultaneously within a pair.
  • 7. INT_OUT, SDA, and SCL are open-drain signals and require external pull-up resistors. INT_OUT is released high only after GPIO_IS_x is cleared.
  • 8. The voltage on IO7 is used to select the I2C address only at power-on. Avoid voltage range boundaries and do not leave the pin floating.
  • 9. NRST is an active-low reset input. Writing 0x3A to RESET (0x29) restores the factory configuration; other write values must not be treated as valid reset commands.

14. Version History

Document version Date Update
V1.0 2026-10-21 Protocol written according to the M5IOE1 chip user manual V1.4
Page Tools
PDF