2023-08-11 04:00 AM - edited 2023-08-17 05:08 AM
Hardware requirements:
The STEVAL-MKI109V3 professional evaluation board for MEMS sensors, referenced as ProfiMEMS in STMicroelectronics documentation. It is based on the STM32F401 microcontroller and features a DIL24 socket to plug in the daughterboard with the sensor under test to the motherboard. Check that the firmware is up to date (version 3.11.4 or later).
Software requirements:
We use three-state machines.
State machine 1 is used to configure the ASC when the MLC outputs the STILL state.
State machine 2 is used to configure the ASC when the MLC outputs the SHAKING state.
State machine 3 is used to configure the ASC when the MLC outputs the FASTMOVING state.
State machine 1 configuration:
S0 instruction is an RNC: NOP | CHKDT, configure the decision tree value to 0, used to check the MLC output value, if equal to 0, go to the next state.
S1 instruction is a CMD: SETR, used to enable the ASC feature.
S2 instruction is the device register address: 0x11, used to set the IMU CTRL2 register.
S3 instruction is Value:0x00, used to set the CTRL2 register value to 0x00, set the gyroscope to power-down.
S4 instruction is CMD: SETR, used to enable the ASC feature.
S5 instruction is the device register address: 0x10, used to set the IMU CTRL1 register.
S6 instruction is Value:0x44, used to set the CTRL1 register value to 0x44, set the accelerometer to low-power mode 1 and ODR to 30Hz.
S7 instruction is a CMD: SETR, used to enable the ASC feature.
S8 instruction is the device register address: 0x17, used to set the IMU CTRL8 register.
S9 instruction is Value:0x00, used to set the CTRL8 register value to 0x00, set the accelerometer FS to 2g.
S10 instruction is a CMD: CONTREL, used to reset the program.
State machine 2 configuration:
S0 instruction is an RNC: NOP | CHKDT, configure the decision tree value 4, used to check the MLC output value, if equal to 4, go to the next state.
S1 instruction is a CMD: SETR, used to enable the ASC feature.
S2 instruction is the device register address: 0x11, used to set the IMU CTRL2 register.
S3 instruction is Value:0x06, used to set the CTRL2 register value to 0x06, set the gyroscope to high-performance mode and ODR to 120Hz.
S4 instruction is CMD: SETR, used to enable the ASC feature.
S5 instruction is the device register address: 0x15, used to set the IMU CTRL6 register.
S6 instruction is Value:0x00, used to set the CTRL6 register value to 0x00, set the gyroscope FS to 125dps.
S7 instruction is CMD: SETR, used to enable the ASC feature.
S8 instruction is the device register address: 0x10, used to set the IMU CTRL1 register.
S9 instruction is Value:0x06, used to set the CTRL1 register value to 0x06, set the accelerometer to high-performance mode and ODR to 120Hz.
S10 instruction is CMD: SETR, used to enable the ASC feature.
S11 instruction is the device register address: 0x17, used to set the IMU CTRL8 register.
S12 instruction is Value:0x01, used to set the CTRL8 register value to 0x01, set the accelerometer FS to 4g.
S13 instruction is a CMD: CONTREL, used to reset the program.
S14 instruction is a CMD: STOP, the end of the program.
State machine 3 configuration:
S0 instruction is an RNC: NOP | CHKDT, configure the decision tree value 8, used to check the MLC output value, if equal to 8, go to the next state.
S1 instruction is a CMD: SETR, used to enable the ASC feature.
S2 instruction is the device register address: 0x11, used to set the IMU CTRL2 register.
S3 instruction is Value:0x06, used to set the CTRL2 register value to 0x08, set the gyroscope to high-performance mode and ODR to 480Hz.
S4 instruction is a CMD: SETR, used to enable the ASC feature.
S5 instruction is the device register address: 0x15, used to set the IMU CTRL6 register.
S6 instruction is Value:0x0C, used to set the CTRL6 register value to 0x0C, set the gyroscope FS to 4000dps.
S7 instruction is a CMD: SETR, used to enable the ASC feature.
S8 instruction is the device register address: 0x10, used to set the IMU CTRL1 register.
S9 instruction is Value:0x08, used to set the CTRL1 register value to 0x08, set the accelerometer to high-performance mode and ODR to 480Hz.
S10 instruction is a CMD: SETR, used to enable the ASC feature.
S11 instruction is the device register address: 0x17, used to set the IMU CTRL8 register.
S12 instruction is Value:0x02, used to set three CTRL8 register value to 0x02, set the accelerometer FS to 8g.
S13 instruction is a CMD: CONTREL, used to reset the program.
S14 instruction is a CMD: STOP, the end of the program.
In the end, we successfully configured three state machines. Click on the save device configuration button. Save it to the PC (for example save it as the filename fsm.ucf).
Configuration parameters of the MLC
MLC ODR: 120Hz
Window length: 52 samples
Filters: No
Selected features:
MEAN_on V and V2
Meta classifier: No
Finally, the user is prompted to select the target UCF files and, by clicking next, it is automatically generated by Unico-GUI. Save it to the PC (for example, use the filename mlc.ucf).
Select the advanced MLC+FSM button.
Load the MLC ucf file (for example, mlc.ucf)
Load the FSM ucf file (for example, fsm.ucf)
Click on the merge MLC + FSM configurations button and save it to the PC (for example, asc.ucf)
Select the load button to load the asc.ucf files to the evaluation board.
Enables the FSM to access the CTRL registers. Configure FUNC_CFG_ACCESS (01h) to 0x08.
Data when the board is in STILL status, MLC output 0 and the ASC configures the IMU at XL ODR=30Hz,FS_XL=2g,gyroscope off, low-power mode:
Data when the board is in SHAKING status, MLC output 4, and the ASC configures the IMU at XL ODR=120Hz,FS_XL=4g, gyroscope ODR=120Hz,FS_Gyro=125dps, high-performance mode:
Data when the board is in FASTMOVING status, MLC output 8, and the ASC configures the IMU at XL ODR=480Hz,FS_XL=8g,Gyro ODR=480Hz,FS_Gyro=4000dps, high-performance Mode.
The result shows that when the device is in a STILL state, the current is 19.46 µA.
When the device is in a FASTMOVING state, the current is 689.70 µA.
This article described how to implement the ASC function using the MLC and FSM on the STEVAL-MKI109V3 professional evaluation board and STEVAL-MKI227KA daughterboard with the LSM6DSV16X IMU sensor.
To develop the ASC demo, we used Unico-GUI, which is a free-to-use tool downloadable from st.com. Thanks to the powerful functions of Unico-GUI, the configuration of the MLC and FSM has become easier. Users can easily develop their own ASC demo according to actual scenarios, achieving excellent power management and greatly reducing system power consumption.