<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>how to send and receive data using i2c and spi protocol</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/25612/how-to-send-and-receive-data-using-i2c-and-spi-protocol</link><description>hello there,
i want to send and receive data using spi and i2c protocol and i am using nrf51422 .how to interface which pins should i use to make spi and i2c communication. 
 good help appriciated!! 
 cheers,
Abhijeet</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 04 Oct 2017 13:14:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/25612/how-to-send-and-receive-data-using-i2c-and-spi-protocol" /><item><title>RE: how to send and receive data using i2c and spi protocol</title><link>https://devzone.nordicsemi.com/thread/100948?ContentTypeID=1</link><pubDate>Wed, 04 Oct 2017 13:14:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5833f0c9-8104-4eaa-81a5-348ad63aa2bd</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Please take a look at the MPU example and drivers on this &lt;a href="https://github.com/Martinsbl/nrf5-mpu-examples"&gt;Github page&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to send and receive data using i2c and spi protocol</title><link>https://devzone.nordicsemi.com/thread/100947?ContentTypeID=1</link><pubDate>Wed, 04 Oct 2017 13:10:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab92ce52-f46f-422a-b842-db48cbc27e42</guid><dc:creator>ASHISH</dc:creator><description>&lt;p&gt;Thanks for your reply!!!...i have already done the mpu 9250 programming with arduino. And i am famliiar with the mpu 9250 registor reading and writing. i am new to keil and i dont know how to code  mpu 9250 using i2c protocol with nrf51422. i have sample arduino code which i want to share with you
#include &amp;lt;Wire.h&amp;gt;&lt;/p&gt;
&lt;p&gt;long accelX, accelY, accelZ;
float gForceX, gForceY, gForceZ;&lt;/p&gt;
&lt;p&gt;long gyroX, gyroY, gyroZ;
float rotX, rotY, rotZ;&lt;/p&gt;
&lt;p&gt;void setup() {
Serial.begin(9600);
Wire.begin();
setupMPU();
}&lt;/p&gt;
&lt;p&gt;void loop() {
recordAccelRegisters();
/* if(accelX&amp;lt;=0)
{
accelX=accelX+accelX;
}
if(accelY&amp;lt;=0){
accelY=accelY+accelY;
}
if(accelZ&amp;lt;=0){
accelZ=accelZ+accelZ;
}*/
// recordGyroRegisters();
processAccelData();
printData();
delay(100);
}&lt;/p&gt;
&lt;p&gt;void setupMPU(){
Wire.beginTransmission(0b1101000); //This is the I2C address of the MPU (b1101000/b1101001 for AC0 low/high datasheet sec. 9.2)
Wire.write(0x6B); //Accessing the register 6B - Power Management 1 (Sec. 4.28)
Wire.write(0b00101000); //Setting SLEEP register to 0,cycle bit to 1 and disable temp  (Required; see Note on p. 9)
Wire.endTransmission();&lt;br /&gt;
/* Wire.write(0x6C); //Accessing the register 6c - Power Management 2 (Sec. 4.28)
Wire.beginTransmission(0b1101000);
Wire.write(0b00000111); //Setting STBY_XG,STBY_YG,STBY_ZG bits to 1 disable gyroscope (low power mode) (Required; see Note on p. 9)
Wire.endTransmission();*/
Wire.beginTransmission(0b1101000); //I2C address of the MPU
Wire.write(0x1B); //Accessing the register 1B - Gyroscope Configuration (Sec. 4.4)
Wire.write(0x00000000); //Setting the gyro to full scale +/- 250deg./s
Wire.endTransmission();
Wire.beginTransmission(0b1101000); //I2C address of the MPU
Wire.write(0x1C); //Accessing the register 1C - Acccelerometer Configuration (Sec. 4.5)
Wire.write(0b00000000); //Setting the accel to +/- 2g
Wire.endTransmission();
}&lt;/p&gt;
&lt;p&gt;void recordAccelRegisters() {
Wire.beginTransmission(0b1101000); //I2C address of the MPU
Wire.write(0x3B); //Starting register for Accel Readings
Wire.endTransmission();
Wire.requestFrom(0b1101000,6); //Request Accel Registers (3B - 40)
while(Wire.available() &amp;lt; 6);
accelX = Wire.read()&amp;lt;&amp;lt;8|Wire.read(); //Store first two bytes into accelX
accelY = Wire.read()&amp;lt;&amp;lt;8|Wire.read(); //Store middle two bytes into accelY
accelZ = Wire.read()&amp;lt;&amp;lt;8|Wire.read(); //Store last two bytes into accelZ&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;void processAccelData(){&lt;/p&gt;
&lt;p&gt;gForceX = accelX+32767 ;
gForceY = accelY+32767;
gForceZ = accelZ+32767;
}&lt;/p&gt;
&lt;p&gt;void recordGyroRegisters() {
Wire.beginTransmission(0b1101000); //I2C address of the MPU
Wire.write(0x43); //Starting register for Gyro Readings
Wire.endTransmission();
Wire.requestFrom(0b1101000,6); //Request Gyro Registers (43 - 48)
while(Wire.available() &amp;lt; 6);
gyroX = Wire.read()&amp;lt;&amp;lt;8|Wire.read(); //Store first two bytes into accelX
gyroY = Wire.read()&amp;lt;&amp;lt;8|Wire.read(); //Store middle two bytes into accelY
gyroZ = Wire.read()&amp;lt;&amp;lt;8|Wire.read(); //Store last two bytes into accelZ
processGyroData();
}&lt;/p&gt;
&lt;p&gt;void processGyroData() {
rotX = gyroX / 131.0;
rotY = gyroY / 131.0;
rotZ = gyroZ / 131.0;
}&lt;/p&gt;
&lt;p&gt;void printData() {
Serial.print(&amp;quot;Gyro (deg)&amp;quot;);
Serial.print(&amp;quot;X=&amp;quot;);
Serial.print(rotX);
Serial.print(&amp;quot;\t&amp;quot;);
Serial.print(&amp;quot;|Y=&amp;quot;);
Serial.print(rotY);
Serial.print(&amp;quot;\t&amp;quot;);
Serial.print(&amp;quot;|Z=&amp;quot;);
Serial.print(rotZ);
//Serial.print(&amp;quot;\t&amp;quot;);
Serial.print(&amp;quot;\n&amp;quot;);
//Serial.print(&amp;quot; Accel (g)&amp;quot;);
//Serial.print(&amp;quot;\n&amp;quot;);*/
Serial.print(&amp;quot;X=&amp;quot;);
Serial.print(gForceX);
//Serial.print(&amp;quot; &amp;quot;);
Serial.print(&amp;quot;\t&amp;quot;);
Serial.print(&amp;quot;|Y=&amp;quot;);
Serial.print(gForceY);
Serial.print(&amp;quot;\t&amp;quot;);
Serial.print(&amp;quot;|Z=&amp;quot;);
Serial.print(gForceZ );
Serial.print(&amp;quot;\n&amp;quot;);
delay(5000);
}&lt;/p&gt;
&lt;p&gt;i want to write code like this...could you send me the simple code like this using keil software ..As i have already gone through various  github example but didnt understand that much...
great help appreciated!!!
cheers,
Abhijeet Kapse&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to send and receive data using i2c and spi protocol</title><link>https://devzone.nordicsemi.com/thread/100946?ContentTypeID=1</link><pubDate>Mon, 02 Oct 2017 08:41:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:449f6c69-2855-40ad-a27f-f66bf623e6c6</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The nRF5x have flexible GPIO mapping, so all pins can be individually mapped to interface blocks for layout flexibility. You can therefore use any free GPIO pin you have on your board.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>