Jump to content
43oh

Need help with I2C using MSP430g2553


Recommended Posts

Hello from the UK,

I have been working with msp 430 with mpu6050 for about a month now.

The above code seems to be working. My requirement is to get the out put continuously based on

the motion of mpu6050. I also need the value to be printed.

Unfortunately the print never happens and the value only changes when I debug each time. 

Is there any solution to make it in bautomatic refresh mode with result printed out?

Hope someone would help me out. Thanks

Link to post
Share on other sites
  • 3 months later...

 

 

 

Since you asked for more code via a Private message. I will share the project I used to test that the I2C was working using the MPU-6050. It has a printf script in it that someone on this forum created.

 

 

unknown.gif  MSP430_MPU6050.rar   59.82KB   35 downloads

 

 

Just import this code and connect an MPU-6050 and you should be able to verify that your I2C lines are working through the printf.

Hi Murphy, I also has the problem with connection to MPU6050. But why can't I download your project . Hope you will answer soon. Thank you so much for your kindness :)

Link to post
Share on other sites
  • 3 months later...

Hello Phaelz,

 

I managed to get it working with the msp430, and recently with the Stellaris (much easier thanks the driverlib). Anyways, if you post your email I will send you my msp430 code which used the grace plug in.

 

Also, as a general note I've found that the debug circuit doesn't do well with any type of external communication. My suggestion is just use either the run to line command, or the reset button itself. (don't step through)

Hi ucfknight,

It would be very much better if you could send me the code.

My mail id is arvinasokan@gmail.com.

Also i wanted to know if there was any way to use jeff rowberg's i2c library and access the dmp?

Link to post
Share on other sites
  • 2 weeks later...

Hi everyone!

In my project, i use MSP430+ MPU6050 to display on LCD

Did anyone write library of LCD to make project with MPU6050?

Can you show it for me 

Thanks a lot!

As far as I can see, the MPU6050 is an accelerometer. If you want the accelerometer data to show on an LCD, you're lookin in the wrong place, since this topic is about the accelerometer, not the LCD. Depending on your LCD there might or might not be a library to use it.

Link to post
Share on other sites

As far as I can see, the MPU6050 is an accelerometer. If you want the accelerometer data to show on an LCD, you're lookin in the wrong place, since this topic is about the accelerometer, not the LCD. Depending on your LCD there might or might not be a library to use it.

Yeah, i know that. When we make lib of LCD, i think that it is easy for us to simple our project :) 

Link to post
Share on other sites
  • 7 months later...

i2c MSP430G2553 to MSPG2553 communications failing.

 

I have downloaded the Master_writer and Slave_receiver examples from the Energia IDE to two launchpads.  One is a version 1.4 and one is a version 1.5.  The code compiles on both, but on my O'scope I see no change on either SDA or SCL.  I have 4.7k ohm pullups to Launchpad VCC (~3.3v).  Grounds are connected.  Jumpers for LED p1.6 have been removed.

 

What else must be done?

 

Has anyone tested these sketches on the Launchpad?

Link to post
Share on other sites
  • 6 months later...

Hi I'm try use this library to msp430g2553 + hmc5883l, at principle to read de ID default on this slave device, my main code use your library but doesn't work

/*** USCI master library ************************************************************

In this file the usage of the USCI I2C master library without DMA support is 
shown. This library uses pointers to specify what data is to be sent. 

When calling the TI_USCI_I2C_receive or TI_USCI_I2C_transmit routines 
the number of bytes, which are to be transmitted or received have to be passed as 
well as a pointer to a data field, that contains(or stores) the data.

This code checks if there is a slave with address 0x50 is connected to the I2C
bus and if the slave device is present, bytes are received and transmitted.

Uli Kretzschmar
MSP430 Systems
Freising
*******************************************************************************/
#include "msp/msp430g2553.h"
#include "i2cLib/I2C_MSP430.h"

void putc(char ch) {
	while(!(IFG2 & UCA0TXIFG));
	UCA0TXBUF = ch;
}

void print (const char msg[]) {
	for (int i = 0; msg[i] != '\0'; ++i)
		putc(msg[i]);	
}

void print (short value) {
	if (value == 0) { putc('0'); return; }
	if (value < 0) {
		putc('-');
		value *= -1;
	}
	unsigned int size;
	char buffer[20];
	for (size = 0; value; ++size, value /= 10)
		buffer[size] = value % 10;
	while (size)
		putc(buffer[--size] + '0');
}


main()
{
	WDTCTL = WDTPW + WDTHOLD; // Stop WDT

	// Set DCO to 1MHz
	BCSCTL1 = CALBC1_8MHZ; 
	DCOCTL = CALDCO_8MHZ; 

	//__delay_cycles(1000000);

	/* Configure hardware UART */

	UCA0CTL1 |= UCSWRST; // put USCI in reset mode

	// P1.1 = RXD, P1.2=TXD
	P1SEL = BIT1 + BIT2 ;
	P1SEL2 = BIT1 + BIT2 ;

	UCA0CTL1 |= UCSSEL_3; // Use SMCLK

	// Set baud rate to 9600 with 1MHz clock (Data Sheet 15.3.13) 8MHz / 833
	UCA0BR0 = 0x41;
	UCA0BR1 = 0x03;

	UCA0MCTL = UCBRS0; // Modulation UCBRSx = 1, correction for the fractional part ( the rest, 9600 - 1MHz / 104)
	UCA0CTL1 &= ~UCSWRST; // put USCI in operad mode (removing reset mode)

	/*End configuration hardware UART */
	print("[system] UART configured\r\n");

	_EINT();

	unsigned char deviceAddress = 0x1e;
	unsigned char prescaler = 0x12;

	print("searching id...\r\n");

	I2CbeginTransmission(deviceAddress);
	print("[system] transmittion initialized\r\n");
	I2Cwrite(0x0a);
	print("[system] byte transmitted by i2c\r\n");
	I2CendTransmission();

	char id[3] = {0};
	I2CrequestFrom(deviceAddress, 3);
	print("[system] reception initialized\r\n");
	for (int i = 0; i < 3; ++i) {
		id[i] = I2Cread();
		print("[system] byte received by i2c\r\n");
	}

	print("id (decimal): ");
	for (int i = 0; i < 3; ++i)
		print(id[i]), print(" ");
	print("\r\n");
	print("id (ASCII): ");
	for (int i = 0; i < 3; ++i)
		putc(id[i]), print(" ");
	print("\r\n");
	
	LPM0;
	 
}


the program lock on I2CendTransmission.

Why it doesn't work? It works with other devices? Someone have a upgrated code?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...