5/25/2012

How to measure the DSPS sensor reset time in MSM8960

when you need to get the reset time of DSPS sensor as follows. (add 1, 2,3)

dsps_proc/core/sensors/smgr/src/common/sns_smgr_sol.c

void sns_smgr_reset_sensor(smgr_sensor_s *sensor_ptr)
{
  sns_ddf_status_e  reset_status=SNS_DDF_EDEVICE;
  sns_ddf_powerstate_e    set_data;

<add 1 - start>
  uint32_t start_ts; 
<add 1 - end>
  sns_hw_set_qup_clk(true);

  set_data = SNS_DDF_POWERSTATE_ACTIVE;
  sensor_ptr->driver_status = sns_smgr_set_attr( sensor_ptr->drv_fn_ptr,
                                      sensor_ptr->dd_handle_ptr,
                                      SNS_DDF_SENSOR__ALL,
                                      SNS_DDF_ATTRIB_POWER_STATE,
                                      &set_data );
  SNS_PRINTF_STRING_ID_HIGH_3(SNS_DBG_MOD_DSPS_SMGR,
                                      DBG_SMGR_GENERIC_STRING3,
                                      SNS_DDF_POWERSTATE_ACTIVE,
                                      sensor_ptr->const_ptr->sensor_id, sensor_ptr->driver_status);

 /* Increased delay between set active power and sensor reset for MPU3050 configuring interrupt
                   during reset, MPU3050 starts working at 600us ( not at500us ), MPU6050 needs 200us */
   SMGR_DELAY_US(800);
<add 2 - start>   3000, 3001 - Red numbers is  just to make it easy to find using  value
   SNS_PRINTF_STRING_ID_HIGH_3(SNS_DBG_MOD_DSPS_SMGR,
                                      DBG_SMGR_GENERIC_STRING3,
                                      3000, sensor_ptr->sensor_id, sns_em_get_timestamp() );

  start_ts = sns_em_get_timestamp();
<add 2 - end>
  reset_status= sensor_ptr->drv_fn_ptr->reset(sensor_ptr->dd_handle_ptr);

<add 3 - start>
  SNS_PRINTF_STRING_ID_HIGH_3(SNS_DBG_MOD_DSPS_SMGR,
                                      DBG_SMGR_GENERIC_STRING3,
                                      3001, start_ts, sns_em_get_timestamp());
<add 3 - end>

<snip>
...
}

then rebuild dsps image and load to device.

and follow these steps

1. connect QXDM and getting the QXDM log.
2. start QSensorTest App.
3. executes the sensor of desired time measurement
4. stop 
5. repeat step 3 and step 4 several times
6. search 3000, 3001 in the log then you can find time tick value
7. Calculation : (before reset tick - after reset tick) * 30.51

ps) DSPS one tick is 30.51us

ex) before tick           after reset tick    time tick     Time (us)
     15185300            15185860             560          17085.60
     15405717            15406275             558          17024.58
     15405717            15406275             558          17024.58
 

No comments:

Post a Comment