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
  • New commit:

    I found the reason of this Hard fault is that, I use 

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

    but the last parameter was multi by 6 inside lis2dh12 driver, so it's bigger than LIS2DH12_MIN_QUEUE_SIZE.

    So I change is to 1 and it work.

    But I still have question, How big can I set the "LIS2DH12_MIN_QUEUE_SIZE". And do I need to set MAX_PENDING_TRANSACTIONS bigger than LIS2DH12_MIN_QUEUE_SIZE?

Reply
  • New commit:

    I found the reason of this Hard fault is that, I use 

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

    but the last parameter was multi by 6 inside lis2dh12 driver, so it's bigger than LIS2DH12_MIN_QUEUE_SIZE.

    So I change is to 1 and it work.

    But I still have question, How big can I set the "LIS2DH12_MIN_QUEUE_SIZE". And do I need to set MAX_PENDING_TRANSACTIONS bigger than LIS2DH12_MIN_QUEUE_SIZE?

Children
  • Hello,

    I am sorry for the late reply.

    I don't have a LIS2DH sensor to test any of this on, but the parameters: LIS2DH12_MIN_QUEUE_SIZE and MAX_PENDING_TRANSACTIONS means the following in the application:

    NRF_TWI_MNGR_DEF(..., MAX_PENDING_TRANSACTIONS, ...)

    The second parameter of NRF_TWI_MNGR_DEF(...) is the size of the transaction queue. See NRF_TWI_MNGR_DEF() on infocenter.

     

    NRF_TWI_SENSOR_DEF(..., ..., LIS2DH12_MIN_QUEUE_SIZE)

    The third parameter of NRF_TWI_SENSOR_DEF(...) is the buffer size of the TWI communication for that sensor. See NRF_TWI_SENSOR_DEF() on infocenter.

     

    Again, I haven't got any LIS2DH sensor to test this on, so I haven't tested this driver before. But I suppose that the sensor def is the queue of a single transaction in bytes, while the TWI_MNGR_DEF is the max number of pending transactions.

     

    Best regards,

    Edvin

Related