Rei Vilo 695 Posted January 13, 2013 Share Posted January 13, 2013 The P1_6 and P1_7 pins are already used for SPI and I need an I2C connection. So I'm looking for a bit-bang I2C library, for Energia. I've found RobG library at http://forum.43oh.com/topic/441-serial-eeprom/?p=3876 but I'm facing big issues when I try to port it to Energia. Thank you for your help. electrostach 1 Quote Link to post Share on other sites
Rei Vilo 695 Posted February 14, 2013 Author Share Posted February 14, 2013 I've found detailed documentation on ti.com website MSP430 Interface to TPS60250 via I2C Master Software with detailed PDF http://www.ti.com/litv/pdf/slva302 code http://www.ti.com/litv/zip/slva302 Unfortunately, the code requires to be translated into Energia. Thank you for your help. Quote Link to post Share on other sites
roadrunner84 466 Posted February 14, 2013 Share Posted February 14, 2013 It shouldn't, the code is built for CCS or IAR. Energia is based upon GCC. Only the way interrupts are mapped should require translation. Most registers are mapped identical no matter the compiler. Very litte changes should be required to get it working on Energia. Quote Link to post Share on other sites
energia 485 Posted February 18, 2013 Share Posted February 18, 2013 That implementation is only for USI. It would work for the 2452 and 2231 (or any MSP430 that features an USI). I2C is more difficult to bit-bang than SPI so if you do not need the speed on SPI then it's way easier to bit-bang SPI and use the hardware for I2C. Quote Link to post Share on other sites
Rei Vilo 695 Posted February 18, 2013 Author Share Posted February 18, 2013 Thank you for the answer. Actually, it is for the 2553. Quote Link to post Share on other sites
calinp 24 Posted February 21, 2013 Share Posted February 21, 2013 Hi Rei, I found a I2C software lib for Arduino and after making the necessary changes it seems to work. At least it detects the address range of a small eeprom using the included example. The original with more examples is at http://forums.adafruit.com/viewtopic.php?f=25&t=13722 Calin I2cMaster.zip Rei Vilo and energia 2 Quote Link to post Share on other sites
Rei Vilo 695 Posted February 22, 2013 Author Share Posted February 22, 2013 Thank you! Quote Link to post Share on other sites
Rei Vilo 695 Posted March 30, 2013 Author Share Posted March 30, 2013 After a lot of work, especially with a logic analyser, I changed the delay functions for the more precise #define TICKS_PER_MS (F_CPU / 1000) #define TICKS_PER_US (TICKS_PER_MS / 1000) /// /// @brief delayI2Cms /// @param delay number of milliseconds /// void delayI2Cms(uint16_t delay) { while (delay--) __delay_cycles(TICKS_PER_MS); } /// /// @brief delayI2Cus /// @param delay number of microseconds /// void delayI2Cus(uint16_t delay) { while (delay--) __delay_cycles(TICKS_PER_US); } After many tests, the library is available at http://forum.43oh.com/topic/3619-energia-library-software-i%C2%B2c-master-for-msp430g2553/?p=32365'>[Energia Library] Software I Quote Link to post Share on other sites
L.R.A 78 Posted March 30, 2013 Share Posted March 30, 2013 this is to work with i2c sensors, bus, and that kind of slaves? i've been trying to work with a srf10 but i can only get ranges until 40cm Quote Link to post Share on other sites
Rei Vilo 695 Posted March 30, 2013 Author Share Posted March 30, 2013 This library only implements I L.R.A 1 Quote Link to post Share on other sites
L.R.A 78 Posted March 30, 2013 Share Posted March 30, 2013 dam ricky! got me again! he told me that i could use it with no problem with msp430. gotta see those 5V/3.3V logic converters. You know any good? Thanks! would this work if i use both TX lines?? https://www.sparkfun.com/products/8745 Quote Link to post Share on other sites
Rei Vilo 695 Posted March 30, 2013 Author Share Posted March 30, 2013 LRA: please have a look at http://embeddedcomputing.weebly.com/isup2c-logic-level-converter.html'>I L.R.A 1 Quote Link to post Share on other sites
L.R.A 78 Posted March 30, 2013 Share Posted March 30, 2013 Pretty nice. With the short time we have i wasn't in the mood to study the circuit or search so i was just gona buy it. Your mosfet based circuit is pretty nice and easy to make and also cheapper. Thanks Quote Link to post Share on other sites
Rei Vilo 695 Posted March 30, 2013 Author Share Posted March 30, 2013 You're welcome! The MOSFET circuit is very reliable as it doesn't pack extra-features ICs may include. I use it for the smart sensors I've developed for my industrial robots and models built with the fischertechnik system. This colour recognition sensor is based on a MSP430 and talk through I Quote Link to post Share on other sites
L.R.A 78 Posted March 30, 2013 Share Posted March 30, 2013 hehe i was actualy looking at that sensor before. a litle question. If the stellarpad is 5V tolerant does it mean i don't need that circuit to interface the srf10? and is there anyway that works with analog signals? changing from 5V to 3.3V MCU is kinda of a pain 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.