CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

itg3200 i2c problem
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 18, 2013 2:31 pm     Reply with quote

The center pad is the AD0 input to the itg3200. Connect it to ground.
Then the board should work.
Jim90



Joined: 27 Apr 2013
Posts: 55

View user's profile Send private message

itg3200 i2c problem
PostPosted: Sun Aug 18, 2013 2:39 pm     Reply with quote

Are you sure for this? (why you conclude that the center pad is the AD0).

I asked because the only way to connect the pad is to solder it (if we are wrong then i would not be able to fix it)
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 18, 2013 3:22 pm     Reply with quote

Go the the eBay link that he posted.
http://www.ebay.com/itm/ITG-3200-Triple-Axis-Digital-Output-Gyro-Sensor-PCB-/260778520666?pt=Radio_Control_Vehicles&hash=item3cb79c705a

Download the itg3200 datasheet. Go to page 5 and look at the pinout:
www.invensense.com/mems/gyro/documents/EB-ITG-3200-00-01.1.pdf

Look at the eBay photo. Notice the chip orienation dot in the upper left
corner. Look at the pinout diagram on page 5. They are oriented the
same way.

In the datasheet, note that the AD0 pin is the 3rd pin in from the bottom left.
Look at the photo. Notice that the 3rd pin in from the bottom left goes to
the center pad. Therefore, the ADO pin is on the center pad.

Quote:
I asked because the only way to connect the pad is to solder it (if
we are wrong then i would not be able to fix it)

Solder jumpers are common on some cheap boards. You fix it with solder
wick. Also called desoldering braid. It soaks up the solder.
Tom1234



Joined: 06 Jan 2013
Posts: 39

View user's profile Send private message

itg3200 i2c problem
PostPosted: Sun Aug 18, 2013 3:55 pm     Reply with quote

I connected the A0 to GND but I still receive only 00.


ACK addr: 00
ACK addr: 00
ACK addr: 00
ACK addr: 00
ACK addr: 00
ACK addr: 00
ACK addr: 00
ACK addr: 00
ACK addr: 00

(Just for clarification I removed the pull –up resistors and i connected the Vlogic to VDD )

Something else, at the back side of the board there is not any component connected but there are 2 pads(at the CLK pin. One them is connected with CLK pin).
I need to connect also these pads?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 18, 2013 4:02 pm     Reply with quote

The itg3200 data sheet says this:
Quote:
CLKIN - Optional external reference clock input. Connect to GND if unused.

But first use an ohmmeter to check if the CLKIN pin is floating or if it's
already connected to ground.
Tom1234



Joined: 06 Jan 2013
Posts: 39

View user's profile Send private message

itg3200 i2c problem
PostPosted: Sun Aug 18, 2013 4:05 pm     Reply with quote

ok I would connect the CLK pin to GND (but you didn't answer to connect the 2 pads together? )
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 18, 2013 4:12 pm     Reply with quote

I don't know. I don't have a schematic or a photo of the back side of the board.

You said:
Quote:
One them is connected with CLK pin

What is the other pad connected to ? Is it ground ? If so, then jumper
the two pads.
Tom1234



Joined: 06 Jan 2013
Posts: 39

View user's profile Send private message

itg3200 i2c problem
PostPosted: Sun Aug 18, 2013 4:27 pm     Reply with quote

Yes, 1 pad is connected to clk and the other to GND, so i jumper the 2 pads.

Unfortunately the results are the same. (I receive the same value (address) : 00).

Do you understand what is going wrong ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 18, 2013 4:39 pm     Reply with quote

Post your current test program (the i2c scanner program that you modified
for your PIC).

Post the full list of connections between your PIC board and the itg3200 board.
Tom1234



Joined: 06 Jan 2013
Posts: 39

View user's profile Send private message

itg3200 i2c problem
PostPosted: Sun Aug 18, 2013 4:51 pm     Reply with quote

I used the code :

Code:

#include <33fj64GP202.h>

// Device Specification
#FUSES NOPROTECT              //General Segment Code not Protected
#FUSES NOIESO                 //Internal External Switch Over mode disabled
#FUSES FRC                    //Internal RC at default frequency
#FUSES NOWDT                  //No Watch Dog Timer #use delay (clock=8000000)   // Use built-in function: delay_ms() & delay_us()
#use delay(clock=7.37MHz)     //default frequency for RC

#PIN_SELECT U1TX=PIN_B11
#PIN_SELECT U1RX=PIN_B10
#USE RS232(UART1,ERRORS,BAUD=9600)
/////////////////////////////////////////////////////////

#use i2c(Master, sda=PIN_B9, scl=PIN_B8)
// This function writes the slave address to the i2c bus.
// If a slave chip is at that address, it should respond to
// this with an "ACK".   This function returns TRUE if an
// ACK was found.  Otherwise it returns FALSE.
int8 get_ack_status(int8 address)
{
int8 status;

i2c_start();
status = i2c_write(address);  // Status = 0 if got an ACK
i2c_stop();

if(status == 0)
   return(TRUE);
else
   return(FALSE);
}


//=================================
void main()
{
int8 i;
int8 status;
int8 count = 0;

printf("\n\rStart:\n\r");

delay_ms(1000);

// Try all slave addresses from 0x10 to 0xEF.
// See if we get a response from any slaves
// that may be on the i2c bus.
for(i=0x10; i < 0xF0; i+=2)
   {
    status = get_ack_status(i);
    if(status == TRUE)
      {
       printf("ACK addr: %X\n\r", i);
       count++;
       delay_ms(2000);
      }
   }

if(count == 0)
   printf("\n\rNothing Found");
else
   printf("\n\rNumber of i2c chips found: %u", count);

while(1);
}



The connections between sensor to microcontroller are:

Sensor-Microcontroler

1)VDD
2)Vlogic->VDD
3)GND
4)INT
5)CLK->GND
6)SDA-> Pin18-B9(sda)
7)SCL-> Pin17-B8(scl)
Tom1234



Joined: 06 Jan 2013
Posts: 39

View user's profile Send private message

itg3200 i2c problem
PostPosted: Sun Aug 18, 2013 5:06 pm     Reply with quote

Do you see any problem with code or with connections?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 18, 2013 5:30 pm     Reply with quote

I don't have the PCD compiler, so I can't test the code. There is one
thing that is very strange:
Quote:

I connected the A0 to GND but I still receive only 00.

ACK addr: 00
ACK addr: 00

But the for() loop only can only count from 0x10 to 0xEF. The printf()
statement displays the value of 'i'. How can it ever show 00 ?
Code:

for(i=0x10; i < 0xF0; i+=2)
   {
    status = get_ack_status(i);
    if(status == TRUE)
      {
       printf("ACK addr: %X\n\r", i);
       count++;
       delay_ms(2000);
      }
   }

There is one other case of this that I can find. It's in this thread:
http://www.ccsinfo.com/forum/viewtopic.php?p=170553
Again, he is using the PCD compiler with a dsPIC33.

Since I don't have that compiler, I don't see how I can solve the problem.
I'm not sure if I can.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 18, 2013 6:13 pm     Reply with quote

Here is a thread about printf doing weird things with the dsPIC33 compiler:
http://www.ccsinfo.com/forum/viewtopic.php?t=50919

What's your compiler version ? The version is a 4 digit number in this
format: x.xxx
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Sun Aug 18, 2013 6:52 pm     Reply with quote

I wonder what happens if the format specifier is changed?
_________________
Google and Forum Search are some of your best tools!!!!
Tom1234



Joined: 06 Jan 2013
Posts: 39

View user's profile Send private message

itg3200 i2c problem
PostPosted: Sun Aug 18, 2013 7:04 pm     Reply with quote

dyeatman, what do you mean?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group