View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Aug 18, 2013 2:31 pm |
|
|
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
|
itg3200 i2c problem |
Posted: Sun Aug 18, 2013 2:39 pm |
|
|
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
|
|
|
Tom1234
Joined: 06 Jan 2013 Posts: 39
|
itg3200 i2c problem |
Posted: Sun Aug 18, 2013 3:55 pm |
|
|
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
|
|
Posted: Sun Aug 18, 2013 4:02 pm |
|
|
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
|
itg3200 i2c problem |
Posted: Sun Aug 18, 2013 4:05 pm |
|
|
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
|
|
Posted: Sun Aug 18, 2013 4:12 pm |
|
|
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
|
itg3200 i2c problem |
Posted: Sun Aug 18, 2013 4:27 pm |
|
|
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
|
|
Posted: Sun Aug 18, 2013 4:39 pm |
|
|
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
|
itg3200 i2c problem |
Posted: Sun Aug 18, 2013 4:51 pm |
|
|
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
|
itg3200 i2c problem |
Posted: Sun Aug 18, 2013 5:06 pm |
|
|
Do you see any problem with code or with connections? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Aug 18, 2013 5:30 pm |
|
|
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
|
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Sun Aug 18, 2013 6:52 pm |
|
|
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
|
itg3200 i2c problem |
Posted: Sun Aug 18, 2013 7:04 pm |
|
|
dyeatman, what do you mean? |
|
|
|