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

NRF_TWIM_Type nRF51 TWI

Environment: Segger Embedded Studio nRf51 Developementkit using jLink OB firmware S130

We're using the \nRF5_SDK_12.2.0_f012efa\examples\ble_peripheral\ble_app_template to start a new ble project.

As we need to get some sensordata from an ST LIS2DH12 using TWI, we run into trouble initialising the twi.

Including the app_twi.h we get the error: ./../../../../../../components/drivers_nrf/hal/nrf_twim.h:40:38: error: 'NRF_TWIM_Type' undeclared here (not in a function)

Using grep we found out NRF_TWIM_Type is defined in nrf52.h only.

So how do we include twi properly?

ST has an LIS2DH12 driver to get the sensordata (it'S hard to find, located in: STM32CubeExpansion_MEMS-XT1_V3.0.0\Drivers\BSP\Components\lis2dh12) it would be nice if we could use it with our nRF51. But pure TWI communication should be fine as well, if we are able to use the TWI transaction manager.

It's strange we couldn't figure out how to include TWI (which headerfiles are needed?) as well as the docs usually refer to single actions only. Is there a simple example how to implement twi in your projects using S130?

Related