EmbeddedRelated.com
Forums
Memfault Beyond the Launch

I2C very fundamental problem

Started by msp430pat January 29, 2007
Hello,
I'm trying to interface a mini cmos camera(C3188A) to a MSP430F169
from I2C bus. However I have some problems. First of all, I have
written the code below to initialize I2C bus(I'm using Crossworks 1.4):

WDTCTL = WDTPW + WDTHOLD;
P3SEL |= 0x0A;
U0CTL |= I2C + SYNC;
U0CTL &= ~I2CEN;

U0CTL |= MST;
I2CTCTL |= I2CSSEL1 + I2CTRX;
I2CNDAT = 0x03;
I2CSA = 0x0003; // Slave Address is 011h
I2CIE = TXRDYIE;
U0CTL |= I2CEN;
_EINT();

My camera has three chip select pins and are configured as <011>. I
have a question in that point, in application report SLAA208, it says
that slave address should be configured as 1010xxx where xxx is the
chip select configuration. The bits 1010 are fixed. Is this
configuration mandatory for all 3 chip select slave devices or only
for the EEPROM mentioned in the application note? Because in the user
manual it doesn't mention about such a necessity(the fixed address
part, 1010). In the same application report(Slaa208) it also mentions
about the usage of I2CSA register. It writes that when the START
condition is generated, contents of I2CSA is automatically sent with
shifting one bit to the left and placing direction bit to the LSB. So
we don't need to send the first address byte manually? If so, is this
automatically sent address byte(is this called COMMAND byte?) counted
as one for the I2CNDAT register? Or does I2CNDAT just count the data
bytes that we send?
After the initialization procedure I initiate a transfer as below:

I2CTCTL |= I2CSTT + I2CSTP; // send start condition

while((I2CIFG & TXRDYIFG) == 0); //wait for transmit to be ready
I2CDRB = 0x4E;//code[0]; //send write command to camera

while((I2CIFG & TXRDYIFG) == 0);
I2CDRB = 0x13;//code[1]; //target register's offset

while((I2CIFG & TXRDYIFG) == 0); //execution halts here
I2CDRB = 0x21;//code[1];

When execution comes to transmit the third data byte, it halts in the
final while loop(regardless of the value of I2CNDAT). It seems the bus
never gets ready to transmit data for the third time. However there
are some wierd problems. When I check I2CTCTL register, the I2CSTT bit
is not cleared after start condition. I2CSTP bit is also not cleared
any time. I2CTCTL register remains constant. Moreover after start
condition is sent, I2CBUSY bit is set(as expected) but I2CBB bit never
gets set. It seems something is going wrong in my initialization
procedure but I couldn't figure out where the problem is. I have
checked the manual many times but couldn't find solution to my
problem. Could anyone please help me figure out what the problem is?

Thanks,

Taskin Baltaci

Beginning Microcontrollers with the MSP430

> Or does I2CNDAT just count the data bytes that we send?

Yes, do not include command byte.
Your problem might be that you set MSP430 as a Master too early :
Execute this line only when you start transmitting, NOT at init :

U0CTL |= MST;

Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of msp430pat
Sent: Monday, 29 January 2007 7:33 PM
To: m...
Subject: [msp430] I2C very fundamental problem

Hello,
I'm trying to interface a mini cmos camera(C3188A) to a MSP430F169
from I2C bus. However I have some problems. First of all, I have
written the code below to initialize I2C bus(I'm using Crossworks 1.4):

WDTCTL = WDTPW + WDTHOLD;
P3SEL |= 0x0A;
U0CTL |= I2C + SYNC;
U0CTL &= ~I2CEN;

U0CTL |= MST;
I2CTCTL |= I2CSSEL1 + I2CTRX;
I2CNDAT = 0x03;
I2CSA = 0x0003; // Slave Address is 011h
I2CIE = TXRDYIE;
U0CTL |= I2CEN;
_EINT();

My camera has three chip select pins and are configured as <011>. I
have a question in that point, in application report SLAA208, it says
that slave address should be configured as 1010xxx where xxx is the
chip select configuration. The bits 1010 are fixed. Is this
configuration mandatory for all 3 chip select slave devices or only
for the EEPROM mentioned in the application note? Because in the user
manual it doesn't mention about such a necessity(the fixed address
part, 1010). In the same application report(Slaa208) it also mentions
about the usage of I2CSA register. It writes that when the START
condition is generated, contents of I2CSA is automatically sent with
shifting one bit to the left and placing direction bit to the LSB. So
we don't need to send the first address byte manually? If so, is this
automatically sent address byte(is this called COMMAND byte?) counted
as one for the I2CNDAT register? Or does I2CNDAT just count the data
bytes that we send?
After the initialization procedure I initiate a transfer as below:

I2CTCTL |= I2CSTT + I2CSTP; // send start condition

while((I2CIFG & TXRDYIFG) == 0); //wait for transmit to be ready
I2CDRB = 0x4E;//code[0]; //send write command to camera

while((I2CIFG & TXRDYIFG) == 0);
I2CDRB = 0x13;//code[1]; //target register's offset

while((I2CIFG & TXRDYIFG) == 0); //execution halts here
I2CDRB = 0x21;//code[1];

When execution comes to transmit the third data byte, it halts in the
final while loop(regardless of the value of I2CNDAT). It seems the bus
never gets ready to transmit data for the third time. However there
are some wierd problems. When I check I2CTCTL register, the I2CSTT bit
is not cleared after start condition. I2CSTP bit is also not cleared
any time. I2CTCTL register remains constant. Moreover after start
condition is sent, I2CBUSY bit is set(as expected) but I2CBB bit never
gets set. It seems something is going wrong in my initialization
procedure but I couldn't figure out where the problem is. I have
checked the manual many times but couldn't find solution to my
problem. Could anyone please help me figure out what the problem is?

Thanks,

Taskin Baltaci

Yahoo! Groups Links
Hello Kris,

I have tried your advice but it didn't work. I'm checking the voltage levels with an oscilloscope, both scl and sda, but they are both at about +-80mV. However MSP430 works at 3.3 V and my camera at 5 V so shoudn't it be at about 2.3V (0.7 Vcc)for high signal? By the way, I have connected two 10kOhm resistors to the bus. I have connected them between Vcc and SCL/SDA lines of the camera then connected to I2C bus of the MCU. Is there anything wrong with it(figure is below)? I have just one I2C peripheral.

------------------------- Vcc(3.3V)
| |
_____ 10K 10K
| | Camera | |
| | | |
|____| | |
| |________________| |
| | |
|__|______________________|
| |
| |______________________________________SCL
|
|_________________________________________SDA

Sorry for the poor drawing, just to visualize how I connected the resistors.

Thanks,

Taskin

Microbit wrote: > Or does I2CNDAT just count the data bytes that we send?

Yes, do not include command byte.
Your problem might be that you set MSP430 as a Master too early :
Execute this line only when you start transmitting, NOT at init :

U0CTL |= MST;

Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of msp430pat
Sent: Monday, 29 January 2007 7:33 PM
To: m...
Subject: [msp430] I2C very fundamental problem

Hello,
I'm trying to interface a mini cmos camera(C3188A) to a MSP430F169
from I2C bus. However I have some problems. First of all, I have
written the code below to initialize I2C bus(I'm using Crossworks 1.4):

WDTCTL = WDTPW + WDTHOLD;
P3SEL |= 0x0A;
U0CTL |= I2C + SYNC;
U0CTL &= ~I2CEN;

U0CTL |= MST;
I2CTCTL |= I2CSSEL1 + I2CTRX;
I2CNDAT = 0x03;
I2CSA = 0x0003; // Slave Address is 011h
I2CIE = TXRDYIE;
U0CTL |= I2CEN;
_EINT();

My camera has three chip select pins and are configured as <011>. I
have a question in that point, in application report SLAA208, it says
that slave address should be configured as 1010xxx where xxx is the
chip select configuration. The bits 1010 are fixed. Is this
configuration mandatory for all 3 chip select slave devices or only
for the EEPROM mentioned in the application note? Because in the user
manual it doesn't mention about such a necessity(the fixed address
part, 1010). In the same application report(Slaa208) it also mentions
about the usage of I2CSA register. It writes that when the START
condition is generated, contents of I2CSA is automatically sent with
shifting one bit to the left and placing direction bit to the LSB. So
we don't need to send the first address byte manually? If so, is this
automatically sent address byte(is this called COMMAND byte?) counted
as one for the I2CNDAT register? Or does I2CNDAT just count the data
bytes that we send?
After the initialization procedure I initiate a transfer as below:

I2CTCTL |= I2CSTT + I2CSTP; // send start condition

while((I2CIFG & TXRDYIFG) == 0); //wait for transmit to be ready
I2CDRB = 0x4E;//code[0]; //send write command to camera

while((I2CIFG & TXRDYIFG) == 0);
I2CDRB = 0x13;//code[1]; //target register's offset

while((I2CIFG & TXRDYIFG) == 0); //execution halts here
I2CDRB = 0x21;//code[1];

When execution comes to transmit the third data byte, it halts in the
final while loop(regardless of the value of I2CNDAT). It seems the bus
never gets ready to transmit data for the third time. However there
are some wierd problems. When I check I2CTCTL register, the I2CSTT bit
is not cleared after start condition. I2CSTP bit is also not cleared
any time. I2CTCTL register remains constant. Moreover after start
condition is sent, I2CBUSY bit is set(as expected) but I2CBB bit never
gets set. It seems something is going wrong in my initialization
procedure but I couldn't figure out where the problem is. I have
checked the manual many times but couldn't find solution to my
problem. Could anyone please help me figure out what the problem is?

Thanks,

Taskin Baltaci

Yahoo! Groups Links

---------------------------------
Access over 1 million songs - Yahoo! Music Unlimited.
I2C peripheral uses open drain for scl and sda, so yes, you MUST use pull up resistors if you use
the I2C of the USART.
If it still doesn't work, I'll have to have a closer look at your code...

Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of Taskin -
Sent: Tuesday, 30 January 2007 8:09 PM
To: m...
Subject: RE: [msp430] I2C very fundamental problem

Hello Kris,

I have tried your advice but it didn't work. I'm checking the voltage levels with an oscilloscope,
both scl and sda, but they are both at about +-80mV. However MSP430 works at 3.3 V and my camera
at 5 V so shoudn't it be at about 2.3V (0.7 Vcc)for high signal? By the way, I have connected two
10kOhm resistors to the bus. I have connected them between Vcc and SCL/SDA lines of the camera
then connected to I2C bus of the MCU. Is there anything wrong with it(figure is below)? I have
just one I2C peripheral.

------------------------- Vcc(3.3V)
| |
_____ 10K 10K
| | Camera | |
| | | |
|____| | |
| |________________| |
| | |
|__|______________________|
| |
| |______________________________________SCL
|
|_________________________________________SDA

Sorry for the poor drawing, just to visualize how I connected the resistors.

Thanks,

Taskin

Microbit wrote: > Or does I2CNDAT just
count the data bytes that we send?

Yes, do not include command byte.
Your problem might be that you set MSP430 as a Master too early :
Execute this line only when you start transmitting, NOT at init :

U0CTL |= MST;

Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of msp430pat
Sent: Monday, 29 January 2007 7:33 PM
To: m...
Subject: [msp430] I2C very fundamental problem

Hello,
I'm trying to interface a mini cmos camera(C3188A) to a MSP430F169
from I2C bus. However I have some problems. First of all, I have
written the code below to initialize I2C bus(I'm using Crossworks 1.4):

WDTCTL = WDTPW + WDTHOLD;
P3SEL |= 0x0A;
U0CTL |= I2C + SYNC;
U0CTL &= ~I2CEN;

U0CTL |= MST;
I2CTCTL |= I2CSSEL1 + I2CTRX;
I2CNDAT = 0x03;
I2CSA = 0x0003; // Slave Address is 011h
I2CIE = TXRDYIE;
U0CTL |= I2CEN;
_EINT();

My camera has three chip select pins and are configured as <011>. I
have a question in that point, in application report SLAA208, it says
that slave address should be configured as 1010xxx where xxx is the
chip select configuration. The bits 1010 are fixed. Is this
configuration mandatory for all 3 chip select slave devices or only
for the EEPROM mentioned in the application note? Because in the user
manual it doesn't mention about such a necessity(the fixed address
part, 1010). In the same application report(Slaa208) it also mentions
about the usage of I2CSA register. It writes that when the START
condition is generated, contents of I2CSA is automatically sent with
shifting one bit to the left and placing direction bit to the LSB. So
we don't need to send the first address byte manually? If so, is this
automatically sent address byte(is this called COMMAND byte?) counted
as one for the I2CNDAT register? Or does I2CNDAT just count the data
bytes that we send?
After the initialization procedure I initiate a transfer as below:

I2CTCTL |= I2CSTT + I2CSTP; // send start condition

while((I2CIFG & TXRDYIFG) == 0); //wait for transmit to be ready
I2CDRB = 0x4E;//code[0]; //send write command to camera

while((I2CIFG & TXRDYIFG) == 0);
I2CDRB = 0x13;//code[1]; //target register's offset

while((I2CIFG & TXRDYIFG) == 0); //execution halts here
I2CDRB = 0x21;//code[1];

When execution comes to transmit the third data byte, it halts in the
final while loop(regardless of the value of I2CNDAT). It seems the bus
never gets ready to transmit data for the third time. However there
are some wierd problems. When I check I2CTCTL register, the I2CSTT bit
is not cleared after start condition. I2CSTP bit is also not cleared
any time. I2CTCTL register remains constant. Moreover after start
condition is sent, I2CBUSY bit is set(as expected) but I2CBB bit never
gets set. It seems something is going wrong in my initialization
procedure but I couldn't figure out where the problem is. I have
checked the manual many times but couldn't find solution to my
problem. Could anyone please help me figure out what the problem is?

Thanks,

Taskin Baltaci

Yahoo! Groups Links

---------------------------------
Access over 1 million songs - Yahoo! Music Unlimited.



Yahoo! Groups Links
It also seems your Slave address is wrong :

I2CSA = 0x0003; // Slave Address is 011h

Look at the bit fields :

> that slave address should be configured as 1010xxx where xxx is the
> chip select configuration. The bits 1010 are fixed. Is this

1010xxx + slave address 011 = 1010011 => 0x53 (not 0x03) !!!
I'm not sure whether this is the right Slave address for our particular app though...

You're probably not getting ACKs from the slave because the address is wrong.
Also, don't forget to set the R/W bit to 1/0 according to Read or Write...

Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of Taskin -
Sent: Tuesday, 30 January 2007 8:09 PM
To: m...
Subject: RE: [msp430] I2C very fundamental problem

Hello Kris,

I have tried your advice but it didn't work. I'm checking the voltage levels with an oscilloscope,
both scl and sda, but they are both at about +-80mV. However MSP430 works at 3.3 V and my camera
at 5 V so shoudn't it be at about 2.3V (0.7 Vcc)for high signal? By the way, I have connected two
10kOhm resistors to the bus. I have connected them between Vcc and SCL/SDA lines of the camera
then connected to I2C bus of the MCU. Is there anything wrong with it(figure is below)? I have
just one I2C peripheral.

------------------------- Vcc(3.3V)
| |
_____ 10K 10K
| | Camera | |
| | | |
|____| | |
| |________________| |
| | |
|__|______________________|
| |
| |______________________________________SCL
|
|_________________________________________SDA

Sorry for the poor drawing, just to visualize how I connected the resistors.

Thanks,

Taskin

Microbit wrote: > Or does I2CNDAT just
count the data bytes that we send?

Yes, do not include command byte.
Your problem might be that you set MSP430 as a Master too early :
Execute this line only when you start transmitting, NOT at init :

U0CTL |= MST;

Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of msp430pat
Sent: Monday, 29 January 2007 7:33 PM
To: m...
Subject: [msp430] I2C very fundamental problem

Hello,
I'm trying to interface a mini cmos camera(C3188A) to a MSP430F169
from I2C bus. However I have some problems. First of all, I have
written the code below to initialize I2C bus(I'm using Crossworks 1.4):

WDTCTL = WDTPW + WDTHOLD;
P3SEL |= 0x0A;
U0CTL |= I2C + SYNC;
U0CTL &= ~I2CEN;

U0CTL |= MST;
I2CTCTL |= I2CSSEL1 + I2CTRX;
I2CNDAT = 0x03;
I2CSA = 0x0003; // Slave Address is 011h
I2CIE = TXRDYIE;
U0CTL |= I2CEN;
_EINT();

My camera has three chip select pins and are configured as <011>. I
have a question in that point, in application report SLAA208, it says
that slave address should be configured as 1010xxx where xxx is the
chip select configuration. The bits 1010 are fixed. Is this
configuration mandatory for all 3 chip select slave devices or only
for the EEPROM mentioned in the application note? Because in the user
manual it doesn't mention about such a necessity(the fixed address
part, 1010). In the same application report(Slaa208) it also mentions
about the usage of I2CSA register. It writes that when the START
condition is generated, contents of I2CSA is automatically sent with
shifting one bit to the left and placing direction bit to the LSB. So
we don't need to send the first address byte manually? If so, is this
automatically sent address byte(is this called COMMAND byte?) counted
as one for the I2CNDAT register? Or does I2CNDAT just count the data
bytes that we send?
After the initialization procedure I initiate a transfer as below:

I2CTCTL |= I2CSTT + I2CSTP; // send start condition

while((I2CIFG & TXRDYIFG) == 0); //wait for transmit to be ready
I2CDRB = 0x4E;//code[0]; //send write command to camera

while((I2CIFG & TXRDYIFG) == 0);
I2CDRB = 0x13;//code[1]; //target register's offset

while((I2CIFG & TXRDYIFG) == 0); //execution halts here
I2CDRB = 0x21;//code[1];

When execution comes to transmit the third data byte, it halts in the
final while loop(regardless of the value of I2CNDAT). It seems the bus
never gets ready to transmit data for the third time. However there
are some wierd problems. When I check I2CTCTL register, the I2CSTT bit
is not cleared after start condition. I2CSTP bit is also not cleared
any time. I2CTCTL register remains constant. Moreover after start
condition is sent, I2CBUSY bit is set(as expected) but I2CBB bit never
gets set. It seems something is going wrong in my initialization
procedure but I couldn't figure out where the problem is. I have
checked the manual many times but couldn't find solution to my
problem. Could anyone please help me figure out what the problem is?

Thanks,

Taskin Baltaci

Yahoo! Groups Links

---------------------------------
Access over 1 million songs - Yahoo! Music Unlimited.



Yahoo! Groups Links
Hello Kris,

I have corrected my slave address to 0x53 but it didn't work again. It really seems as if the Master do not get an ACK. But what is wrong with my slave address? My camera is configured as . In SLAA208 it mentions about that 1010xxx address format but is it only used for EEPROMS or is it a general slave address format I don't know. But according to my chipselects above shouldn't my slave address be either 0x03 or 0x53? Both of them didn't work.

Thanks for your help,

Microbit wrote: It also seems your Slave address is wrong :

I2CSA = 0x0003; // Slave Address is 011h

Look at the bit fields :

> that slave address should be configured as 1010xxx where xxx is the
> chip select configuration. The bits 1010 are fixed. Is this

1010xxx + slave address 011 = 1010011 => 0x53 (not 0x03) !!!
I'm not sure whether this is the right Slave address for our particular app though...

You're probably not getting ACKs from the slave because the address is wrong.
Also, don't forget to set the R/W bit to 1/0 according to Read or Write...

Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of Taskin -
Sent: Tuesday, 30 January 2007 8:09 PM
To: m...
Subject: RE: [msp430] I2C very fundamental problem

Hello Kris,

I have tried your advice but it didn't work. I'm checking the voltage levels with an oscilloscope,
both scl and sda, but they are both at about +-80mV. However MSP430 works at 3.3 V and my camera
at 5 V so shoudn't it be at about 2.3V (0.7 Vcc)for high signal? By the way, I have connected two
10kOhm resistors to the bus. I have connected them between Vcc and SCL/SDA lines of the camera
then connected to I2C bus of the MCU. Is there anything wrong with it(figure is below)? I have
just one I2C peripheral.

---------------------- Vcc(3.3V)
| |
_____ 10K 10K
| | Camera | |
| | | |
|____| | |
| |________________| |
| | |
|__|______________________|
| |
| |______________________________________SCL
|
|_________________________________________SDA

Sorry for the poor drawing, just to visualize how I connected the resistors.

Thanks,

Taskin

Microbit wrote: > Or does I2CNDAT just
count the data bytes that we send?

Yes, do not include command byte.
Your problem might be that you set MSP430 as a Master too early :
Execute this line only when you start transmitting, NOT at init :

U0CTL |= MST;

Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of msp430pat
Sent: Monday, 29 January 2007 7:33 PM
To: m...
Subject: [msp430] I2C very fundamental problem

Hello,
I'm trying to interface a mini cmos camera(C3188A) to a MSP430F169
from I2C bus. However I have some problems. First of all, I have
written the code below to initialize I2C bus(I'm using Crossworks 1.4):

WDTCTL = WDTPW + WDTHOLD;
P3SEL |= 0x0A;
U0CTL |= I2C + SYNC;
U0CTL &= ~I2CEN;

U0CTL |= MST;
I2CTCTL |= I2CSSEL1 + I2CTRX;
I2CNDAT = 0x03;
I2CSA = 0x0003; // Slave Address is 011h
I2CIE = TXRDYIE;
U0CTL |= I2CEN;
_EINT();

My camera has three chip select pins and are configured as <011>. I
have a question in that point, in application report SLAA208, it says
that slave address should be configured as 1010xxx where xxx is the
chip select configuration. The bits 1010 are fixed. Is this
configuration mandatory for all 3 chip select slave devices or only
for the EEPROM mentioned in the application note? Because in the user
manual it doesn't mention about such a necessity(the fixed address
part, 1010). In the same application report(Slaa208) it also mentions
about the usage of I2CSA register. It writes that when the START
condition is generated, contents of I2CSA is automatically sent with
shifting one bit to the left and placing direction bit to the LSB. So
we don't need to send the first address byte manually? If so, is this
automatically sent address byte(is this called COMMAND byte?) counted
as one for the I2CNDAT register? Or does I2CNDAT just count the data
bytes that we send?
After the initialization procedure I initiate a transfer as below:

I2CTCTL |= I2CSTT + I2CSTP; // send start condition

while((I2CIFG & TXRDYIFG) == 0); //wait for transmit to be ready
I2CDRB = 0x4E;//code[0]; //send write command to camera

while((I2CIFG & TXRDYIFG) == 0);
I2CDRB = 0x13;//code[1]; //target register's offset

while((I2CIFG & TXRDYIFG) == 0); //execution halts here
I2CDRB = 0x21;//code[1];

When execution comes to transmit the third data byte, it halts in the
final while loop(regardless of the value of I2CNDAT). It seems the bus
never gets ready to transmit data for the third time. However there
are some wierd problems. When I check I2CTCTL register, the I2CSTT bit
is not cleared after start condition. I2CSTP bit is also not cleared
any time. I2CTCTL register remains constant. Moreover after start
condition is sent, I2CBUSY bit is set(as expected) but I2CBB bit never
gets set. It seems something is going wrong in my initialization
procedure but I couldn't figure out where the problem is. I have
checked the manual many times but couldn't find solution to my
problem. Could anyone please help me figure out what the problem is?

Thanks,

Taskin Baltaci

Yahoo! Groups Links

---------------------------------
Access over 1 million songs - Yahoo! Music Unlimited.



Yahoo! Groups Links

---------------------------------
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
Hi Taskin,

You need read the device datasheet (C3188A). On page 27,
"0.11 SCCB Register Sets". You have tree pins to configure
address, CS[2..0], and they are multiplexed with Y signals.
These signals are latched at power-on or reset.
The default configuration (by internal pull-down) is low.
Thus, the write address is 42H and the read address is 43H
(see "Table 1.10: Slave ID" on page 27).
-Paulo.

> -----Mensagem original-----
> De: m... [mailto:m...] Em nome de
> Taskin -
> Enviada em: quarta-feira, 31 de janeiro de 2007 05:44
> Para: m...
> Assunto: RE: [msp430] I2C very fundamental problem
>
> Hello Kris,
>
> I have corrected my slave address to 0x53 but it didn't work again. It
> really seems as if the Master do not get an ACK. But what is wrong with my
> slave address? My camera is configured as . In SLAA208
> it mentions about that 1010xxx address format but is it only used for
> EEPROMS or is it a general slave address format I don't know. But
> according to my chipselects above shouldn't my slave address be either
> 0x03 or 0x53? Both of them didn't work.
>
> Thanks for your help,
>
> Microbit wrote:
> It also seems your Slave address is wrong :
>
> I2CSA = 0x0003; // Slave Address is 011h
>
> Look at the bit fields :
>
> > that slave address should be configured as 1010xxx where xxx is the
> > chip select configuration. The bits 1010 are fixed. Is this
>
> 1010xxx + slave address 011 = 1010011 => 0x53 (not 0x03) !!!
> I'm not sure whether this is the right Slave address for our particular
> app though...
>
> You're probably not getting ACKs from the slave because the address is
> wrong.
> Also, don't forget to set the R/W bit to 1/0 according to Read or
> Write...
>
> Best Regards,
> Kris
> -----Original Message-----
> From: m... [mailto:m...] On Behalf Of
> Taskin -
> Sent: Tuesday, 30 January 2007 8:09 PM
> To: m...
> Subject: RE: [msp430] I2C very fundamental problem
>
> Hello Kris,
>
> I have tried your advice but it didn't work. I'm checking the voltage
> levels with an oscilloscope,
> both scl and sda, but they are both at about +-80mV. However MSP430 works
> at 3.3 V and my camera
> at 5 V so shoudn't it be at about 2.3V (0.7 Vcc)for high signal? By the
> way, I have connected two
> 10kOhm resistors to the bus. I have connected them between Vcc and
> SCL/SDA lines of the camera
> then connected to I2C bus of the MCU. Is there anything wrong with
> it(figure is below)? I have
> just one I2C peripheral.
>
> ---------------------- Vcc(3.3V)
> | |
> _____ 10K 10K
> | | Camera | |
> | | | |
> |____| | |
> | |________________| |
> | | |
> |__|______________________|
> | |
> | |______________________________________SCL
> |
> |_________________________________________SDA
>
> Sorry for the poor drawing, just to visualize how I connected the
> resistors.
>
> Thanks,
>
> Taskin
>
> Microbit wrote:
> > Or does I2CNDAT just
> count the data bytes that we send?
>
> Yes, do not include command byte.
> Your problem might be that you set MSP430 as a Master too early :
> Execute this line only when you start transmitting, NOT at init :
>
> U0CTL |= MST;
>
> Best Regards,
> Kris
> -----Original Message-----
> From: m... [mailto:m...] On Behalf
> Of msp430pat
> Sent: Monday, 29 January 2007 7:33 PM
> To: m...
> Subject: [msp430] I2C very fundamental problem
>
> Hello,
> I'm trying to interface a mini cmos camera(C3188A) to a MSP430F169
> from I2C bus. However I have some problems. First of all, I have
> written the code below to initialize I2C bus(I'm using Crossworks 1.4):
>
> WDTCTL = WDTPW + WDTHOLD;
> P3SEL |= 0x0A;
> U0CTL |= I2C + SYNC;
> U0CTL &= ~I2CEN;
>
> U0CTL |= MST;
> I2CTCTL |= I2CSSEL1 + I2CTRX;
> I2CNDAT = 0x03;
> I2CSA = 0x0003; // Slave Address is 011h
> I2CIE = TXRDYIE;
> U0CTL |= I2CEN;
> _EINT();
>
> My camera has three chip select pins and are configured as <011>. I
> have a question in that point, in application report SLAA208, it says
> that slave address should be configured as 1010xxx where xxx is the
> chip select configuration. The bits 1010 are fixed. Is this
> configuration mandatory for all 3 chip select slave devices or only
> for the EEPROM mentioned in the application note? Because in the user
> manual it doesn't mention about such a necessity(the fixed address
> part, 1010). In the same application report(Slaa208) it also mentions
> about the usage of I2CSA register. It writes that when the START
> condition is generated, contents of I2CSA is automatically sent with
> shifting one bit to the left and placing direction bit to the LSB. So
> we don't need to send the first address byte manually? If so, is this
> automatically sent address byte(is this called COMMAND byte?) counted
> as one for the I2CNDAT register? Or does I2CNDAT just count the data
> bytes that we send?
> After the initialization procedure I initiate a transfer as below:
>
> I2CTCTL |= I2CSTT + I2CSTP; // send start condition
>
> while((I2CIFG & TXRDYIFG) == 0); //wait for transmit to be ready
> I2CDRB = 0x4E;//code[0]; //send write command to camera
>
> while((I2CIFG & TXRDYIFG) == 0);
> I2CDRB = 0x13;//code[1]; //target register's offset
>
> while((I2CIFG & TXRDYIFG) == 0); //execution halts here
> I2CDRB = 0x21;//code[1];
>
> When execution comes to transmit the third data byte, it halts in the
> final while loop(regardless of the value of I2CNDAT). It seems the bus
> never gets ready to transmit data for the third time. However there
> are some wierd problems. When I check I2CTCTL register, the I2CSTT bit
> is not cleared after start condition. I2CSTP bit is also not cleared
> any time. I2CTCTL register remains constant. Moreover after start
> condition is sent, I2CBUSY bit is set(as expected) but I2CBB bit never
> gets set. It seems something is going wrong in my initialization
> procedure but I couldn't figure out where the problem is. I have
> checked the manual many times but couldn't find solution to my
> problem. Could anyone please help me figure out what the problem is?
>
> Thanks,
>
> Taskin Baltaci
>
>
>
> Yahoo! Groups Links
>
> ---------------------------------
> Access over 1 million songs - Yahoo! Music Unlimited.
>
>
>
>
>
> Yahoo! Groups Links
> ---------------------------------
> Sucker-punch spam with award-winning protection.
> Try the free Yahoo! Mail Beta.
>
>
> Yahoo! Groups Links
>
Hi Paulo,

I have seen that datasheet but some subjects are not clear enough. In the dataheet it says I shall configure the pins when RESET is high. I do as it says but either my new configuration or my slave address seems invalid.
If the default of chipselect pins is low, then what should my slave address be? Should I write 0x50 or 0x00 to I2CSA register? As far as I know 0x00 is a general call so it'll address all the peripherals on I2C. So what should I use for slave address when all three chip select pins are low?

Thanks

Taskin
Paulo Ricardo wrote: Hi Taskin,

You need read the device datasheet (C3188A). On page 27,
"0.11 SCCB Register Sets". You have tree pins to configure
address, CS[2..0], and they are multiplexed with Y signals.
These signals are latched at power-on or reset.
The default configuration (by internal pull-down) is low.
Thus, the write address is 42H and the read address is 43H
(see "Table 1.10: Slave ID" on page 27).

-Paulo.

> -----Mensagem original-----
> De: m... [mailto:m...] Em nome de
> Taskin -
> Enviada em: quarta-feira, 31 de janeiro de 2007 05:44
> Para: m...
> Assunto: RE: [msp430] I2C very fundamental problem
>
> Hello Kris,
>
> I have corrected my slave address to 0x53 but it didn't work again. It
> really seems as if the Master do not get an ACK. But what is wrong with my
> slave address? My camera is configured as . In SLAA208
> it mentions about that 1010xxx address format but is it only used for
> EEPROMS or is it a general slave address format I don't know. But
> according to my chipselects above shouldn't my slave address be either
> 0x03 or 0x53? Both of them didn't work.
>
> Thanks for your help,
>
>
>
> Microbit wrote:
> It also seems your Slave address is wrong :
>
> I2CSA = 0x0003; // Slave Address is 011h
>
> Look at the bit fields :
>
> > that slave address should be configured as 1010xxx where xxx is the
> > chip select configuration. The bits 1010 are fixed. Is this
>
> 1010xxx + slave address 011 = 1010011 => 0x53 (not 0x03) !!!
> I'm not sure whether this is the right Slave address for our particular
> app though...
>
> You're probably not getting ACKs from the slave because the address is
> wrong.
> Also, don't forget to set the R/W bit to 1/0 according to Read or
> Write...
>
> Best Regards,
> Kris
>
>
> -----Original Message-----
> From: m... [mailto:m...] On Behalf Of
> Taskin -
> Sent: Tuesday, 30 January 2007 8:09 PM
> To: m...
> Subject: RE: [msp430] I2C very fundamental problem
>
> Hello Kris,
>
> I have tried your advice but it didn't work. I'm checking the voltage
> levels with an oscilloscope,
> both scl and sda, but they are both at about +-80mV. However MSP430 works
> at 3.3 V and my camera
> at 5 V so shoudn't it be at about 2.3V (0.7 Vcc)for high signal? By the
> way, I have connected two
> 10kOhm resistors to the bus. I have connected them between Vcc and
> SCL/SDA lines of the camera
> then connected to I2C bus of the MCU. Is there anything wrong with
> it(figure is below)? I have
> just one I2C peripheral.
>
> ---------------------- Vcc(3.3V)
> | |
> _____ 10K 10K
> | | Camera | |
> | | | |
> |____| | |
> | |________________| |
> | | |
> |__|______________________|
> | |
> | |______________________________________SCL
> |
> |_________________________________________SDA
>
> Sorry for the poor drawing, just to visualize how I connected the
> resistors.
>
> Thanks,
>
> Taskin
>
> Microbit wrote:
> > Or does I2CNDAT just
> count the data bytes that we send?
>
> Yes, do not include command byte.
> Your problem might be that you set MSP430 as a Master too early :
> Execute this line only when you start transmitting, NOT at init :
>
> U0CTL |= MST;
>
> Best Regards,
> Kris
>
>
> -----Original Message-----
> From: m... [mailto:m...] On Behalf
> Of msp430pat
> Sent: Monday, 29 January 2007 7:33 PM
> To: m...
> Subject: [msp430] I2C very fundamental problem
>
> Hello,
> I'm trying to interface a mini cmos camera(C3188A) to a MSP430F169
> from I2C bus. However I have some problems. First of all, I have
> written the code below to initialize I2C bus(I'm using Crossworks 1.4):
>
> WDTCTL = WDTPW + WDTHOLD;
> P3SEL |= 0x0A;
> U0CTL |= I2C + SYNC;
> U0CTL &= ~I2CEN;
>
> U0CTL |= MST;
> I2CTCTL |= I2CSSEL1 + I2CTRX;
> I2CNDAT = 0x03;
> I2CSA = 0x0003; // Slave Address is 011h
> I2CIE = TXRDYIE;
> U0CTL |= I2CEN;
> _EINT();
>
> My camera has three chip select pins and are configured as <011>. I
> have a question in that point, in application report SLAA208, it says
> that slave address should be configured as 1010xxx where xxx is the
> chip select configuration. The bits 1010 are fixed. Is this
> configuration mandatory for all 3 chip select slave devices or only
> for the EEPROM mentioned in the application note? Because in the user
> manual it doesn't mention about such a necessity(the fixed address
> part, 1010). In the same application report(Slaa208) it also mentions
> about the usage of I2CSA register. It writes that when the START
> condition is generated, contents of I2CSA is automatically sent with
> shifting one bit to the left and placing direction bit to the LSB. So
> we don't need to send the first address byte manually? If so, is this
> automatically sent address byte(is this called COMMAND byte?) counted
> as one for the I2CNDAT register? Or does I2CNDAT just count the data
> bytes that we send?
> After the initialization procedure I initiate a transfer as below:
>
> I2CTCTL |= I2CSTT + I2CSTP; // send start condition
>
> while((I2CIFG & TXRDYIFG) == 0); //wait for transmit to be ready
> I2CDRB = 0x4E;//code[0]; //send write command to camera
>
> while((I2CIFG & TXRDYIFG) == 0);
> I2CDRB = 0x13;//code[1]; //target register's offset
>
> while((I2CIFG & TXRDYIFG) == 0); //execution halts here
> I2CDRB = 0x21;//code[1];
>
> When execution comes to transmit the third data byte, it halts in the
> final while loop(regardless of the value of I2CNDAT). It seems the bus
> never gets ready to transmit data for the third time. However there
> are some wierd problems. When I check I2CTCTL register, the I2CSTT bit
> is not cleared after start condition. I2CSTP bit is also not cleared
> any time. I2CTCTL register remains constant. Moreover after start
> condition is sent, I2CBUSY bit is set(as expected) but I2CBB bit never
> gets set. It seems something is going wrong in my initialization
> procedure but I couldn't figure out where the problem is. I have
> checked the manual many times but couldn't find solution to my
> problem. Could anyone please help me figure out what the problem is?
>
> Thanks,
>
> Taskin Baltaci
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
> ---------------------------------
> Access over 1 million songs - Yahoo! Music Unlimited.
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
> ---------------------------------
> Sucker-punch spam with award-winning protection.
> Try the free Yahoo! Mail Beta.
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>

---------------------------------
Any questions? Get answers on any topic at Yahoo! Answers. Try it now.
Taskin,

You must not change the default value of address. Just
use 0x42h for I2CSA.

The 0x42H address is the bits [4-2] in the address byte:
M L
S S
B B
8 4 2 1 8 4 2 1
0 1 0 [CS2].[CS1] [CS0] 1 [R/W]
-Paulo

> -----Mensagem original-----
> De: m... [mailto:m...] Em nome de
> Taskin -
> Enviada em: quarta-feira, 31 de janeiro de 2007 11:06
> Para: m...
> Assunto: Re: RES: [msp430] I2C very fundamental problem
>
> Hi Paulo,
>
> I have seen that datasheet but some subjects are not clear enough. In the
> dataheet it says I shall configure the pins when RESET is high. I do as it
> says but either my new configuration or my slave address seems invalid.
> If the default of chipselect pins is low, then what should my slave
> address be? Should I write 0x50 or 0x00 to I2CSA register? As far as I
> know 0x00 is a general call so it'll address all the peripherals on I2C.
> So what should I use for slave address when all three chip select pins are
> low?
>
> Thanks
>
> Taskin
> Paulo Ricardo wrote:
> Hi Taskin,
>
> You need read the device datasheet (C3188A). On page 27,
> "0.11 SCCB Register Sets". You have tree pins to configure
> address, CS[2..0], and they are multiplexed with Y signals.
> These signals are latched at power-on or reset.
> The default configuration (by internal pull-down) is low.
> Thus, the write address is 42H and the read address is 43H
> (see "Table 1.10: Slave ID" on page 27).
>
> -Paulo.
>
> > -----Mensagem original-----
> > De: m... [mailto:m...] Em nome de
> > Taskin -
> > Enviada em: quarta-feira, 31 de janeiro de 2007 05:44
> > Para: m...
> > Assunto: RE: [msp430] I2C very fundamental problem
> >
> > Hello Kris,
> >
> > I have corrected my slave address to 0x53 but it didn't work again. It
> > really seems as if the Master do not get an ACK. But what is wrong with
> my
> > slave address? My camera is configured as . In
> SLAA208
> > it mentions about that 1010xxx address format but is it only used for
> > EEPROMS or is it a general slave address format I don't know. But
> > according to my chipselects above shouldn't my slave address be either
> > 0x03 or 0x53? Both of them didn't work.
> >
> > Thanks for your help,
> >
> >
> >
> > Microbit wrote:
> > It also seems your Slave address is wrong :
> >
> > I2CSA = 0x0003; // Slave Address is 011h
> >
> > Look at the bit fields :
> >
> > > that slave address should be configured as 1010xxx where xxx is the
> > > chip select configuration. The bits 1010 are fixed. Is this
> >
> > 1010xxx + slave address 011 = 1010011 => 0x53 (not 0x03) !!!
> > I'm not sure whether this is the right Slave address for our
> particular
> > app though...
> >
> > You're probably not getting ACKs from the slave because the address is
> > wrong.
> > Also, don't forget to set the R/W bit to 1/0 according to Read or
> > Write...
> >
> > Best Regards,
> > Kris
> >
> >
> > -----Original Message-----
> > From: m... [mailto:m...] On Behalf
> Of
> > Taskin -
> > Sent: Tuesday, 30 January 2007 8:09 PM
> > To: m...
> > Subject: RE: [msp430] I2C very fundamental problem
> >
> > Hello Kris,
> >
> > I have tried your advice but it didn't work. I'm checking the voltage
> > levels with an oscilloscope,
> > both scl and sda, but they are both at about +-80mV. However MSP430
> works
> > at 3.3 V and my camera
> > at 5 V so shoudn't it be at about 2.3V (0.7 Vcc)for high signal? By
> the
> > way, I have connected two
> > 10kOhm resistors to the bus. I have connected them between Vcc and
> > SCL/SDA lines of the camera
> > then connected to I2C bus of the MCU. Is there anything wrong with
> > it(figure is below)? I have
> > just one I2C peripheral.
> >
> > ---------------------- Vcc(3.3V)
> > | |
> > _____ 10K 10K
> > | | Camera | |
> > | | | |
> > |____| | |
> > | |________________| |
> > | | |
> > |__|______________________|
> > | |
> > | |______________________________________SCL
> > |
> > |_________________________________________SDA
> >
> > Sorry for the poor drawing, just to visualize how I connected the
> > resistors.
> >
> > Thanks,
> >
> > Taskin
> >
> > Microbit wrote:
> > > Or does I2CNDAT just
> > count the data bytes that we send?
> >
> > Yes, do not include command byte.
> > Your problem might be that you set MSP430 as a Master too early :
> > Execute this line only when you start transmitting, NOT at init :
> >
> > U0CTL |= MST;
> >
> > Best Regards,
> > Kris
> >
> >
> > -----Original Message-----
> > From: m... [mailto:m...] On
> Behalf
> > Of msp430pat
> > Sent: Monday, 29 January 2007 7:33 PM
> > To: m...
> > Subject: [msp430] I2C very fundamental problem
> >
> > Hello,
> > I'm trying to interface a mini cmos camera(C3188A) to a MSP430F169
> > from I2C bus. However I have some problems. First of all, I have
> > written the code below to initialize I2C bus(I'm using Crossworks
> 1.4):
> >
> > WDTCTL = WDTPW + WDTHOLD;
> > P3SEL |= 0x0A;
> > U0CTL |= I2C + SYNC;
> > U0CTL &= ~I2CEN;
> >
> > U0CTL |= MST;
> > I2CTCTL |= I2CSSEL1 + I2CTRX;
> > I2CNDAT = 0x03;
> > I2CSA = 0x0003; // Slave Address is 011h
> > I2CIE = TXRDYIE;
> > U0CTL |= I2CEN;
> > _EINT();
> >
> > My camera has three chip select pins and are configured as <011>. I
> > have a question in that point, in application report SLAA208, it says
> > that slave address should be configured as 1010xxx where xxx is the
> > chip select configuration. The bits 1010 are fixed. Is this
> > configuration mandatory for all 3 chip select slave devices or only
> > for the EEPROM mentioned in the application note? Because in the user
> > manual it doesn't mention about such a necessity(the fixed address
> > part, 1010). In the same application report(Slaa208) it also mentions
> > about the usage of I2CSA register. It writes that when the START
> > condition is generated, contents of I2CSA is automatically sent with
> > shifting one bit to the left and placing direction bit to the LSB. So
> > we don't need to send the first address byte manually? If so, is this
> > automatically sent address byte(is this called COMMAND byte?) counted
> > as one for the I2CNDAT register? Or does I2CNDAT just count the data
> > bytes that we send?
> > After the initialization procedure I initiate a transfer as below:
> >
> > I2CTCTL |= I2CSTT + I2CSTP; // send start condition
> >
> > while((I2CIFG & TXRDYIFG) == 0); //wait for transmit to be ready
> > I2CDRB = 0x4E;//code[0]; //send write command to camera
> >
> > while((I2CIFG & TXRDYIFG) == 0);
> > I2CDRB = 0x13;//code[1]; //target register's offset
> >
> > while((I2CIFG & TXRDYIFG) == 0); //execution halts here
> > I2CDRB = 0x21;//code[1];
> >
> > When execution comes to transmit the third data byte, it halts in the
> > final while loop(regardless of the value of I2CNDAT). It seems the
> bus
> > never gets ready to transmit data for the third time. However there
> > are some wierd problems. When I check I2CTCTL register, the I2CSTT
> bit
> > is not cleared after start condition. I2CSTP bit is also not cleared
> > any time. I2CTCTL register remains constant. Moreover after start
> > condition is sent, I2CBUSY bit is set(as expected) but I2CBB bit
> never
> > gets set. It seems something is going wrong in my initialization
> > procedure but I couldn't figure out where the problem is. I have
> > checked the manual many times but couldn't find solution to my
> > problem. Could anyone please help me figure out what the problem is?
> >
> > Thanks,
> >
> > Taskin Baltaci
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> > ---------------------------------
> > Access over 1 million songs - Yahoo! Music Unlimited.
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> > ---------------------------------
> > Sucker-punch spam with award-winning protection.
> > Try the free Yahoo! Mail Beta.
> >
> >
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> ---------------------------------
> Any questions? Get answers on any topic at Yahoo! Answers. Try it now.
>
>
> Yahoo! Groups Links
>

Memfault Beyond the Launch