curtis63 5 Posted February 28, 2017 Share Posted February 28, 2017 Seems to me that I2C is a fairly commonly used way to communicate between MSP430G2553 and various sensors. However, I cannot seem to find a standard library that implements it. There are many home spun implementations and there doesn't seem to be a standard I2C Library. I'm VERY NEW to the embedded development world, but have been a windows programmer for 20 years. I'm used to having standard reusable libraries that do the grunt work for me so I don't have to re-invent something that has been done by others 100 times already... Am I just missing something or are all embedded developers just masochists?? Surely not.. So, does anybody know where I can find a simple I2C library that works with my MSP430G2553 in Code Composer Studio 7? Any reason why it isn't just built in? Or is it? This is a huge paradigm shift for me, so please be patient. Any help would be appreciated. Quote Link to post Share on other sites
terjeio 134 Posted February 28, 2017 Share Posted February 28, 2017 I have not switched to CCS 7 yet, in CCS 6 you can find examples via View > Getting Started > Browse Examples - same in CCS 7? Since many MSP430 processors have limited resources I prefer to implement the interfaces myself, reusing snippets of code from earlier projects. Quote Link to post Share on other sites
NurseBob 111 Posted February 28, 2017 Share Posted February 28, 2017 @@curtis63 I think you'll find what you're looking for in this zip file: here or go to this page http://www.ti.com/lsds/ti/microcontrollers_16-bit_32-bit/msp/tools_software.page - scroll down to "Code Examples for MSP Microcontrollers" and click on Show More to see all the examples This is a zip file of plain C or Assembler code, for both CCS and IAR Kickstart as well as a GCC make file. You'll want to look at the set of files named msp430g2xx3uscib0_i2c_01 - _13. I've found similar for the F2013 very, very useful. A couple of days ago I set up a master->Slave multibyte read/write. Since the F series devices share a very similar code base, "porting" the master code to a F5529 is pretty clean. BTW - typically the example use the internal pullup resistors. This approach is risky at best. Use a set of real pullup resistors (1k - 10k range) and comment out the pullup resistor code. HTH Bob Oh, BTW, I usually start the slave first, then the master, seems to be more reliable with the code examples. They are not robust regarding connecting, and on my system the voltage swings when starting the debuggers is often "seen" by the slave, putting the state machine into an incorrect state to connect. Also, I'm not trying any of this in Energia or with the launchpads at this time (I have connected a 5529LP to an F2013 via I2C in the past, just not now) - I use a pair of the FETs and run two instances of IAR to watch the debuggers in both windows. I don't think CCS supports running multiple instances unless you set up separate workspaces. Fmilburn 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.