SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
By BurstCase
#49731
Dear programers,

I´m programing the eZ430-RF2500. I want to transmit 13 Hex values via I2C. The LEDs at MAIN- end show me that the program reached the end of the commands. I want to connect the 2274 on a 5V I2C-Level with the help of 2 * BSN20 Transistors.
The program I´m using:

#include "msp430x22x4.h"

void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
P1DIR = 0x03; // P1.0 + P1.1 output, else input
P1OUT = 0x04; // P1.2 pullup
P1REN |= 0x04; // P1.2 pullup
P3SEL |= 0x06;
UCB0CTL1 |= UCSWRST;
UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC;
UCB0CTL1 = UCSSEL_2 + UCSWRST;
UCB0BR0 = 12;
UCB0BR1 = 0;
UCB0I2CSA = 0x90;
UCB0CTL1 &= ~UCSWRST;
IE2 |= UCB0TXIE;

while(1)
{
int i;

while(0x04 & P1IN); //Delay till push the button
for(i=0x0000;i<0x9000;i++); //Bounce Delay
P1OUT |= 0x01; //Red LED on; TX the Line

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x11;

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x0A;

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x1B;

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x44;

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x4C;

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x1B;

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x47;

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x44;

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x00;

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x00;

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0xEF;

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x7F;

while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0xDA;

UCB0CTL1 |= UCTXSTP; //---->Do I need this??<----

for(i=0x0000;i<0x5000;i++); //Delay; You can see the Red TX Light
P1OUT &= ~0x01; //Red LED off; TX finished
P1OUT |= 0x02; //Green LED on; TX finished; Aim reached
for(i=0x0000;i<0xF000;i++); //Delay; You can see the Green Aim Light
P1OUT &= ~0x02; //Turn the Green LED off
}
}
By falingtrea
#49761
You are aware that the I2C and SPI hardware ports are shared on this design? So you need to make sure the CS for the RF chip is high so it does not try to mess up the I2C communication. This also makes it difficult to use the RF chip and an I2C device. You might be better off with a EZ430-2013 eval kit instead, if you just want to do I2C communication. Or you could buy some of the MSP430F2012 daughter boards that would still be usable with the ez430-RF2500 programming board.

TI has plenty of code examples here, here, here, here, and here.