要使用传感器集线器触发信号设置来同步我 并将 sh_data_rate 设置为 100hz,我将所有传感器的输出数据速率设置为 100hz。这是我的设置:
- while(LSM6DSOX_ID!=whoamI)
- {
- whoamI = 0;
- lsm6dsox_device_id_get(&lsm6dsox, &whoamI);
- printf("LSM6DSOX_ID %x=%xn", LSM6DSOX_ID, whoamI);
- }
-
- /* Restore default configuration. */
- lsm6dsox_reset_set(&lsm6dsox, PROPERTY_ENABLE);
- do
- {
- lsm6dsox_reset_get(&lsm6dsox, &rst);
- } while(rst);
- /* Disable I3C interface. */
- lsm6dsox_i3c_disable_set(&lsm6dsox, LSM6DSOX_I3C_DISABLE);
-
-
- while(whoamI != LSM303AGR_ID_XL)
- {
- lsm303agr_xl_device_id_get(&lsm303agr_acc, &whoamI);
- printf("LSM303AGR_ID_ACCELOMETER %x=%xn", LSM303AGR_ID_XL,
- whoamI);
- }
-
-
- while(whoamI != LSM303AGR_ID_MG)
- {
- lsm303agr_mag_device_id_get(&lsm303agr_mag, &whoamI);
- printf("LSM303AGR_ID_MAGNETOMETER %x=%xn", LSM303AGR_ID_MG,
- whoamI);
- }
-
- /*Configure Full scale xl and gy*/
- lsm6dsox_xl_full_scale_set(&lsm6dsox, LSM6DSOX_2g);
- lsm6dsox_gy_full_scale_set(&lsm6dsox, LSM6DSOX_2000dps);
-
- /*lsm303agr mag Set BDU,data rate,fullscale,operating mode,Sensor Hub Slave0*/
- lsm303agr_mag_block_data_update_set(&lsm303agr_mag, PROPERTY_ENABLE);
- lsm303agr_mag_data_rate_set(&lsm303agr_mag, LSM303AGR_MG_ODR_100Hz);
- lsm303agr_mag_set_rst_mode_set(&lsm303agr_mag,
- LSM303AGR_SENS_OFF_CANC_EVERY_ODR);
- lsm303agr_mag_operating_mode_set(&lsm303agr_mag,LSM303AGR_CONTINUOUS_MODE);
- lsm6dsox_sh_slv0_cfg_read(&lsm6dsox, &mag_conf);
-
- /*lsm303agr xl Set BDU,data rate,fullscale,operating mode,Sensor Hub Slave1*/
- lsm303agr_xl_block_data_update_set(&lsm303agr_acc, PROPERTY_ENABLE);
- lsm303agr_xl_data_rate_set(&lsm303agr_acc, LSM303AGR_XL_ODR_100Hz);
- lsm303agr_xl_full_scale_set(&lsm303agr_acc, LSM303AGR_2g);
- lsm303agr_xl_operating_mode_set(&lsm303agr_acc, LSM303AGR_LP_8bit);
- lsm6dsox_sh_slv1_cfg_read(&lsm6dsox, &acc_conf);
-
-
- /*lsm6dsox enable Master and set BDU,ODR,number of slaves,Sensor hub trigger signal*/
- lsm6dsox_sh_master_set(&lsm6dsox, PROPERTY_ENABLE);
- lsm6dsox_xl_data_rate_set(&lsm6dsox, LSM6DSOX_XL_ODR_104Hz);
- lsm6dsox_gy_data_rate_set(&lsm6dsox, LSM6DSOX_XL_ODR_104Hz);
- lsm6dsox_sh_data_rate_set(&lsm6dsox, LSM6DSOX_SH_ODR_104Hz);
- lsm6dsox_sh_slave_connected_set(&lsm6dsox, LSM6DSOX_SLV_0_1);
- lsm6dsox_block_data_update_set(&lsm6dsox, PROPERTY_ENABLE);
- lsm6dsox_sh_syncro_mode_set(&lsm6dsox,LSM6DSOX_XL_GY_DRDY);
-
- /*After this I m reading the status flags and raw data and multple it with numbers according to datasheet */
- lsm6dsox_xl_flag_data_ready_get(&lsm6dsox, &drdy); and the reading the raw data
- lsm6dsox_acceleration_raw_get(&lsm6dsox, data_raw.u8bit);
- lsm6dsox_sh_read_data_raw_get(&lsm6dsox, (uint8_t*)&emb_sh,18);
- /*and for gyro*/
- lsm6dsox_gy_flag_data_ready_get(&lsm6dsox, &drdy);
- lsm6dsox_angular_rate_raw_get(&lsm6dsox, data_raw.u8bit);
-
-
我有个问题?
根据数据表:
“当此位设置为 0 时,加速度计/陀螺仪传感器必须处于活动状态(不处于掉电模式)并且传感器集线器触发信号是加速度计/陀螺仪数据就绪信号。
当此位设置为 1 时,加速度计和陀螺仪之间至少有一个传感器必须处于活动状态,并且传感器集线器触发信号是 INT2 引脚。”
在 lsm6dsox_reg.h 文件中
- typedef enum {
- LSM6DSOX_EXT_ON_INT2_PIN = 0,
- LSM6DSOX_XL_GY_DRDY = 1,
- } lsm6dsox_start_config_t;
不应该是相反的吗?
LSM6DSOX_EXT_ON_INT2_PIN = 1
LSM6DSOX_XL_GY_DRDY = 0
|
|
2023-1-17 10:27:14
评论
举报
|
|
|