Showing results for 
Search instead for 
Did you mean: 

H3LIS331DL Spurious Pulses On INT2 After Sleep To Wake

Associate II

We have a project using the H3LIS331DL in a remote control to determine whether it has been dropped. One of the versions uses both INT1 and INT2 connections. The INT2 connection is used to turn a power supply on, which wakes up the micro (if it's not already awake because of the direct INT1 connection).

I've chosen to use the ST driver code.

Both INTs are configured identically.

The problem is that when I put the unit in low-power mode and set the accelerometer into Wake-To-Sleep mode, the accelerometer will wait for a period and then start putting out pulses of about 60 microseconds, spaced about 750 microseconds apart.

There's quite a bit of variation (about 0.4G) in the reported values on each axis while it's sitting on my desk, but I only really care about peaks.

Here's my initialisation code (note that bIntThreshold is set to the equivalent of 10G, and seems to work correctly:

// Make sure the accelerometer is awake
   h3lis331dl_wkup_to_sleep_set(&nACC_Handlers, 0);
   /* Set Output Data Rate */
   h3lis331dl_data_rate_set(&nACC_Handlers, H3LIS331DL_ODR_400Hz);
   // Re-load the calibration parameters
   h3lis331dl_boot_set(&nACC_Handlers, 1);
   h3lis331dl_boot_set(&nACC_Handlers, 0);
   /* Enable Block Data Update */
   h3lis331dl_block_data_update_set(&nACC_Handlers, PROPERTY_ENABLE);
   /* Set full scale */
   h3lis331dl_full_scale_set(&nACC_Handlers, H3LIS331DL_100g);
   /* Configure filtering chain */
   h3lis331dl_hp_path_set(&nACC_Handlers, H3LIS331DL_HP_DISABLE);
   /* Turn on the axes */
   h3lis331dl_axis_x_data_set(&nACC_Handlers, PROPERTY_ENABLE);
   h3lis331dl_axis_y_data_set(&nACC_Handlers, PROPERTY_ENABLE);
   h3lis331dl_axis_z_data_set(&nACC_Handlers, PROPERTY_ENABLE);
   /* Set the thresholds to defaults */
   h3lis331dl_int1_dur_set(&nACC_Handlers, 6);                                // Number of samples for which threshold has to be exceeded
   h3lis331dl_int2_dur_set(&nACC_Handlers, 6);                                // Number of samples for which threshold has to be exceeded
   h3lis331dl_int1_treshold_set(&nACC_Handlers, nACC_bIntThreshold);
   h3lis331dl_int2_treshold_set(&nACC_Handlers, nACC_bIntThreshold);
   /* Set up the interrupt configuration */
   h3lis331dl_pin_int1_route_set(&nACC_Handlers, H3LIS331DL_PAD1_INT1_SRC);   // The pads only respond to their own specific interrupts
   h3lis331dl_pin_int2_route_set(&nACC_Handlers, H3LIS331DL_PAD2_INT2_SRC);
   h3lis331dl_int1_notification_set(&nACC_Handlers, H3LIS331DL_INT1_LATCHED); // We want to make sure we see the output
   h3lis331dl_int2_notification_set(&nACC_Handlers, H3LIS331DL_INT2_LATCHED);
   h3lis331dl_pin_mode_set(&nACC_Handlers, H3LIS331DL_PUSH_PULL);             // Push-pull because there are no pull-ups
   h3lis331dl_pin_polarity_set(&nACC_Handlers, H3LIS331DL_ACTIVE_HIGH);       // Active-high
   static const h3lis331dl_int1_on_th_conf_t  tIntOnThreshold1Conf =          // Wake on any axis exceeding the configured threshold
      .int1_xlie = 0,
      .int1_xhie = 1,
      .int1_ylie = 0,
      .int1_yhie = 1,
      .int1_zlie = 0,
      .int1_zhie = 1
   h3lis331dl_int1_on_threshold_conf_set(&nACC_Handlers, tIntOnThreshold1Conf);
   static const h3lis331dl_int2_on_th_conf_t  tIntOnThreshold2Conf =
      .int2_xlie = 0,
      .int2_xhie = 1,
      .int2_ylie = 0,
      .int2_yhie = 1,
      .int2_zlie = 0,
      .int2_zhie = 1
   h3lis331dl_int2_on_threshold_conf_set(&nACC_Handlers, tIntOnThreshold2Conf);
   h3lis331dl_int1_on_threshold_mode_set(&nACC_Handlers, H3LIS331DL_INT1_ON_THRESHOLD_OR);
   h3lis331dl_int2_on_threshold_mode_set(&nACC_Handlers, H3LIS331DL_INT2_ON_THRESHOLD_OR);

And here's my shutdown code

void ACC_vLowPower(void)
   h3lis331dl_wkup_to_sleep_set(&nACC_Handlers, 3);   // Binary 11 in this value puts the accelerometer into "sleep-to-wake" mode
}  // ACC_vLowPower

What am I doing wrong?

And where is it documented? The existing data sheet is rather sparse for detail.

Associate II

It turns out the issue was to do with the micro and its wake-up pin. On this device, the wake-up pin is driven by a switch-mode power supply which takes some time to drop to a "low" signal.

Putting in a loop in the shutdown code to read it continuously until it is staying low seems to have resolved this issue.

Associate II

There's still an issue with it producing a spurious pulse during the programming procedure.