Msp430f5329 i need simple code to read and write to i2c devices. Captivate design center capacitive touch mcus tools, documentation and software examples to simplify and accelerate capacitive touch designs using msp430 captivate mcus. The library inherits from the stream functions, making it consistent with other readwrite libraries. Software implementation of i2c master protocol for st7 devices. After quite a bit of testing, i think that i have some improvements for the version of software i2c in this thread. I even went so far as using a sparkfuns nxps pca9306 logic voltage converter and it had no effect on the problem. I2c bus uses only two bidirectional opendrain lines.
It seems that the critical item would be timing, since the master is supplying the clock. Using this software, they code in c and upload the code to the microcontroller. I know more than i want to about the i2c interface. So either connect to the pins 9 and 10 or switch to the alternate i2c bus with wire. According to page 17 of the user manual, the msp430g2553 has a universal serial communications interface. Each of these devices is assigned a unique id which distinguishes it from the other devices. Im trying to setup an i2c device and send a byte sequence, but i am having trouble. Altough there is already an application report implementing a usi i2c library, this guide is intended to give a deeper explanation on how the usi module works, together with tips and tricks working with the usi module. Pins 5 and 6 are the i2c lines these will be connected to the msp430 s scl and sda pins which we will configure in software. I2c communication with usi module texas instruments wiki. Some of these chips, though, dont have native spi or i2c. Jul 08, 2012 in this post, i will show a couple of examples of using the msp430 launchpad as an i2c master to communicate with slave devices. System utilities downloads msp430 gang programmer by texas instruments incorporated and many more programs are available for instant and free download. In both examples, the mcu is configured as i2c master.
The first byte transmitted out on the i2c bus is a composition of the slave address and the readwrite bit. Launchpad acting as a master i2c driver writes hello, world and a counter to the g2231 usi i2c slave. It is an interactive debugger for advanced development and in depth firmwarehardware analysis. In this post, i will show a couple of examples of using the msp430 launchpad as an i2c master to communicate with slave devices. Also how would one first start out trying to bitbang. It makes it possible to program i2c devices in scripting languages like python or tcl and can be used for rapid software prototyping, troubleshooting and debugging embedded systems. Simplified interrupt usage master and slave modes up to 400kbps i2c. The two gpios are used to emulate sda and scl signals. Tis msp430 chips are rather interesting theyre low power, very capable, and available for under a dollar in most cases. In this video i use the energia programming environment. Aug 08, 2015 software compile it the library presumably is written for iar or other commercial system. The msp430 board led1 will blink 3 times upon recognition of the spi clock. Remote control module consists of an msp430 mcu as the master chip which is connected with dm355 through the i2c interface. For some reason software serial does not pass all the nmea messages on to tinygps.
I have only used simple slave devices that do not sink the scl line so my older code drove this line without a pullup resistor. I wanted to use the lesser of the two mcus that comes in the package to do something cool. The launchpad act as a master and itg300 act as a slave. Energia library software i2c master for msp430g2553 msp. This video shows how an msp430 can communicate with an arduino using the i2c protocol. Energia library software i2c master for msp430g2553 page.
C, or i squared c master on msp430 devices that only have the usi module for example. In your case youre requesting more bytes then the slave is willing to send so the sda line is just sitting high which is why youre reading in 0xff bytes until the buffer fills up and the nack signal is sent. The i2c code i am using is adapted from the i2c explorer project on 43oh forum. Controlling ad5171 digital potentiometer energia ide is one of the easiest software to program our msp430. Detect your i2c devices slave address using an lcd and a barebones msp430 m430g2553. Sorry for getting off topic, but what you guys were talking. Energia ide is one of the easiest software to program our msp430. Also i added support clock stretching during i2c reads. I2c module generates interrupt on the 9th clock cycle.
C single writeread example electrical engineering stack. You can learn more about getting started with msp430 using energia ide here. The msp430 driver library is a high level, easytouse, abstracted programming interface, which provides simple function calls to enable, configure, and use various msp430 peripherals. The msp430 online emulator provides a complete software model of the msp430 16bit instruction set. The software is available as a component of code composer studio ide desktop and cloud versions, or as a standalone package. All projects can be executed in the supported devices listed in table 1. It is structured such that it can be used to receive. Interintegrated circuit i2c is a synchronous communication bus. This video shows how to configure uart and i2c with a master. I find it amazing that you have so many variants of your peripherals that i can not find code that just works without a lot of messaging. I2c is a serial two wire bus used in microcontrollers systems to communication with devices such as eeprom memories, digital potentiometers, lcd controllers, rtcs and other. This software solution supports transactions on i2c bus with an scl clock frequency of up to 100 khz for master. Master issues start condition, sends slave address for write0b 1010 1110 master sends register address e.
I have lots of examples on using the i2c bus on the website, but many of these are using high level controllers and do not show the. On your raspberry pi run the previously compiled program. In this example, two boards are programmed to communicate with one another in a master writerslave receiver configuration via the i2c synchronous serial protocol. Connect master and slave devices as described in section 3. Once that message is received, it can then be viewed in the slave boards serial monitor window opened on the usb connected computer running the arduino software ide. So, to use i2c in energia ide we have to just include wire. Is it possible to use the msp430 with no i2c hw to function as a slave i2c device. Software compile it the library presumably is written for iar or other commercial system. Software bitmap converter for lcd modbus master simulator. Oct 07, 2014 with energia17 the default pins for the i2c have been changed to pin 9 and 10 so that it is consistent for all launchpads. Shares the clock signal generated by the master with. Contribute to sglee0223msp430 development by creating an account on github. Once the last byte, that is requested, is received by the master, the master will generate a nack and then the master sends the stop signal.
I2c is a two wire interface using the sda serial data line and scl serial clock line pins to communicate over the serial bus. Introduction i2c or interintegrated circuit is a pretty neat communications protocol. Arduino 1, the master, is programmed to send 6 bytes of data every half second to a uniquely addressed slave. The msp430 is one master and the others are silicon devices. I2c communication with pic microcontroller, eeprom. Open source projects msp430 texas instruments wiki. The msp430 driver library is completely open source and is delivered to customers within the msp430ware software and documentation suite. I bought myself couple of msp430 launchpads when they first came out. I am trying to build communication between a sensor and msp430f5438a over i2c. Unfortunately the pin map picture for this launchpad have not been updated so far. Note that the master and slave dont have to be from the same family of devices necessarily. The library code can be downloaded towards the end.
Hello kc, i have looked at the datasheet ass you said but i have some issue to understand the rw bit, so in the msp430 master receiver i have to clear the uctr for reading, set the uctr for writing and in the ntag nfc it says the opposite rw 0write, rw1read. A collection of c libraries for the ti msp430 family of microcontrollers. Library of peripheral drivers, component drivers, utilities, and more. Energia library software i2c master for msp430g2553 43oh. Jan 03, 2011 i bought myself couple of msp430 launchpads when they first came out. How to use i2c communication between msp430 and arduino. Since the readwrite bit occupies the least significant bit position in this first byte, the address appears to be incorrect but its okay. This is a small library that implements an i2c iic, i. Judging from my emails, it is quite clear that the i2c bus can be very confusing for the newcomer. Lately ive been taking advantage of that last advantage. I2c communication with msp430 launchpad circuitdigest. Pins 5 and 6 are the i2c lines these will be connected to the msp430s scl and sda pins which we will configure in software. In order to compile it with mspgcc few modifications are necessary.
I knew there was a software example of driving an i2c device. Several functions of arduinos wire library are used to accomplish this. Sw state machine needed master and slave modes i2c. This should meet most of the i2c master needs for a straight 8 bit protocol. After this initial sequence, when you spi data hello world to the msp430 it will turn on the led1 light. I2c communication with msp430 launchpad circuit digest. However, as we learned previously, they require pullup resistors. Typical values for pullup resistors on an i2c bus range from 4. Write the device address, then the page address, then the value. The usi universal serial interface module which can be found in several msp430 devices can be used either as spi or i2c interface. After checking the example code on the arduino i checked the data flow on buses. Energia library software i2c master for msp430g2553. In this circuit, the master device uses a clock and a data line to communicate with each of the devices connected to the network.
Now to read partid from the sensor im following the steps below. This library allows you to communicate with i2c twi devices. Dec 04, 2012 msp430 i2c slave lcd driven by msp430g2231. The example code is demo how to setup uscib0 i2c master mode and communcation between two msp430g2955 device, if you want to read other i2c device like nt3h1101nt3h1201, the code should refer to the i2c protocol on datasheet as below. After this initial sequence, when you spi data hello world\n to the msp430 it will turn on the led1 light. The i2c protocol involves using two lines to send and receive data. Hi fred, hello paul, i just have a rapid look on the softbaugh web site and it seems that you were right, but if i understand correctly the board use was the d4, with an msp430f4. Save yourself time and frustration by removing the jumper connecting p1.
331 1399 4 1354 1148 742 531 240 1125 695 994 220 410 860 180 938 1363 12 1422 756 1603 249 801 629 1099 1123 946 472 338 1219 402 411 398