Tool/software: Code Composer Studio
Hi All,
I have a MSP430 micro controller on a launch pad board and I wish to read a differential pressure sensor via its I2C interface. It is a Sensirion SDP610.
I am using code composer 9 and, a lanch pad board.
I would like some simple code to get this up and running so far I have this setup code: This is sourced from : https://electronics.stackexchange.com/questions/67524/msp430-i%C2%B2c-single-write-read-example
void init_I2C(void) { _DINT(); IE2 |= UCB0RXI //Enable RX interrupt //UCRXIE0_1 IE2 |= UCB0TXIE; // Enable TX interrupt //UCRXIE0_1 while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent 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 = 0x40; // Slave Address is 040h UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation } void Transmit(void){ while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent UCB0CTL1 |= UCTR + UCTXSTT; // I2C TX, start condition __bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ interrupts } void Receive(void){ UCB0CTL1 &= ~UCTR ; // Clear UCTR while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent UCB0CTL1 |= UCTXSTT; // I2C start condition while (UCB0CTL1 & UCTXSTT); // Start condition sent? UCB0CTL1 |= UCTXSTP; // I2C stop condition __bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ interrupts }
However, the line of code of IE2 is unresolved.
I do have the SDP610 sensor working via a arduino and open source library so I know it works.
My hardware setup of the I2C line uses P1.2 as SDA and P1.3 as SCL.
Can someone help me set up the I2C communicate just so I can scan for a devices and print that information out to a terminal aka uart or just via the inbuilt debugger and stepping over.
Thanks