hi
i`m unable to see the changes on the data and clock lines of the i2c, i try to make the programs examples in the IAR program (i2c 6 & 7 examples). I'm only see the vcc , way?
I'm using the 10 K pull up resitors.
Thanks.
Gaston
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
hi
i`m unable to see the changes on the data and clock lines of the i2c, i try to make the programs examples in the IAR program (i2c 6 & 7 examples). I'm only see the vcc , way?
I'm using the 10 K pull up resitors.
Thanks.
Gaston
This appears to be the same issue as what is posted in http://community.ti.com/forums/p/2924/10916.aspx#10916.
Perhaps we should stick to one thread to work the issue?
I have an ez430_rf2500 and i work with IAR, y try to simulate the examples, the problem is that i can`t see changes in the data and clock lines. I make the conexion betwen the msp430F2274 using 10 k resistors like the examples says, but when i use the oscilloscope to see data i`m only see the Vcc. I try to make some changes like put in the code P3DIR |= 0x0F before P3SEL |= 0x06, i make this so i can see the clock line but it dosn`t work. This are the codes so if you see something let me know.
************************************Master code:
#include "msp430x22x4.h"
unsigned char TXData;
unsigned char TXByteCtr;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P3SEL |= 0x06; // Assign I2C pins to USCI_B0
UCB0CTL1 |= UCSWRST; // Enable SW reset
UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode
UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset
UCB0BR0 = 12; // fSCL = SMCLK/12 = ~100kHz
UCB0BR1 = 0;
UCB0I2CSA = 0x48; // Slave Address is 048h
UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
IE2 |= UCB0TXIE; // Enable TX interrupt
TXData = 0x00; // Holds TX data
while (1)
{
TXByteCtr = 1; // Load TX byte counter
while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent
UCB0CTL1 |= UCTR + UCTXSTT; // I2C TX, start condition
__bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ interrupts
// Remain in LPM0 until all data
// is TX'd
TXData++; // Increment data byte
}
}
//------------------------------------------------------------------------------
// The USCIAB0TX_ISR is structured such that it can be used to transmit any
// number of bytes by pre-loading TXByteCtr with the byte count.
//------------------------------------------------------------------------------
#pragma vector = USCIAB0TX_VECTOR
__interrupt void USCIAB0TX_ISR(void)
{
if (TXByteCtr) // Check TX byte counter
{
UCB0TXBUF = TXData; // Load TX buffer
TXByteCtr--; // Decrement TX byte counter
}
else
{
UCB0CTL1 |= UCTXSTP; // I2C stop condition
IFG2 &= ~UCB0TXIFG; // Clear USCI_B0 TX int flag
__bic_SR_register_on_exit(CPUOFF); // Exit LPM0
}
}
Gaston,
Are you trying to use the I2C lines on the EZ-RF to connect to an external device? On the eZ430-RF2500 development board the I2C clock line (P3.2) is also connected to the CC2500 chip. It turns out you have to add P3DIR |= 0x0F before P3SEL |= 0x06 in order to disable the CC2500. Once this is done the I2C clock line works correctly.
Hi Brandon
i try to do the example program in IAR ( I2C_6_7) that connect two msp430, but when i use the oscilloscope to see the clock and data lines changes i don`t see anything, y read some post that says about put 0x0F before P3DIR but when i do it i`m still can`t see anything, i use the pull up resistors 10k, i`m only see is that but no changes.
Thanks.
Gaston
Hi Gaston,
How could you fix the problem? I am having same problem with MSP430F5438.
Would you please share the solution?
Regards,
Mohammadi
Hi,
i don't use the msp430f5438, but in my case (f2274 ), i solvedt putting 1 line of code (see the post of Brandon). Did you use pull up resistors?
Regards
Gastón
Hello. I have the same problem with this bus. Could somebody say if there are more changes than just adding P3DIR = 0x0F before P3SEL |= 0x06 line? I use eX430-RF2500 dev kit, but still no changes. Clock does not apperaed on I2C lines. Pull ups are added to P2 target board pinouts.
Hi Dmetrij,
did you connect one device as master and the other device as slave? Just asking because is very strange your problem, you must add P3DIR |= 0x0F before P3SEL |= 0x06.
Regards
Gastón
Of course I did. First of all i loaded Slave code to one part of eZ430-RF2500 and then to the other I`ve loaded Master code, but still have problem.
Problem is - SDA - LOW and SCL - HIGH. There is my code. And connection below.
//This is the master code.
#include "msp430x22x4.h"
unsigned char TXData;
unsigned char TXByteCtr;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= (1 << 1);
P1OUT |= (1 << 1);
P2DIR |= (1 << 1);
P2SEL |= (1 << 1); // SMCLK Output
P3DIR = 0x0F;
P3SEL |= 0x06; // Assign I2C pins to USCI_B0
UCB0CTL1 |= UCSWRST; // Enable SW reset
UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode
UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset
UCB0BR0 = 12; // fSCL = SMCLK/12 = ~100kHz
UCB0BR1 = 0;
UCB0I2CSA = 0x48; // Slave Address is 048h
UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
IE2 |= UCB0TXIE; // Enable TX interrupt
TXData = 0x00; // Holds TX data
while (1)
{
TXByteCtr = 1; // Load TX byte counter
while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent
UCB0CTL1 |= UCTR + UCTXSTT; // I2C TX, start condition
__bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ interrupts
// Remain in LPM0 until all data
// is TX'd
TXData++; // Increment data byte
}
}
//------------------------------------------------------------------------------
// The USCIAB0TX_ISR is structured such that it can be used to transmit any
// number of bytes by pre-loading TXByteCtr with the byte count.
//------------------------------------------------------------------------------
#pragma vector = USCIAB0TX_VECTOR
__interrupt void USCIAB0TX_ISR(void)
{
if (TXByteCtr) // Check TX byte counter
{
UCB0TXBUF = TXData; // Load TX buffer
TXByteCtr--; // Decrement TX byte counter
}
else
{
UCB0CTL1 |= UCTXSTP; // I2C stop condition
IFG2 &= ~UCB0TXIFG; // Clear USCI_B0 TX int flag
__bic_SR_register_on_exit(CPUOFF); // Exit LPM0
}
}
////This is the slave code.
//#include "msp430x22x4.h"
//
//volatile unsigned char RXData;
//
//void main(void)
//{
// WDTCTL = WDTPW + WDTHOLD; // Stop WDT
// P1DIR |= (1 << 0);
// P1OUT |= (1 << 0);
// P2DIR |= (1 << 1);
// P2SEL |= (1 << 1); // SMCLK Output
// P3DIR = 0x0F;
// P3SEL |= 0x06; // Assign I2C pins to USCI_B0
// UCB0CTL1 |= UCSWRST; // Enable SW reset
// UCB0CTL0 = UCMODE_3 + UCSYNC; // I2C Slave, synchronous mode
// UCB0I2COA = 0x48; // Own Address is 048h
// UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
// IE2 |= UCB0RXIE; // Enable RX interrupt
//
// while (1)
// {
// __bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ interrupts
// __no_operation(); // Set breakpoint >>here<< and read
// } // RXData
//}
//
//// USCI_B0 Data ISR
//#pragma vector = USCIAB0TX_VECTOR
//__interrupt void USCIAB0TX_ISR(void)
//{
// RXData = UCB0RXBUF; // Get RX data
// __bic_SR_register_on_exit(CPUOFF); // Exit LPM0
//}
Hello Gaston....
I'm having the exact same problem that you had trying to communicate two MSP430F2274 via I2C. I implemented the examples i2c 6 - 7 and nothing. Both my SDA and SCL lines are low, and the only thing that I see is Vcc. I tried adding the line of code P3DIR |= 0x0F before P3SEL |= 0x06 and still nothing happens. I was wondering what did you do that fixed the issue. I didn't change the code from the example other than adding the P3DIR |= 0x0F line. I tried adding it to both the master and slave programs and also just to the master and still get nothing.
I would appreciate your feedback on this.
Leo
Leo,
Check the pull up resistors (10k in the SDA and SCL lines). Are you still having this problem?
Gastón
Hey Gastón.... thanks for replying very quickly. I did fixed it. It turns out that adding the line of code P3DIR |= 0x0F before P3SEL |= 0x06 won't work. Actually adding the line P3DIR |= 0xFF instead of P3DIR |= 0x0F is what works. I wanted to point that out for future reference if someone else gets stuck trying to get the I2C communication working. I tested it with the examples I2C 6 - 7 (two MSP430F2274) and with one MSP430F2274 as master and an external optical sensor as slave (using this set of USCI-I2C functions).
I hope this helps in the future and thanks again for your reply
Leo
Hi Leo & Gaston,
Even I am facing the same issue of not able to setup the I2C communication using the sample code of msp430x22x4_uscib0_i2c_06.c and msp430x22x4_uscib0_i2c_07.c. I have the entire message in this thread and followed all the steps suggested above,but still no success.
I tried inserting P3DIR |= 0x0F as well as P3DIR |= 0xFF before P3SEL |= 0x06. But none of them are working. I am getting SCL as HIGH but SDA is LOW
I have used 10k pull resistors for SDA as well as SCL and have common ground. Any ideas what can be done to solve this issue?
Thanks
Girish
Girish,
you have your own board? ceck for integrity signal. Check the slave address. What msp430 are you using? in case of the msp430f2274 check the errata
Gastón
So someone is pulling SDA low. Likely the I2C slave. Does it have power applied? Disconnect the slave (makes sure, nothing except the pullup resistor is on SDA and SCL, then look at it with the scope again. Do you see the (futile) attempt of addressing the slave then?girish KAMATH said:I am getting SCL as HIGH but SDA is LOW
I have used 10k pull resistors for SDA as well as SCL and have common ground.
Hello Jens,
Thank you for your quick response. Yes, I did try to isolate the master and check if it was giving the SDA and SCL signal. I am getting the Start bit and slave address sent without slave MCU connected.But as soon as I connect the slave MCU, there is not start bit nor slave address being sent. There is just a spike on SDA and SCL after 11 micro second and nothing after that.(I2C frequency is set at 100kHz). My professor and I sat to debug this issue and were unsuccessful.
Also the interrupt when TX buffer is empty is fired only once after the MSP goes to low power mode. I have set the GIE and USB0TXIE enabled. The programs are from TI sample programs which are given in the top of the thread
Thank you,
Girish
Hi Gaston,
I have my own board. What is the integrity signal? The slave address is 48h; it was given in the sample code of TI- msp430x22x4_uscib0_i2c_06.c.
I have MSP430f2274. I checked the errata pdf and still couldn't solve the problem
Thanks,
Girish
So the slave is pulling the line(s) down. Note that on I2C, only the pullup resistors are pulling the lines up. Bot, master and slave, can only pull it down. So if the slave is for some reason (improper wiring, defect, missing supply, whatever) pulls the line down, there's nothing the master can do to make it going up.girish KAMATH said:as soon as I connect the slave MCU, there is not start bit nor slave address being sent.
Well, you get UCTXIFG set as soon as you set UCTR and UCTXSTT. The USCI will send the slave address, but won't proceed with the ACK cycle until you served the TX interrupt (wrote somehting to TXBUF). Once you did, the ACK (or NACk) is received. If it was a NACK, UCNACKIFG is set (triggering an UCNACKIE interrupt). If an ACK was received, sending begins and TXIFG is set anew.girish KAMATH said:Also the interrupt when TX buffer is empty is fired only once after the MSP goes to low power mode. I have set the GIE and USB0TXIE enabled.
Since it worked with the slave disconnected, the slave seems to be the problem, not the MSP and not the MSP firmware.
**Attention** This is a public forum