Hello.
I need to read IMU data from LIS2DH12 of nrf 52833 which is in DWM3001CDK. But nothing I do initializes sensor... i always receive
<err> lis2dh: Failed to read chip id.
I tried everything on internet, almost every sample, every solution to similiar problem etc... nothing.. at this point im starting to think HW is at fault...
int err_code = 0;
const nrfx_twim_config_t twi_config = {
.scl_pin = 36,
.sda_pin = 24,
.frequency = NRF_TWIM_FREQ_100K,
.interrupt_priority = 0,
.hold_bus_uninit = false
};
//err_code = nrfx_twim_init(&m_twi, &twi_config, NULL, NULL);
nrfx_twim_enable(&m_twi);
k_sleep(K_MSEC(10));
uint8_t who_am_i = 5;
uint8_t who_am_i2 = 6;
nrfx_twim_xfer_desc_t data = NRFX_TWIM_XFER_DESC(NRFX_TWIM_XFER_RX, 0x19, &who_am_i, 1, &who_am_i2, 1);
err_code = nrfx_twim_xfer(&m_twi, &data, 0);
k_sleep(K_MSEC(10));
LOG_ERR("IMU %d - %X - %X", err_code, who_am_i, who_am_i2);
k_sleep(K_MSEC(10));
//const struct device *const sensor = DEVICE_DT_GET_ANY(DT_NODELABEL(lis2dh12));
const struct device *const sensor = DEVICE_DT_GET(DT_INST(0, st_lis2dh));
if (sensor == NULL) {
printf("No device found\n");
return;
}
if (!device_is_ready(sensor)) {
printf("Device %s is not ready\n", sensor->name);
return;
}
this is some code i tried to initialize or interface with device... it appears to me that I2C bus is alright and working but LIS2D itself is not working...
My configuration
CONFIG_I2C=y CONFIG_SENSOR=y CONFIG_LIS2DH=y CONFIG_LIS2DH_ODR_RUNTIME=y CONFIG_LIS2DH_TRIGGER_GLOBAL_THREAD=y CONFIG_CBPRINTF_FP_SUPPORT=y
&i2c0 {
compatible = "nordic,nrf-twim";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
pinctrl-0=<&i2c0_default>;
pinctrl-1=<&i2c0_sleep>;
pinctrl-names = "default", "sleep";
/* embedded LIS2DH accelerometer */
lis2dh12: lis2dh12@19 {
compatible = "st,lis2dh12", "st,lis2dh";
status = "okay";
reg = <0x19>;
irq-gpios = <&gpio0 16 0x0>;
};
};
Is there anything else i should be doing ? From what I read for past few days there isnt... or atleast none of the samples did anything more