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

Correct TWI library for use with SoftDevice?

Hello

I'm trying to communicate with an sensor over the TWI HW interface during a BLE connection with the S110 soft-device, and every time I try to use the TWI bus the nRF51 goes into reset. I've tried many different variations of edited TWI libraries that are here on Devzone but all have failed, what is the correct and most up to date version to use?

I'm using version S110 V8.0, along with version 8.0 of the SDK. The nRF51 module I'm using is based off a revision 2 silicon package (CE AA) .

I've tried the libraries included in the following devzone posts, all of which cause a system reset when I engage the TWI bus:

devzone.nordicsemi.com/.../

devzone.nordicsemi.com/.../

devzone.nordicsemi.com/.../

I have also tried simply using the SW library, but the sensor always returns 0 if the BLE is active.

And why hasn't a working library been added to the SDK yet?

Thanks

  • The TWI libraries, like all the other libraries, work perfectly for most developers most of the time. I would agree that twi hardware library has, since the rev 1 hardware, had the workaround for the non-functioning shortcuts in that revision baked into it and that uses PPI channels directly, which didn't work after the softdevice was activated because PPI was marked as a restricted peripheral, thus leading to a load of confusion and various hacked up versions of the driver replacing the direct PPI calls with a softdevice PPI call.

    The volume of confusing posts and workarounds which that causes tends to lead people to the believe the TWI driver doesn't work, when in fact it basically works just fine.

    There seems to be some effort to clean that up in SDK 8.1 with older drivers being put in an 'incubated' folder and new drivers with the drv embedded in their name having been written without the fixes for old hardware issues.

    However if you've tried all those things then your problem most likely likes somewhere else. You need to figure out where you're getting into reset (what do you mean by that anyway exactly). What's the last line executed, is it in the TWI driver or elsewhere?

    And you're using an invalid combination of SDK for your hardware by the way. The last compatible SDK for rev 2 hardware is 6.1.0. SD 8.0.0 is compatible, but there's no downloadable complete package which has SD 8 and an SDK for rev 2, so if you want to take one package, the last one available for rev 2 is SDK 6.1.0 + SD 7.1.0.

    Either way - the HW TWI driver in 6.1.0 or 7.x or 8.x is all pretty much the same, it works modulo the PPI channel usage annoyance. Can you figure out where you are getting to reset and post some code and then perhaps someone can help you more.

  • kilianod, please update this thread, if this answer helped you then please click the ✓ to the left of the answer so that others can come and look here.

Related