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

nRF9160 comunication not working with Arduino UNO I2C/TWI

I have been trying to get a arduino UNO and arduino Leonardo to communicate with the nRF9160DK but have not been able. That  accounts for the SPI example aswell as the I2C/TWI scanner example in both cases the Arduino's are used as Slave. I am quite new to this but unable to figure out why this all is not working. I have put my eyes on useing I2C because of mutible reasons so that is where this question will be about.

I am running the following slave example on the Arduino UNO

// Wire Slave Sender
// by Nicholas Zambetti <http://www.zambetti.com>

// Demonstrates use of the Wire library
// Sends data as an I2C/TWI slave device
// Refer to the "Wire Master Reader" example for use with this

// Created 29 March 2006

// This example code is in the public domain.


#include <Wire.h>

void setup() {
  Wire.begin(8);                // join i2c bus with address #8
  Wire.onRequest(requestEvent); // register event
  Wire.setClock(100000);
}

void loop() {
  delay(100);
}

// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent() {
  Wire.write("hello "); // respond with message of 6 bytes
  // as expected by master
}


As you can see I have added a maximum Clock speed of 100K since that is what the nRF9160 scanner also uses.

I have changed the config of the nRF9160 to be like this:

&i2c3 {
	status = "ok";
	sda-pin = < 31 >;
	scl-pin = < 30 >;
    clock-frequency = <I2C_BITRATE_STANDARD>;  
};



And have wired the arduino -> nrf9160dk the following 

A4 -> P0.31
A5 -> P.0.30

I have changed the pinouts from the normal one since on the normal basic pinouts it wasnt working either. Once both are running I dont recieve anything execpt the following:

Starting i2c scanner...Value of NRF_TWIM3_NS->PSEL.SCL: 30 Value of NRF_TWIM3_NS->PSEL.SDA: 31 Value of NRF_TWIM3_NS->FREQUENCY: 26738688 26738688 -> 100k


I would love the recieve some help on why I can't seem to get the nRF9160dk working with my arduino's.

Related