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

TWI is not working with SoftDevice

This seems to be a common problem after searching in this forum. In my case, I need to read from an I2C slave and send the data out in BLE. I have made it work without SoftDevice using this library code http://pastebin.com/qLLAy418 . However, it failed to work with SoftDevice. I also tried with another version which has SoftDevice knobs http://pastebin.com/AV6cQK0x. It doesn't work either. I also tried other code github.com/.../twi_hw_master.c that someone claimed to work (devzone.nordicsemi.com/.../), but it doesn't work for me. Can anyone provide any suggestion on this problem?

Parents
  • What does 'doesn't work' mean? Crashes, sends erratically, goes to the hardfault handler, the board bursts into flames, what?

    The TWI handler in the library works with the softdevice quite happily, as it should, they are entirely separate things.

    So what exactly happens when you use the nordic TWI driver from the SDK for your board with and without the softdevice?

  • Thanks for your comment. I also tried the one with TWI SHORTS (although I don't know what SHORTS means here) from here in this post. However, it still has the same behavior with the twi_master_hw.c: it just time out and return false status. Another thing I did was taking some waveform with a logic analyzer. The waveform associated with twi_master_hw.c is like this, which has oscillating SDA but no clock. The I2C slave I was using was MPR121. I didn't find clock stretching information on its datasheet. But my impression was clock stretching was part of I2C protocol, and was not uncommon.

Reply
  • Thanks for your comment. I also tried the one with TWI SHORTS (although I don't know what SHORTS means here) from here in this post. However, it still has the same behavior with the twi_master_hw.c: it just time out and return false status. Another thing I did was taking some waveform with a logic analyzer. The waveform associated with twi_master_hw.c is like this, which has oscillating SDA but no clock. The I2C slave I was using was MPR121. I didn't find clock stretching information on its datasheet. But my impression was clock stretching was part of I2C protocol, and was not uncommon.

Children
No Data
Related