XM125 I2C Presence Detector User Guide 2
XM125 I2C Presence Detector User Guide 2
User Guide
XM125 I2 C Presence Detector
User Guide
Author: Acconeer AB
Version:a121-v1.6.0
Contents
3 Register Protocol 7
3.1 I2 C Slave Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Protocol Byte Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2.1 I2 C Write Register(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2.2 I2 C Read Register(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3 Register Protocol - Low Power Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3.1 I2 C Communication with Low Power Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4 File Structure 10
6 Registers 15
6.1 Register Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.2 Register Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.2.1 Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.2.2 Protocol Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.2.3 Measure Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.2.4 Detector Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.2.5 Presence Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.2.6 Presence Distance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.2.7 Intra Presence Score . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.2.8 Inter Presence Score . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.2.9 Presence Actual Frame Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.2.10 Sweeps Per Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.2.11 Inter Frame Presence Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.2.12 Inter Phase Boost Enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.2.13 Intra Detection Enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.2.14 Inter Detection Enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.2.15 Frame Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.2.16 Intra Detection Threshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.2.17 Inter Detection Threshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.2.18 Inter Frame Deviation Time Const . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.2.19 Inter Frame Fast Cutoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.2.20 Inter Frame Slow Cutoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.2.21 Intra Frame Time Const . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.2.22 Intra Output Time Const . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.2.23 Inter Output Time Const . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.2.24 Auto Profile Enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.2.25 Auto Step Length Enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.2.26 Manual Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.2.27 Manual Step Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.2.28 Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.2.29 End . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.2.30 Reset Filters On Prepare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.2.31 Hwaas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.2.32 Automatic Subsweeps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.2.33 Signal Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.2.34 Detection On Gpio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.2.35 Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.2.36 Application Id . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7 Disclaimer 24
To better understand what SDK document to use, a summary of the documents are shown in the table below.
The I2 C Presence Detector is an application that implements the Acconeer Presence Detector with a register based I2 C
interface.
The functionality of the presence detector is described in A121 Presence Detector User Guide.pdf or in Acconeer
Docs.
Note: Some of the registers like start and end have a different unit in the I2 C Presence Detector, millimeters instead of
meters, to make it easier to handle the register values as integers.
2.2 Usage
The module must be ready before the host starts I2 C communication.
The module will enter ready state by following this procedure.
• Set WAKE UP pin of the module HIGH.
• Wait for module to be ready, this is indicated by the MCU INT pin being HIGH.
• Start I2 C communication.
The module will enter a low power state by following this procedure.
• Wait for module to be ready, this is indicated by the MCU INT pin being HIGH.
• Set the WAKE UP pin of the module LOW.
• Wait for ready signal, the MCU INT pin, to become LOW.
• Verify that no Error bits are set in the Detector Status register.
• Write START DETECTOR to Command register.
• Poll Detector Status until Busy bit is cleared.
• Verify that no Error bits are set in the Detector Status register.
• Read Detector Result register
– If PRESENCE DETECTED is set presence is currently detected.
– If PRESENCE DETECTED STICKY is set presence has been detected since last read.
– If DETECTOR ERROR is set an error has occurred, restart module with the RESET MODULE command.
– If presence was detected, the presence distance can be read in the Presence Distance register.
3 Register Protocol
Example Waveform: Write register with address 0x0100, the data sent from the master to the slave is 0x00000001
Example 2: Writing two bytes and reading 16 bytes will read four registers.
Example operation, read 0x12345678 from address 0x0003.
Description Data
I2 C Start Condition
Slave Address + Write 0x52 + W
Address to slave [15:8] 0x00
Address to slave [7:0] 0x03
I2 C Stop Condition
I2 C Start Condition
Slave Address + Read 0x52 + R
Data from slave [31:24] 0x12
Data from slave [23:16] 0x34
Data from slave [15:8] 0x56
Data from slave [7:0] 0x78
I2 C Stop Condition
Example Waveform: Read register with address 0, the data sent from the slave to the master is 0x00010001
Low Power Example: Magnification of Wake up, Setup Presence Detector, Power down
4 File Structure
Src
applications
i2c
acc reg protocol.c
presence reg protocol access.c
presence reg protocol.c
i2c application system stm32.c
i2c presence detector.c
Inc
acc reg protocol.h
presence reg protocol.h
i2c application system.h
i2c presence detector.h
• acc reg protocol.c A generic protocol handler implementation.
• presence reg protocol.c The specific register protocol setup for the I2 C Presence Detector.
• presence reg protocol access.c The register read and write access functions for the I2 C Presence Detector.
• i2c application system stm32.c System functions, such as I2 C handling, GPIO control and low power state
• i2c presence detector.c The I2 C Presence Detector application.
This is an example implementation of the host read and write register functions using the STM32 SDK.
/* *
* @brief Read register value over I2C
*
* @param [ in ] reg_addr The register address to read
* @param [ out ] reg_data The read register data
* @returns true if successful
*/
bool read_register ( uint16_t reg_addr , uint32_t * reg_data )
{
return true ;
}
/* *
* @brief Write register value over I2C
*
* @param [ in ] reg_addr The register address to write
* @param [ in ] reg_data The register data to write
* @returns true if successful
*/
bool write_register ( uint16_t reg_addr , uint32_t reg_data )
{
HAL_ Status TypeDe f status = HAL_OK ;
return true ;
}
/* *
* @brief Test if configuration of detector is OK
*
* @returns true if successful
*/
bool configuration_ok ( void )
{
uint32_t status = 0
if (! read_register ( PRE SE NC E_ RE G_ DE TE CT OR _ST AT US _A DD RE SS , & status ) )
{
// ERROR
return false ;
}
uint32_t config_ok_mask =
PRESENCE_REG_DETECTOR_STATUS_FIELD_RSS_REGISTER_OK_MASK |
PRESENCE_REG_DETECTOR_STATUS_FIELD_CONFIG_CREATE_OK_MASK |
PRESENCE_REG_DETECTOR_STATUS_FIELD_SENSOR_CREATE_OK_MASK |
PRESENCE_REG_DETECTOR_STATUS_FIELD_SENSOR_CALIBRATE_OK_MASK |
PRESENCE_REG_DETECTOR_STATUS_FIELD_DETECTOR_CREATE_OK_MASK |
PRESENCE_REG_DETECTOR_STATUS_FIELD_DETECTOR_BUFFER_OK_MASK |
PRESENCE_REG_DETECTOR_STATUS_FIELD_SENSOR_BUFFER_OK_MASK |
PRESENCE_REG_DETECTOR_STATUS_FIELD_CONFIG_APPLY_OK_MASK ;
if ( status != config_ok_mask )
{
// ERROR
return false ;
}
return true ;
}
/* *
* @brief Wait for detector not busy
*
* @returns true if successful
*/
bool wait_not_busy ( void )
{
uint32_t status = 0
do
{
if (! read_register ( PRE SE NC E_ RE G_ DE TE CT OR_ ST AT US _A DD RE SS , & status ) )
{
// ERROR
return false ;
}
} while (( status & P R E S E N C E _ R E G _ D E T E C T O R _ S T A T U S _ F I E L D _ B U S Y _ M A S K ) != 0) ;
return true ;
}
bool e x a m p l e _ s e t u p _ a n d _ s t a r t ( void )
{
// Set start at 1000 mm
if (! write_register ( PRESENCE_REG_START_ADDRESS , 1000) )
{
// ERROR
return false ;
}
// Set end at 5000 mm
if (! write_register ( PRESENCE_REG_END_ADDRESS , 5000) )
{
// ERROR
return false ;
}
// Apply configuration
if (! write_register (
PRESENCE_REG_COMMAND_ADDRESS ,
PRESENCE_REG_COMMAND_ENUM_APPLY_CONFIGURATION ))
{
// ERROR
return false ;
}
// Start detector
if (! write_register ( PRESENCE_REG_COMMAND_ADDRESS ,
PRESENCE_REG_COMMAND_ENUM_START_DETECTOR ))
{
// ERROR
return false ;
}
// ERROR
return false ;
}
return true ;
}
6 Registers
Address 0x0000
Access Read Only
Register Type field
Description Get the RSS version.
Address 0x0001
Access Read Only
Register Type field
Description Get protocol error flags.
Address 0x0002
Access Read Only
Register Type uint
Description Get the measure counter, the number of measurements performed since restart.
Address 0x0003
Access Read Only
Register Type field
Description Get detector status flags.
Address 0x0010
Access Read Only
Register Type field
Description The result from the presence detector.
Address 0x0011
Access Read Only
Address 0x0012
Access Read Only
Register Type uint
Description A measure of the amount of fast motion detected.
Address 0x0013
Access Read Only
Register Type uint
Description A measure of the amount of slow motion detected.
Address 0x0020
Access Read Only
Register Type uint
Unit mHz
Description The actual frame rate of the presence detector.
Address 0x0040
Access Read / Write
Register Type uint
Description The number of sweeps that will be captured in each frame (measurement).
Default Value 16
Address 0x0041
Access Read / Write
Register Type uint
Description Number of seconds the inter-frame presence score needs to decrease before
exponential scaling starts for faster decline. Should be between 0 and 30 where 0
means no timeout. Note:
Default Value 3
Address 0x0042
Access Read / Write
Register Type bool
Description Enable to increase detection of slow motions by utilizing the phase information in the
Sparse IQ data.
Default Value False
Address 0x0043
Access Read / Write
Register Type bool
Description Enable to detect faster movements inside frames.
Default Value True
Address 0x0044
Access Read / Write
Register Type bool
Description Enable to detect slower movements between frames.
Default Value True
Address 0x0045
Access Read / Write
Register Type uint
Unit mHz
Description The presence detector frame rate. Note: This value is a factor 1000 larger than the
RSS value.
Default Value 12000
Address 0x0046
Access Read / Write
Register Type uint
Description The threshold for detecting faster movements inside frames. Note: This value is a
factor 1000 larger than the RSS value.
Default Value 1300
Address 0x0047
Access Read / Write
Register Type uint
Description This is the threshold for detecting slower movements between frames. Note: This
value is a factor 1000 larger than the RSS value.
Default Value 1000
Address 0x0048
Access Read / Write
Register Type uint
Unit ms
Description The time constant of the low pass filter for the inter-frame deviation between fast and
slow. Note: This value is a factor 1000 larger than the RSS value.
Default Value 500
Address 0x0049
Access Read / Write
Register Type uint
Unit mHz
Description The cutoff frequency of the low pass filter for the fast filtered absolute sweep mean.
Note: This value is a factor 1000 larger than the RSS value.
Default Value 6000
Address 0x004a
Access Read / Write
Register Type uint
Unit mHz
Description The cutoff frequency of the low pass filter for the slow filtered absolute sweep mean.
Note: This value is a factor 1000 larger than the RSS value.
Default Value 200
Address 0x004b
Access Read / Write
Register Type uint
Unit ms
Description The time constant for the depthwise filtering in the intra-frame part. Note: This value
is a factor 1000 larger than the RSS value.
Default Value 150
Address 0x004c
Access Read / Write
Register Type uint
Unit ms
Description The time constant for the output in the intra-frame part. Note: This value is a factor
1000 larger than the RSS value.
Default Value 300
Address 0x004d
Access Read / Write
Register Type uint
Unit ms
Description The time constant for the output in the inter-frame part. Note: This value is a factor
1000 larger than the RSS value.
Default Value 2000
Address 0x004e
Access Read / Write
Register Type bool
Address 0x004f
Access Read / Write
Register Type bool
Description Enable/Disable automatic selection of step length based on the profile.
Default Value True
Address 0x0050
Access Read / Write
Register Type enum
Description The profile to use. The profile will only be used if profile auto selection was disabled.
Default Value PROFILE4
Enum Value
PROFILE1 1
PROFILE2 2
PROFILE3 3
PROFILE4 4
PROFILE5 5
PROFILE1 - Profile 1
PROFILE2 - Profile 2
PROFILE3 - Profile 3
PROFILE4 - Profile 4
PROFILE5 - Profile 5
Address 0x0051
Access Read / Write
Register Type uint
Description The number of steps between each data point. The manual step length will only be
used if step length auto selection was disabled.
Default Value 72
6.2.28 Start
Address 0x0052
Access Read / Write
Register Type uint
Unit mm
Description The start point of measurement interval in millimeters. Note: This value is a factor
1000 larger than the RSS value.
Default Value 300
6.2.29 End
Address 0x0053
Access Read / Write
Register Type uint
Unit mm
Description The end point of measurement interval in millimeters. Note: This value is a factor
1000 larger than the RSS value.
Default Value 2500
Address 0x0054
Access Read / Write
Register Type bool
Description Enable/Disable reset of the presence filters during start/restart.
Default Value True
6.2.31 Hwaas
Address 0x0055
Access Read / Write
Register Type uint
Description The hardware accelerated average samples (HWAAS).
Default Value 32
Address 0x0056
Access Read / Write
Register Type bool
Description Enable/Disable use of subsweeps.
Default Value True
Address 0x0057
Access Read / Write
Register Type uint
Description Signal quality.
Default Value 15000
Address 0x0080
Access Read / Write
Register Type bool
Description Output presence detection on generic gpio
Default Value False
6.2.35 Command
Address 0x0100
Access Write Only
Enum Value
APPLY CONFIGURATION 1
START DETECTOR 2
STOP DETECTOR 3
ENABLE UART LOGS 32
DISABLE UART LOGS 33
LOG CONFIGURATION 34
RESET MODULE 1381192737
6.2.36 Application Id
Address 0xffff
Access Read Only
Register Type enum
Description The application id register.
Enum Value
DISTANCE DETECTOR 1
PRESENCE DETECTOR 2
REF APP BREATHING 3
7 Disclaimer
The information herein is believed to be correct as of the date issued. Acconeer AB (“Acconeer”) will not be responsible
for damages of any nature resulting from the use or reliance upon the information contained herein. Acconeer makes no
warranties, expressed or implied, of merchantability or fitness for a particular purpose or course of performance or usage
of trade. Therefore, it is the user’s responsibility to thoroughly test the product in their particular application to
determine its performance, efficacy and safety. Users should obtain the latest relevant information before placing orders.
Unless Acconeer has explicitly designated an individual Acconeer product as meeting the requirement of a particular
industry standard, Acconeer is not responsible for any failure to meet such industry standard requirements.
Unless explicitly stated herein this document Acconeer has not performed any regulatory conformity test. It is the user’s
responsibility to assure that necessary regulatory conditions are met and approvals have been obtained when using the
product. Regardless of whether the product has passed any conformity test, this document does not constitute any
regulatory approval of the user’s product or application using Acconeer’s product.
Nothing contained herein is to be considered as permission or a recommendation to infringe any patent or any other
intellectual property right. No license, express or implied, to any intellectual property right is granted by Acconeer
herein.
Acconeer reserves the right to at any time correct, change, amend, enhance, modify, and improve this document and/or
Acconeer products without notice.
This document supersedes and replaces all information supplied prior to the publication hereof.