Problem with MINIMU-9 v2 gyro

Hello everyone,
I have a problem with I2c communication in DSPIC33F. I am using DSPIC 33F as my master and pololu MinIMU 9 v2 as my slave.
pololu.com/catalog/product/1268 this is the information regarding my slave. It consists of three devices and my slave exactly is L3GD20 3-axis gyroscope
The problem is when I try to observe the readings of slave, I could see only the slave address repeatedly( I m viewing it on CRO).Except that I could not see anything else on CRO.
I m posting my program here.

#include "p33Fxxxx.h" 
  
#include <p33FJ64MC802.h> 
#include <i2c.h> 
#include <String.h> 
  
// calculate baud rate of I2C 
#define Fosc (8000000) 
#define Fcy (Fosc/2) // no PLL 
#define Fsck 100000 
#define I2C_BRG 0x188  //((Fcy/2/Fsck)-1) 
#define I2C_ON  0x8000 
  
void readFloat(float *ptr); 
  
unsigned char SlaveAddress_read; 
unsigned char SlaveAddress_write; 
  
  
int main (void) 
{ 
float value = 0; 
float temp; 
  
I2C1CONbits.A10M = 0; 
  
char status; 
unsigned char i2cbyte; 
  
//Enable channel 
OpenI2C1( I2C_ON, I2C_BRG ); 
TRSTAT=1; 
  
SlaveAddress_read = 0b11010111; 
SlaveAddress_write = 0b11010110; 
  
while (1) 
{ 
readFloat(&value); 
} 
  
return 0; 
} 
  
void readFloat(float *ptr) 
{ 
unsigned char rx_data[6]; 
  
I2C1CONbits.SEN = 1; 
while(I2C1CONbits.SEN); 
  
MasterWriteI2C1(SlaveAddress_write); 
while (I2C1STATbits.ACKSTAT);//Return Ack Status 
  
MasterWriteI2C1(0b10101000); 
while (I2C1STATbits.ACKSTAT);//Return Ack Status 
  
I2C1CONbits.RSEN = 1; 
MasterWriteI2C1(SlaveAddress_read); 
while (I2C1STATbits.ACKSTAT);//Return Ack Status 
  
rx_data[0] = MasterReadI2C1(); 
I2C1CONbits.ACKDT=0;            // Set for ACk 
I2C1CONbits.ACKEN=1;            // Send Ack 
while(I2C1CONbits.ACKEN);   // wait for ACK to complete 
  
rx_data[1] = MasterReadI2C1(); 
I2C1CONbits.ACKDT=0;            // Set for ACk 
I2C1CONbits.ACKEN=1;            // Send Ack 
while(I2C1CONbits.ACKEN);   // wait for ACK to complete 
  
rx_data[2] = MasterReadI2C1(); 
I2C1CONbits.ACKDT=0;            // Set for ACk 
I2C1CONbits.ACKEN=1;            // Send Ack 
while(I2C1CONbits.ACKEN);   // wait for ACK to complete 
  
rx_data[3] = MasterReadI2C1(); 
I2C1CONbits.ACKDT=0;            // Set for ACk 
I2C1CONbits.ACKEN=1;            // Send Ack 
while(I2C1CONbits.ACKEN);   // wait for ACK to complete 
  
rx_data[4] = MasterReadI2C1(); 
I2C1CONbits.ACKDT=0;            // Set for ACk 
I2C1CONbits.ACKEN=1;            // Send Ack 
while(I2C1CONbits.ACKEN);   // wait for ACK to complete 
  
rx_data[5] = MasterReadI2C1(); 
I2C1CONbits.ACKDT=1;            // Set for NotACk 
I2C1CONbits.ACKEN=1;            // Send Nack 
while(I2C1CONbits.ACKEN);   // wait for ACK to complete 
I2C1CONbits.ACKDT=0; 
  
StopI2C1(); //Send the Stop condition 
IdleI2C1(); //Wait to complete 
  
memcpy(ptr, &rx_data, 6); 
}

Actually I found the problem that slave is not sending the acknowledgement to proceed on to next step. Hence the bus is getting busy only by the slave address microcontroller is sending. Is this something related to Hardware?
I connected both the devices (dspic33f and gyro) to a common power supply of 3.3v(through PC USB port). I took pull up of 4.7 k . I gave power supply to Vin of gyro rather than to Vdd. If something is wrong please let me know.
I have been working on it since a month but could not fix the problem. If there is any problem with the code or problem regarding the slave(gyro) please help me,it’s extremely urgent.
Thankyou.

Hello.

You probably do not need to use a pull-up on the I2C lines because the MinIMU does that for you. Do the PIC and the MinIMU-9 v2 share a common ground? What frequency are you clocking your I2C bus at? Can you start with a simpler request, like reading the WHO_AM_I register? We are not familiar with PIC-based I2C code; has the I2C code you are using worked for other devices?

- Ryan

Hello Ryan,
The PIC and MinIMU-9 v2 has the common ground. We are clocking our I2C bus at 100khz. In order to read the register first , the slave should give the acknowledgement, we are not at all receiving any acknowledgement. Even we are new to the I2C .
Thank You

Unfortunately, we don’t immediately see anything wrong with what you are doing. Can you send us a picture of your connections and your soldering? Where can we find a copy of the I2C library you are using and its documentation? Did you base your code off of some example somewhere?

- Ryan

Hello,
Sorry for the late reply.Here I am attaching the connections of our pic and the pdf about our I2C commuincation. And I also attached the dspic33f schematic diagram.
Thank You



70195C.pdf (764 KB)

I don’t see anything wrong with your electrical connections to the MinIMU-9, though you do not need the pull-up resistors because they are already part of the MinIMU-9 board (see the schematic diagram on the product page for more details).

The I2C PDF you included looks like it describes the lower-level I2C registers, but your code is using some higher-level library. Can you provide the documentation for that library or the source code of it?

- Ryan