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

I2C/TWI slave with nRF51822

Hi

I need to implement I2C slave side (up to 100kBit/s) on a nRF51822 chip. As far as i see the inegrated TWI peripherial only supportes the master side. Any ideas how to do it? The following ways came to my mind, but all seam not the way to go.

Software I2C There are some code segments around to implement a software I2C solution by bitbanging. These solutions often are unstable and probably not fast enough to reach 100kBit/s. Additionally it may be a problem to run it beside the active S110 softdevice, because the softdevice may block the CPU in low stack for multiple milliseconds.

External Peripherial Another possible way is to use an external chip to do the I2C, but to be honest i didn't find a simple solution there. The only way to do it this way is the connect a PIC or something similar to the Nordic and implement the I2C on the PIC. The Nordic could communicate with the PIC over UART or SPI. Are the fix programmed chips that can be used as external peripherial?

Any other thought about this?

Regards Adrian

  • We have used a chip of type "SC18IS602B I2C-bus to SPI bridge" that seems to work, although we used it with an atmel atmega32u4. But there's no reason it wouldn't work with nRF51822, too. However, it's not very simple to use in case you want to read data from the slave. Doable, but requires a bit patience to get everything working.

    Regards,

    Jarmo Nikula iProtoXi Oy

  • Thank you for this answer. I guess this will work with the nRF51822. I'll have a closer look to the NXP chip.

  • Hi, I'm in the same context, i want to create an I2C library. Please, help me to prepare this project and how i add the includes for so that the compilation works well Thanks

  • Yesterday I set up nRF51822 Evaluation Board to become I2C-master and to connect to some I2C-devices, and it seems to work. I just needed four wires from the board's pins to connect to I2C devices (GND, Vcc, SCL and SDA). The code I used was from Nordic's example, twi_hw_master.c or something like that.

    However, we would also need to have I2C-slave there because the system connects to another system as a slave while being master for the another part. I am thinking if SPI-slave could somehow be tricked to become I2C-slave, or would there be any efficient way to do it in software (interrupts?).

    The bridge chip I mentioned is one possible solution, but not an optimal one.

  • It apears that the bridge chip is the only real way to do. The software I2C can't be done with a parallel working softdevice. I agree it would be better to have an integrated way to do. Maybe a point for the wishlist for the next gen chip from Nordic?

Related