For the complete documentation index, see llms.txt. This page is also available as Markdown.

SolidSense AIOT - MCU

Software Flashing and Usage

MCU Firmware Flashing

Flashing equipment

Part Name
Qty.
Picture

USB-C Cable

1

STLINK-V3

1

Micro USB-B Cable

1

ST-LINK V3 SWD/JTAG programming cable (10/20-pin adapter set)

1

The flashing process requires a local computer with the following software installed:

STM32CubeProgrammer:

Preparing the AIOT for flashing

Connect STLINK-V3 (CN5) to the computer via micro USB. Connect the AIOT (J5006) to the STLINK (STDC14) using the ST-LINK V3 SWD/JTAG programming cable. Ensure that the cable is connected to the AIOT in the correct orientation, as shown in the image.

Connect the AIOT to the computer using a USB cable.

Turn ON the AIOT using the designated switch.

Flashing the software

Open STM32CubeProgrammer:

Select Erasing & Programming from the left menu. (1)

Find the appropriate Port and connect. (2)

Load the appropriate HEX file. (3)

Verify the selections according to the image. (4)

Click Start Programming. (5)

After the successful completion message is displayed, you can proceed to the testing process.

Device Usage Guide

Overview

This project implements an I2C slave interface on the STM32U031C8 MCU to control and read multiple sensors. The MCU acts as a slave device, receiving commands from a master over I2C and performing actions such as turning sensors on/off, reading sensor data, and configuring thresholds.

Supported sensors and modules

LED

Infrared (IR) sensor

Accelerometer

GPS

Battery charger status

Real-time clock (RTC)

Interrupts (MCU, IR, ACC)

Command Definitions:

Core/Inc/protocol.h

Command & Response Format:

Command structure: | CMD (1B) | SENSOR_ID (1B) | DATA_LEN (1B) | DATA (N Bytes) |

Response structure: | STATUS (1B) | DATA_LEN (1B) | DATA (N Bytes) |

examples:

busAdd=1

devAddr=0x18

Command Description
Command
Expected Response
example

Turn ON LED

{ 0x10, 0x01, 0x00, {} }

{ 0x00, 0x00, {} }

i2ctransfer -y $busAdd "w3@$devAddr" 0x10 0x01 0x00 r2@$devAddr

Turn OFF LED

{ 0x11, 0x01, 0x00, {}}

{ 0x00, 0x00, {} }

i2ctransfer -y $busAdd "w3@$devAddr" 0x11 0x01 0x00 r2@$devAddr

Read IR data

{ 0x12, 0x02, 0x00 ,{} }

{ 0x00, 5, {INT, int16 presenceVal, int16 motionVal} }

i2ctransfer -y $busAdd "w3@$devAddr" 0x12 0x02 0x00 r7@$devAddr

Set IR threshold

{ 0x13, 0x02, 0x01, {THS} }

{ 0x00, 0x00, {}}

i2ctransfer -y $busAdd "w4@$devAddr" 0x13 0x02 0x01 THS r2@$devAddr

Read acceleration

{ 0x12, 0x03, 0x00, {} }

{ 0x00, 1, {INT} }

i2ctransfer -y $busAdd "w3@$devAddr" 0x12 0x03 0x00 r3@$devAddr

Set ACC threshold

{ 0x13, 0x03, 0x01, {THS} }

{ 0x00, 0x00, {} }

i2ctransfer -y $busAdd "w4@$devAddr" 0x13 0x03 0x01 THS r2@$devAddr

Read battery status

{ 0x12, 0x05, 0x00 ,{} }

{ 0x00, 3, {power_source, battery_soc, charge_status} }

i2ctransfer -y $busAdd "w3@$devAddr" 0x12 0x05 0x00 r5@$devAddr

Read current time

{ 0x12, 0x06, 0x00 ,{} }

{ 0x00, 6, {YY,MM,DD,HH,MM,SS} }

i2ctransfer -y $busAdd "w3@$devAddr" 0x12 0x06 0x00 r8@$devAddr

Synchronize RTC with GPS

{ 0x13, 0x06, 0x00, {} }

{ 0x00, 0x00, {} }

i2ctransfer -y $busAdd "w3@$devAddr" 0x13 0x06 0x00 r2@$devAddr

Read MCU/IR/ACC interrupts

{ 0x12, 0x07, 0x00, {} }

{ 0x00, 3, {MCU, IR, ACC} }

i2ctransfer -y $busAdd "w3@$devAddr" 0x12 0x07 0x00 r5@$devAddr

Sensor Thresholds & Configuration:

Accelerometer

Interrupt code:

Code
Meaning

0x00

No motion detected

0x01

Motion detected

Default threshold: ACC_THS_DEFAULT = 0x04

Trigger values: 0–63 (1 LSB = fraction of ±2g full scale)

Threshold (mg) = FS(g) × (threshold / 64) × 1000

Threshold
FS(g) = ±2g (mg)

1

31 mg

2

62 mg

4

125 mg

8

250 mg

16

500 mg

32

1 g

63

1.97 g

Recommended values:

1–3: Very sensitive (tiny motion)

4–8: Medium motion (walking, light shake)

10–20: Strong motion (hit, fall)

Infrared Sensor (IR)

Interrupt code:

Code
Meaning

0x00

No motion detected

0x02

Motion detected

0x04

Presence detected

Frequency [Hz]= 1Hz = 1000ms Hysteresis Default (HYST = 32)

Detection:

Compares two internally filtered signals

Event flag set if difference > threshold

Flag cleared when signal < (threshold − hysteresis)

Threshold
Hysteresis
Approx. Signal Change
Use Case

100

32

≥0.05°C

Very sensitive, long range

150

32

≥0.075°C

Sensitive, moderate range

200

32

≥0.1°C

Balanced sensitivity/stability

250

32

≥0.125°C

Less sensitive, shorter range

300

32

≥0.15°C

Low sensitivity, short range

400

32

≥0.2°C

Minimal sensitivity, very stable

Battery Charging

Power Source Code
Meaning

000b

Not powered from VBUS

100b

Unknown adapter

111b

Boost OTG

Charge Status Code
Meaning

000

Not charging

001

Trickle charge

010

Pre-charge

011

Fast charge (CC mode)

100

Taper charge (CV mode)

110

Top-off timer active charging

111

Charge termination done

Last updated