A121 Sparse IQ Service User Guide 5
A121 Sparse IQ Service User Guide 5
User Guide
A121 Sparse IQ Service
User Guide
Author: Acconeer AB
Version:a121-v1.6.0
Contents
2 Introduction 5
3 IQ Radar Data 5
4 API Usage 5
4.1 Initializing the System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.2 Setting up the Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.2.1 Register HAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.2.2 Create Config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.2.3 Create Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.2.4 Allocate Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.2.5 Create Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.2.6 Calibrate Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.2.7 Prepare Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.3 Data Retrieval and Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.3.1 Measure and Read Data from Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.3.2 Data Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.4 Shutdown and Memory De-allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.5 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.5.1 Number of Subsweeps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.5.2 Continuous Sweep Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.5.3 Idle States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.5.4 Double Buffering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5 Sensor Calibration 12
5.1 Sensor Re-calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.2 Sensor Calibration Caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6 Indication Handling 12
6.1 Data Saturated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.2 Frame Delayed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.3 Calibration Needed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.4 Temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
7 Examples 13
7.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
7.2 Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
7.3 Advanced Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
7.4 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
8 Communication Issues 14
10 Memory 19
10.1 Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
10.2 RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
11 A121 vs A111 19
13 Disclaimer 22
To better understand what SDK document to use, a summary of the documents are shown in the table below.
2 Introduction
The Sparse IQ Service is used to control the Acconeer A121 sensor and retrieve radar data from it. Below is an overview
image of how to use the Service API together with the HAL integration in an application.
3 IQ Radar Data
The Sparse IQ Service provides radar data in a complex format. In order to make sense of the data some kind of processing
usually needs to be done. Examples of processing can be found in the processing examples provided in the SDK. This
includes, among others, amplitude, mean, and interpolation processing.
To read more about how to interpret the IQ data, see docs.acconeer.com.
It is highly recommended to use the Acconeer Exploration Tool together with an Acconeer Evaluation Kit, EVK, to
explore how the IQ data looks like and how it can be used. For more information on the Acconeer EVKs, see
www.acconeer.com/products. For more information on Exploration Tool, see
github.com/acconeer/acconeer-python-exploration.
4 API Usage
The Service API can be divided into five SW modules. See image below.
RSS:
• Initialize the RSS library by registering integration functions
• Get memory size needed by RSS for a specific config
• Set log level
Config:
• Get and set Service configuration
• Print current configuration
Sensor:
• Communicate with the sensor, examples include
– Calibrate the sensor
– Configure the sensor
– Do a measurement
– Read raw data from sensor
Processing
• Convert unreadable raw data to Sparse IQ data
• Convert unreadable raw data to indications
HAL Integration:
• Retrieve integration functions needed by RSS library
• Direct pin communication with the sensor, such as
– Enable / disable sensor
– Wait for interrupt
if (! a c c _ r s s _ h a l _ r e g i s t e r ( hal ) )
{
/* Handle error */
}
/* Handle error */
}
/* Enable sensor */
a c c _ h a l _ i n t e g r a t i o n _ s e n s o r _ e n a b l e ( SENSOR_ID ) ;
/* Create Sensor */
acc_sensor_t * sensor = ac c_sens or_cre ate ( SENSOR_ID ) ;
if ( sensor == NULL )
{
/* Handle error */
}
do
{
status = a c c _ s e n s o r _ c a l i b r a t e ( sensor , & cal_complete , & cal_result , buffer
, buffer_size ) ;
if (! status )
{
/* Handle error */
}
if (! a c c _ h a l _ i n t e g r a t i o n _ w a i t _ f o r _ s e n s o r _ i n t e r r u p t ( SENSOR_ID ,
SEN SOR_TI MEOUT_ MS ) )
{
/* Handle error */
}
printf ( " % " PRIi16 " +% " PRIi16 " i \ n " , proc_result . frame [
index_in_frame ]. real , proc_result . frame [ index_in_frame ]. imag ) ;
}
}
The ‘proc meta’ above is retrieved from the function ‘acc processing create()’, described in the Create Processing
section.
As can be seen above, the IQ frame layout is in the order sweep and then distance. One could think of the layout as having
sweeps in the rows and distances in the columns. If more than one subsweep is used, the layout is in the order sweep,
subsweep, and distance. See below.
uint16_t sweeps_per_frame = a c c _ c o n f i g _ s w e e p s _ p e r _ f r a m e _ g e t ( config ) ;
uint8_t n um b e r_ o f _s u b sw e e ps = a c c _ c o n f i g _ n u m _ s u b s w e e p s _ g e t ( config ) ;
uint16_t sweep_length = proc_meta . swee p_data _lengt h ;
{
for ( uint8_t subsweep_index = 0; subsweep_index < n u mb e r _o f _ su b s we e p s ;
subsweep_index ++)
{
for ( uint16_t distance_index = 0; distance_index < proc_meta .
s u b s w e e p _ d a t a _ l e n g t h [ subsweep_index ]; distance_index ++)
{
uint16_t index_in_frame = sweep_index * sweep_length + proc_meta
. s u b s w e e p _ d a t a _ o f f s e t [ subsweep_index ] + distance_index ;
printf ( " % " PRIi16 " +% " PRIi16 " i \ n " , proc_result . frame [
index_in_frame ]. real , proc_result . frame [ index_in_frame ]. imag )
;
}
}
}
For more information on the indications that are received from a ‘processing result’, see section Indication
Handling.
if ( sensor != NULL )
{
ac c_ se ns or _d es tr oy ( sensor ) ;
}
if ( processing != NULL )
{
a c c _ p r o c e s s i n g _ d e s t r o y ( processing ) ;
}
if ( config != NULL )
{
ac c_ co nf ig _d es tr oy ( config ) ;
}
if ( buffer != NULL )
{
a c c _ i n t e g r a t i o n _ m e m _ f r e e ( buffer ) ;
}
4.5 Configuration
The sensor can be configured with multiple different settings to allow for optimized usage for a specific use case. Each
configuration can be set using a function on the format acc config [setting] set(). See the Sparse IQ Configuration
Parameters section for a condensed list of the configurations that can be set.
Some configurations apply to the whole service, such as ‘num subsweeps’ and ‘inter frame idle state’. Some
configurations apply to the radar data, such as ‘start point’ and ‘hwaas’.
For more information about configuration, see docs.acconeer.com.
For a complete description of all configurations, see rss api.html provided in the SDK package.
5 Sensor Calibration
The sensor needs to be calibrated before radar data can be retrieved. Without a successful calibration, the behavior of
the radar data is undefined. It can for example degrade the quality of the data or make the data completely useless. The
environment does not need to be known for the sensor calibration to work. This means that a (re)calibration can be done
at any time.
The sensor calibration is done in multiple steps. This means that during a calibration, multiple SPI transfers will be done.
An integration with a fast SPI will reduce the calibration time. As a reference, the calibration takes around 50 ms on the
XM125 module.
In each step, the calibration routine extracts data from the sensor and evaluates it. There are sanity checks of this sensor
data. A temporary external disturbance might affect the data which will trigger failures in the sanity checks. This should
only happen very rarely. If it happens, resetting the sensor (by setting enable low/high) and doing the calibration once
more should solve the issue. If the issue persists, there might be an issue with the sensor or integration.
The result of a calibration is stored as an uint32 t array in a result struct.
typedef struct
{
uint32_t data [ A C C _ C A L _ R E S U L T _ D A T A _ S I Z E / 4];
} acc_cal_result_t ;
This result is not portable between architectures. This means that the result must be used on the same platform as it was
produced.
6 Indication Handling
The result from a call to acc processing execute() includes both the radar data frame as well as indications. Below can be
seen how to fetch indications from the result.
a c c _ p r o c e s s i n g _ r e s u l t _ t proc_result ;
if ( proc_result . data_saturated )
{
// Handle data saturated indication
}
if ( proc_result . frame_delayed )
{
// Handle frame delayed indication
}
if ( proc_result . cal ib ra ti on _n ee de d )
{
// Handle calibration needed indication
}
Some of the indications are good-to-have metadata while some are crucial to handle for stable operation of the sensor.
The full list of indications and appropriate handling of them is described below.
Alternative solutions could be to enable the ‘double buffering’ mode or to reduce the radar data being read and processed.
This can be done by reconfiguring the sensor. The configurations impacting the size of the radar data the most are
• num points
• step length
• sweeps per frame
6.4 Temperature
Indication of the sensor temperature, in degree Celsius, for the current measurement.
Note that the absolute accuracy is poor and the temperature must only be used for relative comparisons.
The temperature indication can be used for different types of comparisons or compensations. As an example, the Distance
Detector uses temperature compensation, see ‘A121 Distance Detector User Guide’ for more information.
7 Examples
Multiple different examples are provided in the SDK. They are divided into four categories, see table below.
7.2 Processing
These examples show different ways to process the Sparse IQ Data. The name of each example correspond to the
processing demonstrated.
• example processing amplitude
• example processing coherent mean
• example processing noncoherent mean
• example processing peak interpolation
• example processing subtract adaptive bg
7.4 Troubleshooting
These examples can be used when issues arise.
example diagnostic test - Shows how to use the RSS diagnostic test to get sensor diagnostic information
8 Communication Issues
This is the simplest control flow which is easy to follow as nothing happens in parallel. All examples are using this kind
of control flow. An alternative control flow is to let the host do data processing at the same time as the sensor is doing a
measurement. See image below.
This control flow assumes that at least one measure and one wait for sensor interrupt has been done previously. Using the
parallel control flow increases the maximum possible update rate. It can also lower power consumption by handling the
data faster and thus letting the system go to sleep for a longer time.
The inter frame idle state of the frame must be deeper or the same as the inter sweep idle state.
The graphs below show the power usage in between frames/sweeps depending on the inter frame and inter sweep idle
states.
9.2.2 Sleep
Sleep is a compromise between power save and transition time.
9.2.3 Ready
Ready is the shallowest state where most of the sensor hardware is kept on, it is also the state that is the fastest to transition
from.
When using double buffering, measurements coinciding with SPI activity may have distorted phase. To mitigate this issue,
applying a median filter is recommended.
An example of how to do this median filtering can be found in acc algorithm.c provided in the Acconeer SW packages.
See example below of how to use it The function does not correct disturbances that may appear in the initial or final
sweeps.
/* *
* Brief example on how to use the double buffering median frame filter
*/
# define NUM_POINTS 60
# define SWEEPS_PER_FRAME 32
...
/* Create configuration */
config = acc _confi g_cre ate () ;
if ( config == NULL )
{
/* ERROR */
}
a c c _ c o n f i g _ n u m _ p o i n t s _ s e t ( config , NUM_POINTS ) ;
a c c _ c o n f i g _ s w e e p s _ p e r _ f r a m e _ s e t ( config , SWEEPS_PER_FRAME ) ;
...
if (! a c c _ h a l _ i n t e g r a t i o n _ w a i t _ f o r _ s e n s o r _ i n t e r r u p t ( SENSOR_ID ,
SEN SOR_TI MEOUT_ MS ) )
{
/* ERROR */
}
The graph below show the timing and power for a double buffering configuration.
10 Memory
10.1 Flash
The example application compiled from example service.c on the XM125 module requires around 70 kB.
10.2 RAM
The RAM can be divided into three categories, static RAM, heap, and stack. Below is a table for approximate RAM for
an application compiled from example service.c.
Note that heap is very dependent on the configuration. But the numbers in the table above is a pretty good estimate for
many configurations.
The configurations that have the largest impact on memory are ‘sweeps per frame’, ‘num points’, and
‘step length’.
11 A121 vs A111
The Service APIs for A121 and A111 are quite similar. They are both designed to control the sensor and retrieve data
from it.
The main updates to control for A121 compared to A111 are:
• The pin handling, like ENABLE, is completely handled by the application
• The majority of the memory is allocated in the application allowing for memory reuse between Services
• The Service handle is divided into a Sensor handle and a Processing handle
• The Sensor handle can be used to separately do a calibration
• The Sensor handle can be used to (re)configure the sensor faster using a ‘prepare’ function
• The get next function is replaced by a function sequence of ‘measure’ -> ‘wait for interrupt’ -> ‘read’ -> ‘process’
The main updates to radar data for A121 compared to A111 are:
• There is only one Service, the Sparse IQ Service, providing complex IQ data
• The radar data can be divided into subsweeps
13 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.