cancel
Showing results for 
Search instead for 
Did you mean: 

ASM330LHHXG1 does not take the DRDY flag to high

eds
Associate III

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);

1 REPLY 1
Federica Bossi
ST Employee

Hi @eds ,

If you want to implement the self test you can start from our official example on Github.

Let me know if it works!

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.