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 am trying to use P4.6 and P4.7 as the SDA and SCL lines to communicate with a raspberry pi. In other words, the configuration for that setup would be to use the UCB1 registers instead of the usual UCB0 registers for the SDA and SCL lines for P1.2 and P1.3.
What my issue is, is that when I initially test the I2C config code for UCB0, it works perfectly fine and running the i2cdetect -y 1 on the rpi terminal is able to detect the msp slave address. However, when changing the code so that it would for the UCB1 register and using the P4.6 and P4.7 pins for I2C, it doesnt work. The address is not detected and for some reason it doesnt detect any of the other addresses that are also connected to the rpi anymore.
This is my code, it is pretty basic as I just want to test that the rpi can detect the slave address (code is taken from examples from the user guide):
#include <msp430.h>
/**
* main.c
*/
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
UCB1CTLW0 = UCSWRST; // Software reset enabled
UCB1CTLW0 |= UCMODE_3 | UCSYNC; // I2C mode, sync mode
UCB1I2COA0 = 0x48 | UCOAEN; // Own Address and enable
UCB1CTLW0 &= ~UCSWRST; // clear reset register
UCB1IE |= UCRXIE + UCSTPIE;
P4SEL0 |= BIT6 | BIT7;
P4SEL1 &= ~(BIT6 | BIT7);
PM5CTL0 &= ~LOCKLPM5;
UCB1IE |= UCTXIE + UCRXIE; // enable TX&RX-interrupt
GIE; // general interrupt enable
/*
...
// inside the eUSCI_B TX interrupt service routine
UCB1TXBUF = 0x77; // send 077h
...
// inside the eUSCI_B RX interrupt service routine
data = UCB1RXBUF; // data is the internal variable
*/
return 0;
}
well it should matter, right. In this case I am just trying to recgonize the address through a raspberry pi. So as soon as it gets configured and i run i2cdetect -y 1 on the rpi terminal the msp should pop up as an address
I realized that it may be a broken/damaged pin as the SCL pin reads 0.7 volts while using the working I2C UCB0 both SDA and SCL give 3.3V
I asked since this change is easy to forget, and if you forgot you could get the symptom you described.
Can you post the code for your ISR?
**Attention** This is a public forum