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

How to implement I2C

Hi, I'm looking for a simple example on how to implement I2C. I've built I2C on my various FPGA's, implemented I2C on various AVR based chips from special function registers. However, I can't seem to find any documentation on how to write to the nRF9160's special function registers or use the I2C library for the nRF9160. 

A simple example where I can set the clock speed and the address would be incredible.

Thanks

Parents Reply
  • Thanks for responding. When I ran build for the example BH1749 I got the following error. My steps were to copy the whole BH1749 folder from the git repo, into my sensors folder (as it's own folder), then I opened it file -> open nRF, and clicked build. 



    Going through the other examples from other posts I tried the finished "working" example at the end of this post https://devzone.nordicsemi.com/f/nordic-q-a/45265/trouble-twi-i2c-stops-at-the-function-of-i2c_reg_read_byte-on-nrf9160-dk-why, but I got a different error. 



    In both cases I used the respective .conf, .overlay, and CMakeLists file provided. I have gotten many other projects to load and flash on my nRF9160. So far all of the ones in basic have worked, the I2C scanner also has ran, but it doesn't seem to get past the i2c_dev = device_get_binding(I2C_DEV); line. It so far has always printed to the terminal "I2C: Device driver not found.". 

    Again, thanks for the help :)
    I'm slowly figuring this out so I can start hooking up I2C sensors that aren't included in the samples. 

Children
Related