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

IoT SDK connect TWI(I2C) ??

[Dev Env]

nRF51 DK

IoT SDK 0.8

IoT SoftDevice

[Question]

anybody help me.

In Iot SDK can't access TWI interface? any Sample ??

HardFault_Handler(/attachment/fbd403f1c1c47dcb2a8365c80f82a589)

bool twi_master_init(void) { . . NRF_PPI->CH[0].EEP = (uint32_t)&NRF_TWI1->EVENTS_BB; . . }

like :: devzone.nordicsemi.com/.../

  • PPI is a restricted peripheral, and in earlier versions of the softdevice, that causes direct access to it to cause a hardfault. There are sd_ functions to access the PPI channels safely, you should use those.

    However .... that hack for using a PPI channel to stop the TWI device was only ever needed for the 1st version chips with the anomaly that the TWI shortcut didn't work, that was fixed in version 2 of the chips, a long, long time ago and there's no need to use a PPI channel at all any more. You can change it to use the now-working shortcut - or switch to the more-recent nrf_drv_twi.c if you have recent-enough hardware to run it on.

Related