This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to drive BMA223 sensor by NRF52832 TWI?

I used NRF52832 TWI master to drive BMA223 sensor,

a. gs.c/gs.h are the driver codes

b. the i2c wave is looks right, but there still not generates a NRF_DRV_TWI_EVT_DONE event

c. so sinks into while(!this_done)

Who can help me? Thanks!

image description gs.c gs.h

  • You should check the return values from your calls to nrf_drv_twi_* functions. I would also recommend you to check the return values using APP_ERROR_CHECK(), and follow this debugging method to see if any errors are reported. Have you tried setting a breakpoint in the event handler, to see if it is called at all? Are you using softdevice in your application, and have initialized this before calling sd_app_evt_wait()? In your call to nrf_drv_twi_tx() you have set the no_stop parameter to false, but the datasheet seems to not expect a stop condition between tx and rx in a read operation. Have you tried setting this to true?

Related