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.
I have set up to use P1.3 and P1.2 for an I2C interface. I have connected 3.3K pullups on these two pins. After going through the setup and deasserting the software reset the I2C transaction does not get into even the first START byte out. The I2C status registers show that bus busy is asserted without having any other device connected to the bus which explains why the start is not initiated. Both SCL and SDA pins measure high (3V3). And I did verify that I have set the select pins to choose peripheral instead of GPIO.
I then chose to troubleshoot the pin behavior by reconfiguring to GPIO and making all P1 pins outputs. P1OUT is set to 08h to drive only P1.3 high. I then set a breakpoint in the code to examine the register contents. It shows P1OUT to contain the expected 08h. But P1IN shows an input value of 2Fh. My understanding is that it should match P1OUT if there are no other connections unless there is a faulty device. Measurement of P1.2 and P1.3 verifies they are both high instead of the intended value P1.2 low, P1.3 high.
Is there any other reasonable explanation for this unintended behavior?
I used the MSPware routine to set up I2c for 400KHz clock. System clock is set to 8 MHz. I2C master, no multimaster. Autostop generation after 18 byte transfer.
Here is the excerpt of the code used to set it up.
P1SEL0 = (I2C_SCL | I2C_SDA); // set to I2C
// set up the I2C master peripheral
// instantiate the parameter structure
EUSCI_B_I2C_initMasterParam paramStruct;
paramStruct.selectClockSource = EUSCI_B_I2C_CLOCKSOURCE_SMCLK;
paramStruct.i2cClk = 8000000; // clock source frequency
paramStruct.dataRate = EUSCI_B_I2C_SET_DATA_RATE_400KBPS;
paramStruct.byteCounterThreshold = 0x12;
paramStruct.autoSTOPGeneration = EUSCI_B_I2C_SEND_STOP_AUTOMATICALLY_ON_BYTECOUNT_THRESHOLD;
EUSCI_B_I2C_initMaster(__MSP430_BASEADDRESS_EUSCI_B0__ , ¶mStruct);
// for IO test, leave the I2C in reset.
// leave the associated GPIO not selected for I2C
// drive SDA pin high, drive SCL pin low and stop at breakpoint.
// P1DIR |= (I2C_SCL | I2C_SDA);
// P1OUT |= I2C_SDA;
// experiment performed.
// outputs are not driven. P1OUT shows a value of 04h corresponding to driving only P1.2
// P1IN shows a value of 2Fh instead of 04h and a voltmeter confirms that both P1.2 and P1.3 are high
// tried driving P1.3 high, P1.2 low. Similar results P1OUT = 08h, P1IN = 2Fh.
UCB0CTLW0 &= ~UCSWRST; // deassert software reset
I can supply the entire source code if it is relevant.
**Attention** This is a public forum