Jump to content
43oh

LaunchPad I2C Communication


Recommended Posts

Does anyone know how to communicate between LaunchPads using I2C Communication? I would like to have a master unit connected to many slave units. The master unit will most likely be a computer, but I would like to simulate the master as a LaunchPad or Arduino microcontroller. The slave units must all be LaunchPads.

 

Which pins do I use for I2C communication? Any code examples? Do I need pull-up resistors?

 

Any help will be much appreciated!

Link to post
Share on other sites

Yea, the I2C Explorer has a bus-pirate like way of communicating from a pc through the uart to an i2c bus. It uses the builtin USI of the msp430G2231 to handle receiving and transmitting. It is nearly exactly what the TI description of how to use the USI for I2C master shows, put in C code.

MSP430 Family Guide with USI description (PDF Page 449):

http://focus.ti.com/lit/ug/slau144e/slau144e.pdf

 

What you want is USI Slave though. It does not implement that. TI has great USI Slave examples that run on the msp430g line (I have not personally tried them).

 

TI also has a precreated I2C USI code library in assembly, for both master and slave operation, which I would assume is a higher order more optimized than mine :P

http://focus.ti.com/general/docs/litabs ... r=slaa368a

The pdf explains how it is used, functions and all, while the zip has the actual library.

 

Additionally, you can use a software i2c slave, not using the builtin USI peripheral. Based on a msp430f2131, which has 8kb, so I'm not sure it will run on a valueline part:

http://www.ti.com/sc/docs/psheets/abstr ... laa330.htm

Again, PDF for code examples, and zip for actual code.

I'd go with using the USI instead of bitbanging it. The USI is better, it handles open drain pins, and it can deal with clock stretching.

 

There is also a way to implement a SMBus Master or Slave on the msp430:

http://www.ti.com/litv/pdf/slaa073

SMBus is basically i2c v1.1.

 

Finally, there are full examples that can run on the msp430g valueline chips.

http://www.ti.com/litv/zip/slac080h

It is the MSP430F20xx, MSP430G2xx Code Examples (Rev. H)

The ones you want to look at are (Depending on if you Use C or Assembly) USI 06-16. Show how to implement USI based I2C Masters and Slaves, for single and multi-byte usage. One even shows how to emulate an i2c eeprom.

 

TLDR: Read the Code examples in

http://www.ti.com/litv/zip/slac080h

Or consider using the TI USI i2c Code Library

http://focus.ti.com/general/docs/litabs ... r=slaa368a

Link to post
Share on other sites

Hey guys,

 

After looking through TI's code for some time, I still cannot come up with a solution. I need help with the coding and if anyone can send me an example on how to send the value "1" when you press the pushbutton connected to P1.3. I can figure out the master part but I just need help with the slave. Please anyone who can help me with this, I am still a beginner with the LaunchPad.

 

Thanks!

Link to post
Share on other sites

Thats because it is for the MSP430F2618 chip. You need to port it to the one you are using.

 

If you select the above chip when you set up the project, it should compile. What you can do is use the TI code as an example and then build yours. I'm guessing you have the 2231. You will have to understand the code to do this. Copying code will not work.

 

If you don't understand parts of the code, ask us.

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...