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.

MSP430FR2672: Both SDA and SCL are held high during I2C, but still receive interrupts, just reads 0xFF every time

Part Number: MSP430FR2672

I am working on a custom board, and I have wrote some I2C code looking at many other resources and it seems to match up pretty well to everything. This is to be a master to interface with a slave accelerometer. I also have two external pull-up resistors on the SDA and SCL lines of 10K each. When I execute the program, it seems to work fine, as all the correct interrupts trigger and I am able to read a value from the bus as a response, but it is 0xFF every time. Also, when I put a scope on the two lines, they are high the entire time. Below is my code for it. Let me know if there are any apparent issues in it. The code right now just repeatedly tries to read from the register located at 0x29. Thanks in advance!

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <msp430.h>
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#define SLAVE_ADD 0b0011000
/**
* main.c
*/
int value;
volatile bool isWrite = false;
volatile int stateCounter = 0;
void init_i2c(){
P2DIR |= 0x80;
P2OUT |= 0x80; //GPIO For LED
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • 1) All that fiddling with P1OUT.3 is wasted since LOCKLPM5 is still set. It is pointless anyway as I2C doesn't need it. Usually. I see in some of my code a manually generated clock if it sees UCBUSY right after a POR. Not sure why I did that but I am sure it made sense at the time. :-)

    2) It has always been unclear to me (even after careful reading of the documentation) if LOCKLMP5 has any effect on the PxSEL registers. The I2C hardware should clock out the slave address once you set STT. The total lack of clocks suggests a problem with PxSEL.

**Attention** This is a public forum