Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

D52QSKM6IA-A Module use integrated accelerometer LIS2DH

Rank

Total Posts: 2

Joined 2018-01-17

PM

Hi,

I'm trying to use the integrated accelerometer LIS2DH on the D52QSKM6IA-A module.

But I just can't figure out why I'm always getting an error in the TWI event handler of type:
NRF_DRV_TWI_EVT_ADDRESS_NACK 
.


Is there anything special to consider using the intergrated sensor?

So here is what I'm doing:

- address and TWI instance
#define LIS2DH_SAD_W 0x30UL
#define LIS2DH_CS_PIN   27
#define LIS2DH_SDA_PIN   29
#define LIS2DH_SCL_PIN   30
#define TWI_INSTANCE_ID 0

//...

static const nrf_drv_twi_t m_twi NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID); 


- Initialization of GPIO pins:
'0' on SA0 (pin 28)
'1' on SC (pin 27)

- Initialization of TWI:
ret_code_t err_code;

const 
nrf_drv_twi_config_t twi_lis2dh_config {
   
.scl                LIS2DH_SCL_PIN,
   .
sda                LIS2DH_SDA_PIN,
   .
frequency          = (nrf_twi_frequency_t)TWI_DEFAULT_CONFIG_FREQUENCY,
   .
interrupt_priority TWI_DEFAULT_CONFIG_IRQ_PRIORITY,
   .
clear_bus_init     TWI_DEFAULT_CONFIG_CLR_BUS_INIT
}
;

err_code nrf_drv_twi_init(&m_twi, &twi;_lis2dh_configtwi_handlerNULL);
APP_ERROR_CHECK(err_code);

nrf_drv_twi_enable(&m_twi); 



When I then try to write to CTRL_REG1 I get an event of type
NRF_DRV_TWI_EVT_ADDRESS_NACK 
in TWI handler function.

m_xfer_done false;
uint8_t reg[2] {LIS2DH_CTRL_REG10xCB};
err_code nrf_drv_twi_tx(&m_twiLIS2DH_SAD_Wregsizeof(reg), false);
APP_ERROR_CHECK(err_code);
while (
m_xfer_done == false); 



I already added two 10k pull-up resistors to SCL and SDA pins as described in the datasheet.
Also checked the voltage level of CS and SA0 pins, they have the expected levels.


Does anybody know what I'm doing wrong?


Thanks for help!       [ Edited: 22 March 2018 02:32 PM by _manu ]
Rank

Total Posts: 2

Joined 2018-01-17

PM

Hi,

as I'm still stuck at the mentioned problem and can't figure out why still getting no acknowledgement from accelerometer I'm writing again here.

Perhaps someone reading this can help me out.

Is there any documentation of the circuit on D52QSKM6IA-A explicitly to connection to LIS2DH IC?
Can anybody confirm that I'm using the right pins (I found them in Module Datasheet)? - as this would be a explainable reason for lack of acknowledgement.


Greets