cancel
Showing results for 
Search instead for 
Did you mean: 

ASM330lhh

Orenzv
Associate

Hi,
I am working with ASM330lhh, connected to my linux device via i2c.
in the sysfs i can see the device with the command  "ls -l /sys/bus/iio/devices/iio:device1/"  that return:
total 0
-r--r--r-- 1 root root 4096 Mar 24 14:21 consumers
-rw-r--r-- 1 root root 4096 Mar 24 14:21 current_timestamp_clock
-r--r--r-- 1 root root 4096 Mar 24 14:21 dev
drwxr-xr-x 2 root root 0 Mar 24 14:21 events
--w------- 1 root root 4096 Mar 24 14:21 hwfifo_flush
-rw-r--r-- 1 root root 4096 Mar 24 14:21 hwfifo_watermark
-r--r--r-- 1 root root 4096 Mar 24 14:21 hwfifo_watermark_max
-r--r--r-- 1 root root 4096 Mar 24 14:21 in_anglvel_scale_available
-rw-r--r-- 1 root root 4096 Mar 24 14:21 in_anglvel_x_raw
-rw-r--r-- 1 root root 4096 Mar 24 14:21 in_anglvel_x_scale
-rw-r--r-- 1 root root 4096 Mar 24 14:21 in_anglvel_y_raw
-rw-r--r-- 1 root root 4096 Mar 24 14:21 in_anglvel_y_scale
-rw-r--r-- 1 root root 4096 Mar 24 14:21 in_anglvel_z_raw
-rw-r--r-- 1 root root 4096 Mar 24 14:21 in_anglvel_z_scale
-r--r--r-- 1 root root 4096 Mar 24 14:21 name
lrwxrwxrwx 1 root root 0 Mar 24 14:21 of_node -> ../../../../../../../../firmware/devicetree/base/soc@0/bus@30800000/i2c@30a40000/asm330lhh@6a
drwxr-xr-x 2 root root 0 Mar 24 14:21 power
-rw-r--r-- 1 root root 4096 Mar 29 15:59 sampling_frequency
-r--r--r-- 1 root root 4096 Mar 24 14:21 sampling_frequency_available
lrwxrwxrwx 1 root root 0 Mar 24 10:25 subsystem -> ../../../../../../../../bus/iio
-r--r--r-- 1 root root 4096 Mar 24 14:21 suppliers
-rw-r--r-- 1 root root 4096 Mar 24 10:25 uevent

from the linux  terminal i am reading the device registers with 'i2cdump -f -y 2 0x6a' command, so the i2c is working.

my questions:

1. What are the units the i got from the command "cat in_anglvel_x_raw" ? degrres/second, milli degrees/second or radians?
2. what i need to do with the value of "in_anglvel_x_scale" ?
3. is there is a special mode to read from the libiio user space application? 
    FIFO or somthing like that? a code example will be great!
4.how should i initiate the device via i2c in the start?

Thanks

 

2 REPLIES 2
niccolò
ST Employee

Hi @Orenzv ,
Welcome to ST Community =D

to reply directly to your questions:

  1. the raw data usually refers to the raw value in the register in LSB, that has no physical value. to get to mdps, you have to apply the conversion formula
    angvel[mdps] = angvel[LSB] * AngulaRateSensitivity
    referring to the datasheet (page 14, table 3), depending on the Full Scale selected
  2. I would say that there is the converted value, in mdps, probably, but you should check it by reading it (I never worked with Linux, so I'm not sure at the moment)
  3. sure, the FIFO can be used, and you can refer to the application note of the sensor for more info (and code snippets)
  4. also for this, you can refer to the application note, there is everything you should know, there =)

If this answers your question, please, mark this as "best answer", by clicking on the "accept as solution" to help the other users of the community

Niccolò

As you already know, I am working with ASM330LHH and I am trying to work with Gyroscope.
I found in STM's Git an example application code, as you can see in the link: https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/asm330lhh_STdC/examples/asm330lhh_read_data_pollng.c

I Took only the Gyroscope relevant code(Configuration and data polling) and Converted it to CPP.
I Am using I2C that is working fine, I can read the Device ID.

The problem is the X, Y and Z values I am reading as you can see in my prints:
x: -6.58, y: -9.38 , z: -2.31

x: -6.58, y: -9.66 , z: 1935.92

x: -6.09, y: -9.73 , z: 1923.32

x: -6.30, y: -10.01 , z: -7.84

x: -6.37, y: -9.73 , z: -1.96

x: -6.44, y: -9.73 , z: -2.10

x: -6.65, y: -9.66 , z: -4.76

x: -6.09, y: -9.94 , z: -4.62

x: -6.58, y: -9.73 , z: -7.14

x: -6.44, y: -9.66 , z: -4.62

x: -6.09, y: -9.52 , z: 1925.91

x: -5.81, y: -9.52 , z:

x: -6.65, y: -9.73 , z: -4.83

x: -6.30, y: -9.45 , z: 1901.97
. . . .


The values are not around '0' and Z sometimes gets high values('1923.32', '1903.23',…)

Appreciate any help in this issue,
Oren