2024-11-09 01:38 AM
I am trying to get data from ASM330LLHXG1 so first, I decided to try the self test code provided by ST to see whether I can make the sensor work, until the reading of status register it was going okay but no matter how long I wait the status register data ready flag for both gyro, accelerometer, and temperature are all zero. The code is stuck at while(!drdy) :
/* Check device ID */
asm330lhhxg1_device_id_get(&dev_ctx, &whoamI);
if (whoamI != ASM330LHHXG1_ID)
while(1);
/* Restore default configuration */
asm330lhhxg1_reset_set(&dev_ctx, PROPERTY_ENABLE);
do {
asm330lhhxg1_reset_get(&dev_ctx, &rst);
} while (rst);
/* Disable I3C interface */
asm330lhhxg1_i3c_disable_set(&dev_ctx, ASM330LHHXG1_I3C_DISABLE);
/* Enable Block Data Update */
asm330lhhxg1_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
/* Accelerometer Self Test */
/* Set Output Data Rate */
asm330lhhxg1_xl_data_rate_set(&dev_ctx, ASM330LHHXG1_XL_ODR_52Hz);
/* Set full scale */
asm330lhhxg1_xl_full_scale_set(&dev_ctx, ASM330LHHXG1_4g);
/* Wait stable output */
platform_delay(100);
/* Check if new value available */
do {
asm330lhhxg1_xl_flag_data_ready_get(&dev_ctx, &drdy);
} while(!drdy);