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

nrfx_TWI to access Bosch BNO055... low-level ops needed

I'm using nRF52832 and intend to interface 3 I2C slave devices; the first is the BNO055 IMU.

I've integrated the Bosch "driver" code into my SES project, but I find that their "low-level" code

(that would actually use the I2C) is just "stubs".  The key methods that need to be implemented

are: 

BNO055_I2C_bus_write and BNO055_I2C_bus_read.

My intent was to plug in "TWI" operations to accomplish this; I've gone 'round and 'round with

all of the "TWI legacy" stuff like "nrf_drv_twi_xxx" vs "nrfx_twi_xxx" and believe that the "nrfx..."

(under "..\modules", not "..\components" (which seems "deprecated") is probably the way to go.

But I'm kinda stuck here.   Some questions:

  a) is this the right way to proceed?

  b) has anyone already done this? ("nrfx TWI" to BNO055)

  c) If I'm using nRF52832 as "master", I'm thinking that I don't need any of the "TWIS" mechanism,

   as I'm only talking to external "slave" devices, not trying to use the '52 "as" a slave, correct?

  d) will H/W TWI deal with async responses from multiple I2C slaves "concurrently" (I'm unclear

on how "arbitration" might work in this scenario), or must I resort to synchronous, sequential "polling"

style of device access?

Thanks so much for any direction & suggestions!

Jim

Parents
  • Hi Martin,

     Thanks for your quick reply!  I think I'm getting in-sync here.  Re: my question/your reply "(d)", the usage that I envision for my multiple slave I2C devices is ideally for them to operate completely asynchronously; e.g. commands sent to Device-A upon Timer1 firing, commands sent to Device-B upon Timer2 firing.  If I understand TWI correctly, it looks like I could have two nrfx_twi_t instances (TWIM0, TWIM1 enabled), each having their own nrfx_twi_config_t thereby specifying different pairs of I/O's for scl,sda, and independent nrfx_twi_evt_handler_t's.   I hope I'm not too far off base with this, else I'll need to take a step back. :)  Make sense?

    Jim

Reply
  • Hi Martin,

     Thanks for your quick reply!  I think I'm getting in-sync here.  Re: my question/your reply "(d)", the usage that I envision for my multiple slave I2C devices is ideally for them to operate completely asynchronously; e.g. commands sent to Device-A upon Timer1 firing, commands sent to Device-B upon Timer2 firing.  If I understand TWI correctly, it looks like I could have two nrfx_twi_t instances (TWIM0, TWIM1 enabled), each having their own nrfx_twi_config_t thereby specifying different pairs of I/O's for scl,sda, and independent nrfx_twi_evt_handler_t's.   I hope I'm not too far off base with this, else I'll need to take a step back. :)  Make sense?

    Jim

Children
Related