cancel
Showing results for 
Search instead for 
Did you mean: 

Some problems about ism330dhcx

6June.1
Associate II

Hi, st

Now I've found some new problems.

Sometimes the value read from who AMI register will be 0x48. After finding this problem, I suspect that the connecting wire is unstable. After replacing the DuPont wire, the value read back to normal (0x6b). I want to ask what is the reason for this strange phenomenon.

In addition, I found that the accelerometer data rate can only be set at 833hz or below. If the accelerometer data rate is set above 1667hz (1667hz,3333hz,6667hz), the value read from the register is still the previous value, that is, the data setting above 1667hz always fails. By the way, there is no such phenomenon in the setting of gyroscope.

So I updated the driver file to the version of 5 days ago (ism330dhcx: fixed examples # 107) in Git library.

A step was added to the driver calling routine of this version(ism330dhcx_device_conf_set), but this step didn't seem to succeed.

After execution, I also read the value of this register(ism330dhcx_device_conf_get(&dev_ctx, &rst)), and the returned value is 0(rst == 0).

In other words, the device_conf bit is not really set to 1 and remains in the default state after the set is executed.

But according to the datasheet, it seems that this bit must be set to 1 to write the new configuration normally?

Now I'm a little confused, can you help me answer the three questions of appeal?

Best regards

June6

8 REPLIES 8
Eleon BORLINI
ST Employee

Hi @6June.1​ ,

about the "instability" of the WHO_AM_I value, are you communicating with SPI or with I2C protocol? Especially in this second case, I'm afraid that there vas some connection unstable that prevented the WHO_AM_I content to be properly transmitted, losing some bits but anyway transmitting the ACK signal, making the MCU able to decode a value that however was not the proper register content. But I would suggest you to use an oscilloscope to check the integrity of the transmitted data.

About the ODR 833Hz setting limit for the accelerometer, are you referring the maximum accelerometer bandwidth configurations, i.e. the maximum signal you can detect? This is determined by the ODR and in effect as you can see from the Table 61 of the datasheet the bandwidth is defined up to 833Hz. For the gyroscope, however, the full band is available, especially for imaging stabilization applications, that require high gyroscope resolution and a broad band. This is due to mechanical characteristics of the two sensors.

Coming to your last question:

>>But according to the datasheet, it seems that this bit must be set to 1 to write the new configuration normally?

Is the DEVICE_CONF the only bit that you are not able to set with the Github procedure? I mean, you set it and when you read back the register content, that bit is returned to 0, right? This should have anyway been set, and the configuration procedure can go on. Are you facing issues in reading the device outputs?

Please let me know if these considerations ca answer your questions.

-Eleon

  1. I use the SPI protocol. Interestingly, I find that when I use an external oscilloscope to detect SPI waveform, I will receive different ID values. Otherwise, it will be the normal value of 0x6b. Can this phenomenon indicate that ism330 is vulnerable to interference?
  2. So, how can I set the accelerometer's ODR to 6.66 kHz?
  3. I don't quite understand what you mean by the return value of 0. After setting ( ism330dhcx_device_conf_set(&dev_ctx, PROPERTY_ENABLE) ), read the value ( ism330dhcx_device_conf_get(&dev_ctx, &rst) ) of this bit. Shouldn't the return value (rst) be 1?

By the way, we only need to collect acceleration data, but the demand for sampling rate is relatively high. What's your suggestion.

That's why I ask you, the accelerometer ODR can't be set to 6667 Hz.

The current configuration status is as follows

/* Start device configuration. */
    ism330dhcx_device_conf_set(&dev_ctx, PROPERTY_ENABLE);
    ism330dhcx_device_conf_get(&dev_ctx, &rst);
    // if (rst != PROPERTY_ENABLE)
      // TODO Define return value
    //   return 4;
 
    /* Enable Block Data Update */
    ism330dhcx_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
    ism330dhcx_block_data_update_get(&dev_ctx, &rst);
    if (rst != PROPERTY_ENABLE)
      // TODO Define return value
      return 5;
 
    /* Set Power Mode */
    ism330dhcx_xl_power_mode_set(&dev_ctx, ISM330DHCX_HIGH_PERFORMANCE_MD);
    ism330dhcx_xl_power_mode_get(&dev_ctx, &rst);
    if (rst != ISM330DHCX_HIGH_PERFORMANCE_MD)
      // TODO Define return value
      return 6;
 
    /* Set Output Data Rate */
    ism330dhcx_xl_data_rate_set(&dev_ctx, ISM330DHCX_XL_ODR_6667Hz);
    ism330dhcx_xl_data_rate_get(&dev_ctx, &rst);
    if (rst != ISM330DHCX_XL_ODR_6667Hz)
      // TODO Define return value
      return 7;
 
    /* Set full scale */
    ism330dhcx_xl_full_scale_set(&dev_ctx, ISM330DHCX_16g);
    ism330dhcx_xl_full_scale_get(&dev_ctx, &rst);
    if (rst != ISM330DHCX_16g)
      // TODO Define return value
      return 8;
 
    memset(&pin_int1_route, 0, sizeof(pin_int1_route));
    pin_int1_route.int1_ctrl.int1_drdy_xl = PROPERTY_ENABLE;
    ism330dhcx_pin_int1_route_set(&dev_ctx, &pin_int1_route);
    ism330dhcx_pin_int1_route_get(&dev_ctx, &pin_int1_route);
    if (pin_int1_route.int1_ctrl.int1_drdy_xl != PROPERTY_ENABLE)
      // TODO Define return value
      return 9;
 
    ism330dhcx_pin_mode_set(&dev_ctx, ISM330DHCX_PUSH_PULL);
    ism330dhcx_pin_mode_get(&dev_ctx, &rst);
    if (rst != ISM330DHCX_PUSH_PULL)
      // TODO Define return value
      return 10;
 
    ism330dhcx_pin_polarity_set(&dev_ctx, ISM330DHCX_ACTIVE_LOW);
    ism330dhcx_pin_polarity_get(&dev_ctx, &rst);
    if (rst != ISM330DHCX_ACTIVE_LOW)
      // TODO Define return value
      return 11;
 
    ism330dhcx_all_on_int1_set(&dev_ctx, PROPERTY_ENABLE);
    ism330dhcx_all_on_int1_get(&dev_ctx, &rst);
    if (rst != PROPERTY_ENABLE)
      // TODO Define return value
      return 12;

Following the above steps, there are two problems.

  1. Execute read (ism330dhcx_device_config). After the device_conf bit is set to 1, it is still read as 0.
  2. Accelerometer ODR setting failed. When the accelerometer ODR is set to 1667hz or 3333hz or 6667hz, the relevant value in the read register is 0 (off).

6June.1
Associate II

Hi,Eleon BORLINI

I have understood what is written in the datasheet. Under mode 1, the maximum sampling rate of the accelerometer can only reach 833hz. In order to reach 6667hz, mode 4 must be used.

Do you have any routines related to mode 4 using interrupt? Or briefly explain the following process to me, only part of which is described in application note.

Eleon BORLINI
ST Employee

Hi @6June.1​ ,

Mode 4 refers to the auxiliary SPI interface used in OIS applications, so you have to wire these additional lines to your application processor to use it, but ok, in this way you could deploy the 6.66kHz ODR speed.

Since there is yet no application note available for the ism330dhcx, i suggest you to use the lsm6dso one (AN5192), where Mode 4 is detailed. This digital feature is shared between these two sensors. In page 85 you can find the pseudocode for Mode 4 routine configuration:

1. Wait 10 ms // Boot time
// Device in power-down after this time period
2. Write 31h to CTRL1_OIS // Turn gyro on through Auxiliary SPI 3-write interface
// (OIS Gyro: FS = ±250 dps / ODR = 6.66 kHz)
// Enable Mode 4 (Mode4_EN = 1)
3. Write 00h to CTRL3_OIS // Set XL through Auxiliary SPI 3-wire interface
// (OIS XL: FS = ±2 g / ODR = 6.66 kHz)
4. Wait 74 ms // Gyroscope max turn-on time is 70 ms
// Selected LPF1 (00b) settling time is 4.05 ms
// (27 samples @ 6.66 kHz)
// Selected LPF OIS (000b) settling time is 2.85 ms
// (19 samples @ 6.66 kHz)
5. Read output registers 22h to 27h // Read gyroscope output data through Auxiliary SPI
6. Read output registers 28h to 2Dh // Read accelerometer output data through Auxiliary SPI

Let me please know if these indications can help you.

-Eleon

Hi,Eleon BORLINI

The current situation is that if the parameters are written into CTRL1_OIS and CTRL3_OIS registers by the auxiliary SPI bus, the parameters read by the auxiliary SPI are still the default values, and the parameters read by the primary SPI bus are the parameters I write.

Moreover, when the auxiliary SPI is used to read the value of 1eh register, the new data is never available. And the auxiliary SPI is used to read the values of 22h to 27h registers and 28h to 2dh registers, and the data is always 00h.

If you use the primary SPI bus to read and write, everything is normal.

I can't figure out what causes this phenomenon...

I hope you can point out the problem.

-June6

Hi @6June.1​ ,

sorry for my late answer... Which mode are you running before activating the OIS chain (Mode3/Mode4)?

From the LSM6DSO app note, p.76: if the accelerometer is configured in Ultra-Low-Power mode when enabling the OIS (Mode 3 or Mode 4) is required, the device must be configured in Power-Down mode before enabling the OIS chain.

-Eleon