This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Is any example for access ST LIS3DH in NRF52

Hi all: I am developing the driver of ST LIS3DH and its mcu is NRF52. If I want to read the value of whoami. I am not sure if I need call the function of

nrf_drv_twi_tx	(
	nrf_drv_twi_t const *	p_instance,
	uint8_t 				address,
	uint8_t const *			p_data,
	uint8_t 				length,
	bool 					no_stop 
)

where address is the I2C Address of LIS3DH, p_data is the adree of the register of whoami, length = 1, and no_stop is true.

And then call the function function of

nrf_drv_twi_rx	(
	nrf_drv_twi_t const *	p_instance,
	uint8_t 				address,
	uint8_t * 				p_data,
	uint8_t 				length 
)

where address is the I2C Address of LIS3DH, p_data is the buffer for receive data, and length = 1.

Because my program is always not return from the function of nrf_drv_twi_rx. Is any mistake I made.

BTW, I am using the example code of "app_twi" and just change the configure of SDA/SDA pins and I2C Address..

Thanks...

Parents Reply Children
No Data
Related