Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

LIS2DH12 driver issue in nRF SDK v15.0

Hi,

There are several new drivers under "nRF5_SDK_15.0.0_a53641a\components\drivers_ext\", but no example now.

I have setup the HTS221 driver and it works. I turn to LIS2DH12 driver, but it not work.

For send and receive more i2c data then HTS221, I change some Marco like this:

#define MAX_PENDING_TRANSACTIONS    33

#define LIS2DH12_MIN_QUEUE_SIZE       32

And read who_am_i successfully.

when try to read accelerate data, it stuck in somewhere, where I cannot traced.

Could you kindly share with me a example, which is using the new LIS2DH12 driver?

Parents
  • More information here:

    Define and configuration:

    #define TWI_INSTANCE_ID             0
    
    #define MAX_PENDING_TRANSACTIONS    33
    
    #define LIS2DH12_MIN_QUEUE_SIZE       32
    
    NRF_TWI_MNGR_DEF(m_nrf_twi_mngr, MAX_PENDING_TRANSACTIONS, TWI_INSTANCE_ID);
    
    NRF_TWI_SENSOR_DEF(m_nrf_twi_sensor, &m_nrf_twi_mngr, LIS2DH12_MIN_QUEUE_SIZE);
    
    LIS2DH12_INSTANCE_DEF(m_lis2dh12, &m_nrf_twi_sensor, LIS2DH12_BASE_ADDRESS_LOW);
    
    
    ...
    
        LIS2DH12_DATA_CFG(m_lis2dh12, LIS2DH12_ODR_100HZ, false, 1, 1, 1, LIS2DH12_SCALE_2G, 1);
        LIS2DH12_FIFO_CFG(m_lis2dh12, false, LIS2DH12_BYPASS, false, 0x00);
    
        err_code = lis2dh12_init(&m_lis2dh12);
        APP_ERROR_CHECK(err_code);
    
    ...
    
    
    

    after that,

    lis2dh12_data_read(&m_lis2dh12, lis2dh12_data_read_cb, &accel_data, sizeof(accel_data));

Reply
  • More information here:

    Define and configuration:

    #define TWI_INSTANCE_ID             0
    
    #define MAX_PENDING_TRANSACTIONS    33
    
    #define LIS2DH12_MIN_QUEUE_SIZE       32
    
    NRF_TWI_MNGR_DEF(m_nrf_twi_mngr, MAX_PENDING_TRANSACTIONS, TWI_INSTANCE_ID);
    
    NRF_TWI_SENSOR_DEF(m_nrf_twi_sensor, &m_nrf_twi_mngr, LIS2DH12_MIN_QUEUE_SIZE);
    
    LIS2DH12_INSTANCE_DEF(m_lis2dh12, &m_nrf_twi_sensor, LIS2DH12_BASE_ADDRESS_LOW);
    
    
    ...
    
        LIS2DH12_DATA_CFG(m_lis2dh12, LIS2DH12_ODR_100HZ, false, 1, 1, 1, LIS2DH12_SCALE_2G, 1);
        LIS2DH12_FIFO_CFG(m_lis2dh12, false, LIS2DH12_BYPASS, false, 0x00);
    
        err_code = lis2dh12_init(&m_lis2dh12);
        APP_ERROR_CHECK(err_code);
    
    ...
    
    
    

    after that,

    lis2dh12_data_read(&m_lis2dh12, lis2dh12_data_read_cb, &accel_data, sizeof(accel_data));

Children
No Data
Related