Search the Community

Showing results for tags 'msp430f5529'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks


  • Community Calendar

Found 37 results

  1. Hello Forums I am trying to use GUI Composer v2 (on the cloud) to create a GUI for a battery managment system, similar to the one in the SLAA478 Application Report, using the MSP-EXP430F5529LP and bq76PL536EVM-3. I've decided to use USB/Serial comms, which requires me to modify the code to send the information using JSON. I am following the example of using USB/Serial IO: The code given is as follows: #include <aJSON.h> // most launchpads have a red LED #define LED RED_LED //see pins_energia.h for more LED definitions void printled_statewithjson(int state){ aJsonObject* root = aJson.createObject(); if (root == NULL) { return; } aJson.addItemToObject(root, "LED", aJson.createItem(state)); char* string = aJson.print(root); if (string != NULL) { Serial.println(string); free(string); } aJson.deleteItem(root); } // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(LED, OUTPUT); Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level) printled_statewithjson(1); // print json object with LED status set to 1 to UART delay(1000); // wait for a second digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW printled_statewithjson(0); // print json object with LED status set to 0 to UART delay(1000); // wait for a second } I am trying to fully understand this example code, before implementing it into my program. Using CCS Cloud, I stepped through the program in debug mode. From what I understand, the loop() function is essentially the main function, which blinks the LED; setup() does as expected and initializes the MCU LED pin, and opening a serial port at 9600 baud rate. I cannot, however, understand the printled_statewithjson() function. How exactly does it work to be able to send the information? Regards
  2. Hello all I just joined this forum. I am working on aa product which requires rtc time stamp and flash to store some variables Can anybody provide me some libraries related to internal rtc of msp430f5529 and how to write integers to msp flash Also if anyone can provide me library to write anything flash like integers characters etc
  3. Energia and Arduino users eventually get to the point where they need more direct access to the hardware if they take on more complicated projects. In addition to the direct access of registers using the provided header files, TI offers DriverLib which contains abstractions for accessing the peripherals. To better understand the peripherals, and to check out DriverLib, I recently created 20+ short examples for my own edification. All of them were written for the MSP430F5529 LaunchPad and most of the peripherals are covered. In some cases pushbuttons, LEDs, resistors, potentiometer, etc. are required that you probably have on hand. A multimeter is required, and in some cases an oscilloscope and logic analyzer are instructive but not necessary. DriverLib SPI Example 13A_USCI_B_SPI_MCP41010_digiPot All of the examples are located here: It is necessary to have some understanding of the registers before using DriverLib because the DriverLib documentation doesn't describe how the peripherals and their registers work. The documentation for registers is located in the User
  4. Nick Gammon published an interesting post on using SPI on 16 MHz Arduinos to run WS2812 LEDs (aka neopixels) at: He also provides a link with a lot of information about the NRZ protocol used by the WS2812 and tolerances: The tolerances are actually quite a bit looser than what I previously believed. So, I set out to do something similar with Energia and LaunchPads running at different speeds. Spoiler alert: It works. The previously linked articles provide all the background so minimal information is repeated here. NRZ is a one wire protocol that transfers information to the LEDs by varying the length of the signal when high. A longer pulse is used for a 1, and a shorter one for a 0. The timing, with tolerances, is shown in the figure below. The length between pulses cannot exceed about 5 us and most everything else is pretty loose. The protocol is implemented using SPI which I find pretty clever. A byte is sent out with the SPI module with the proper length to represent the desired bit for the protocol. The following must be determined and set to do this: Set proper SPI clock speed using SPI.setClockDivider() in Energia Determine the proper byte to send by SPI.transfer() in Energia to represent a 0 or 1 bit For example, using the MSP430F5529: Clock speed is 25.6 MHz Setting the SPI clock divider to 4 gives a SPI clock of 6.4 MHz and since the SPI block executes in one cycle (Arduino executes in 2), each bit in the byte is equivalent to 156.25 ns. Therefore, to send a pulse indicating a "1", a byte equal to 0b1111000 could be used which gives 4x156.25 = 625 ns. This is in the acceptable range of 550 to 850 ns. Similarly, for a 0 an acceptable byte would be 0b11000000 or 312.5 ns. A similar process can be used to determine acceptable values for the MSP430G2553. The sketch below is a simplification of the library presented by Nick which and includes the modifications described above to run on both the G2553 and F5529. The preprocessor is used to set appropriate values for the clock divider and long and short bytes. The functions are very nearly the same as posted by Nick. Note that interrupts must be disabled before sending data and then reenabled manually after. /* * WS2812 display using SPI on various TI LaunchPads with Energia * * Connections: * LaunchPad LED Strip * --------- --------- * 3V3 5VDC * Pin 15 (MOSI) DIN * GND GND * * How to use: * ledsetup (); - Get ready to send. * Call once at the beginning of the program. * sendPixel (r, g, ; - Send a single pixel to the string. * Call this once for each pixel in a frame. * Each colour is in the range 0 to 255. Turn off * interrupts before use and turn on after all pixels * have been programmed. * show (); - Latch the recently sent pixels onto the LEDs . * Call once per frame. * showColor (count, r, g, ; - Set the entire string of count Neopixels * to this one colour. Turn off interrupts before use * and remember to turn on afterwards. * * Derived from NeoPixel display library by Nick Gammon * * With ideas from: * * Released for public use under the Creative Commons Attribution 3.0 Australia License * * * F Milburn November 2016 * Tested with Energia V17 and WS2812 8 pixel strip on launchpads shown below. */ #include <SPI.h> #if defined(__MSP430G2553) #define SPIDIV SPI_CLOCK_DIV2 // 16 MHz/2 gives 125 ns for each on bit in byte #define SPILONG 0b11111100 // 750 ns (acceptable "on" range 550 to 850 ns) #define SPISHORT 0b11100000 // 375 ns (acceptable "on" range 200 to 500 ns) #elif defined(__MSP430F5529) #define SPIDIV SPI_CLOCK_DIV4 // 25.6 MHz/4 gives 156.25 ns for each on bit in byte #define SPILONG 0b11110000 // 625 ns (acceptable "on" range 550 to 850 ns) #define SPISHORT 0b11000000 // 312.5 ns (acceptable "on" range 200 to 500 ns) #else #error This microcontroller is not supported #endif const unsigned int PIXELS = 8; // Pixels in the strip void setup (){ ledsetup(); } void loop (){ // Show a solid color across the strip noInterrupts(); // no interrupts while sending data showColor (PIXELS, 0xBB, 0x22, 0x22); // single color on entire strip interrupts(); // interrupts are OK now delay(1000); // hold it for a second // Show a different color on every pixel noInterrupts(); // no interrupts while sending data sendPixel(0xBB, 0x00, 0x00); // red sendPixel(0x00, 0xBB, 0x00); // green sendPixel(0x00, 0x00, 0xBB); // blue sendPixel(0xBB, 0xBB, 0xBB); // white sendPixel(0xBB, 0x22, 0x22); // pinkish sendPixel(0x22, 0xBB, 0x22); // light green sendPixel(0x22, 0x22, 0xBB); // purplish blue sendPixel(0x00, 0x00, 0x00); // pixel off interrupts(); // interrupts are OK now delay(1000); // hold it for a second } // Sends one byte to the LED strip by SPI. void sendByte (unsigned char { for (unsigned char bit = 0; bit < 8; bit++){ if (b & 0x80) // is high-order bit set? SPI.transfer (SPILONG); // long on bit (~700 ns) defined for each clock speed else SPI.transfer (SPISHORT); // short on bit (~350 ns) defined for each clock speed b <<= 1; // shift next bit into high-order position } // end of for each bit } // end of sendByte // Set up SPI void ledsetup(){ SPI.begin (); SPI.setClockDivider (SPIDIV); // defined for each clock speed SPI.setBitOrder (MSBFIRST); SPI.setDataMode (SPI_MODE1); // MOSI normally low. show (); // in case MOSI went high, latch in whatever-we-sent sendPixel (0, 0, 0); // now change back to black show (); // and latch that } // end of ledsetup // Send a single pixel worth of information. Turn interrupts off while using. void sendPixel (unsigned char r, unsigned char g, unsigned char { sendByte (g); // NeoPixel wants colors in green-then-red-then-blue order sendByte (r); sendByte (; } // end of sendPixel // Wait long enough without sending any bits to allow the pixels to latch and // display the last sent frame void show(){ delayMicroseconds (9); } // end of show // Display a single color on the whole string. Turn interrupts off while using. void showColor (unsigned int count, unsigned char r , unsigned char g , unsigned char { noInterrupts (); for (unsigned int pixel = 0; pixel < count; pixel++) sendPixel (r, g, ; interrupts (); show (); // latch the colours } // end of showColor The timing, when checked on a logic analyzer, checks out with the calculations above (hooray for math). The "gaps" between pulses are within tolerance and largely set by code overhead as well as the byte being sent. And here it is showing the strip lit up in one color. I tried this on several other LaunchPads I had handy and here is a summary: FR6989 - I had never noticed, but Energia defaults to 8 MHz. Doing the math, there isn't a good match to the WS2812 requirements without changing processor speed (which I did not try). MSP432 - there was behavior I couldn't explain, probably due to RTOS and I didn't pursue this for long. In summary, the method works although I did limited experimentation. It would be even easier to implement outside of Energia with full access to clocks. It was an interesting exercise but alternative methods have been posted here on 43oh with tuned assembler and having used those successfully in the past, I will probably continue to preferentially use them in the future.
  5. Hello Everybody, I am using a MSP430F5529 Launchpad with Energia IDE in order to measure the current flowing on the motor. But I have a problem with sampling rate. The current that I want to measure has a 22kHz frequency and I have a 10kHz sampling rate. I would like to have a 200kHz sampling frequency. I found in an other topic that the sampling rate can be reduce because of the serial.print. So, I stored my values in a array before displaying them. i have a better sampling (10kHz) but not enough. Could you tell me how can I improve the sampling rate ? Attached the sketch. Thank you. Sketch Current Measurement .txt
  6. Hello, I am trying to interface mlx90614 IR temperature sensor with MSP430f5529. Initially i interfaced this sensor with arduino uno without any problem. I could even fetch object and ambient temperature. But when it came to interfacing with MSP430 board using i2c. Kindly guide me for this. Regards.
  7. Hello! I am using Energia 17 & 18 to code for the MSP430F5529 and ADXL345. The following is the code I used. //Add the SPI library so we can communicate with the ADXL345 sensor #include <SPI.h> //Assign the Chip Select signal to pin 2. int CS = 2; //This is a list of some of the registers available on the ADXL345. //To learn more about these and the rest of the registers on the ADXL345, read the datasheet! char POWER_CTL = 0x2D; //Power Control Register char DATA_FORMAT = 0x31; char DATAX0 = 0x32; //X-Axis Data 0 char DATAX1 = 0x33; //X-Axis Data 1 char DATAY0 = 0x34; //Y-Axis Data 0 char DATAY1 = 0x35; //Y-Axis Data 1 char DATAZ0 = 0x36; //Z-Axis Data 0 char DATAZ1 = 0x37; //Z-Axis Data 1 //This buffer will hold values read from the ADXL345 registers. char values[10]; //These variables will be used to hold the x,y and z axis accelerometer values. long x,y,z; void setup(){ //Initiate an SPI communication instance. SPI.begin(); //Configure the SPI connection for the ADXL345. SPI.setDataMode(SPI_MODE3); //Create a serial connection to display the data on the terminal. Serial.begin(115200); Serial.println("GO!"); //Set up the Chip Select pin to be an output from the Arduino. pinMode(CS, OUTPUT); //Before communication starts, the Chip Select pin needs to be set high. digitalWrite(CS, HIGH); //Put the ADXL345 into +/- 4G range by writing the value 0x01 to the DATA_FORMAT register. writeRegister(DATA_FORMAT, 0x00); //Put the ADXL345 into Measurement Mode by writing 0x08 to the POWER_CTL register. writeRegister(POWER_CTL, 0x08); //Measurement mode } void loop(){ //Reading 6 bytes of data starting at register DATAX0 will retrieve the x,y and z acceleration values from the ADXL345. //The results of the read operation will get stored to the values[] buffer. readRegister(DATAX0, 6, values); //The ADXL345 gives 10-bit acceleration values, but they are stored as bytes (8-bits). To get the full value, two bytes must be combined for each axis. //The X value is stored in values[0] and values[1]. x = ((long)values[1]<<8)|(long)values[0]; //The Y value is stored in values[2] and values[3]. y = ((long)values[3]<<8)|(long)values[2]; //The Z value is stored in values[4] and values[5]. z = ((long)values[5]<<8)|(long)values[4]; //Print the results to the terminal. Serial.print(x); Serial.print('\t'); Serial.print(y); Serial.print('\t'); Serial.println(z); delay(100); } //This function will write a value to a register on the ADXL345. //Parameters: // char registerAddress - The register to write a value to // char value - The value to be written to the specified register. void writeRegister(char registerAddress, char value){ //Set Chip Select pin low to signal the beginning of an SPI packet. digitalWrite(CS, LOW); //Transfer the register address over SPI. SPI.transfer(registerAddress); //Transfer the desired register value over SPI. SPI.transfer(value); //Set the Chip Select pin high to signal the end of an SPI packet. digitalWrite(CS, HIGH); } //This function will read a certain number of registers starting from a specified address and store their values in a buffer. //Parameters: // char registerAddress - The register addresse to start the read sequence from. // int numBytes - The number of registers that should be read. // char * values - A pointer to a buffer where the results of the operation should be stored. void readRegister(char registerAddress, int numBytes, char * values){ //Since we're performing a read operation, the most significant bit of the register address should be set. char address = 0x80 | registerAddress; //If we're doing a multi-byte read, bit 6 needs to be set as well. if(numBytes > 1)address = address | 0x40; //Set the Chip select pin low to start an SPI packet. digitalWrite(CS, LOW); //Transfer the starting register address that needs to be read. SPI.transfer(address); //Continue to read registers until we've read the number specified, storing the results to the input buffer. for(int i=0; i<numBytes; i++){ values = SPI.transfer(0x00); } //Set the Chips Select pin high to end the SPI packet. digitalWrite(CS, HIGH); } The output is all -1,-1,-1. When I moved the ADXL345 module, they became 0,0,0 or some wired combinations like -1,0,-678234. Can someone help me to see what is wrong with the code? I changed the chip select pin numbers when I code for them and I am using USCIA port. This code is from other places. Thanks! Yutao Li
  8. Hello everybody, I would like to measure the speed rotation of a motor. For this, i use a photodiode. The signal waveform is given by the picture. I want to measure this signal frequency using the MSP430F5529 and Energia and display it in the serial monitor. I know i have to use the Timer A in Capture/Compare mode but I don't know how. I saw a lot of codes but they use CCS and the MSP430g2553 and it is not clear for me. How can I proceed to measure the frequency of my signal ? The frequency can vary from 50Hz to 500Hz. Thank you for your help.
  9. I like the boosterPack concept, but for my current project I needed access to all the pins on an F5529 as well as an F2013. So, I constructed a couple of boards to plug into an MSP-TS430PN80USB in a boosterpack fashion. As is probably obvious, I missed a couple of traces (GND lines), for which I had to add the little green wires. The top board has all my sensors, and the bottom is basically battery management and a sx1509 port expander to manage a number of LEDs. I don't actually need the extra ports, but I wanted the sx1509's built-in LED "breathe" capability. Saves coding... -lazy programmer I was a happy camper when I fired-up the system and was able to access and program both MCUs. I've found that I can choose between running two instances of IAR (or CCS) and debug both micros simulaneously. Handy for the comms and interrupt handing. So, let the fun begin... BTW - the TFT LCD is from - 2.8" TFT with Cap touch (about $15.00 U.S.). It's using the ILI9341 controller for the LCD and the FT6206 controller for the cap touch. For proof of concept I was able to use the Adafruit sketches to connect with both, and the edits were limited to pin assignments, if I remember correctly.
  10. While trying to incorporate Adafruit's FT6206 library (capacitative touch for a TFT LCD) after calling the constructor: Adafruit_FT6206 ctp = Adafruit_FT6206(); a following call to: ctp.begin() would hang. While stepping in with the CCS debugger I finally found (after a couple of hair-pulling hours) in the call stack that there were a number of calls to Serial.print() to enumerate and display the registers and status of the FT6206. My solution, which leaves me wondering if there's not a better way, is to wrap their calls in a #ifdef/#endif regarding a debug console for the hardware serial port on my msp430F5529. So, is there a more elegant solution? Thx, Bob
  11. My wife wants to know that when I do my John Muir Trail trek starting on 7/26/2016 I've not fallen down and can't get up, or been eaten by a bear... So, I've been building my DIY "SpotMe" Iridium Network-based GPS-Satellite Comm device. I've gotten to the basic level of communication; It reports my position on a regular basis (the following is from a morning conditioning hike). To my surprise, when I set the deconstructed system up on my kitchen table, it managed to both get a GPS fix AND successfully transmit the data to an Iridium satellite. Given that there is really no "sky" visible from my kitchen, a better than expected performance! Why build it when I could buy similar? Well, why not??? Similar to Dave Jones' "take it apart" I'm a firm believer in DIY to figure out how something works, and can I make one... Future travel plans: I do "Iron Butt" rides on my 2005 ST1300 - now with 175,000+ miles (there's no typo there, I've really driven that far on my bike...), and I'm planning to do 300 mile sections of the Pacific Crest Trail for the next 10 years. So, again, keeping the wife happy and "in the know." So, this will be something I plan to use on a regular basis over the next several years. Once finished with the project I will publish all code, hex and design files for those who have an interest. Finally, thanks to all who have helped me. Especially Robert Woodruff, yyrkoon, and Spirilis. Bob - currently stale content, updates planned for after the hike and teaching again... On 7/14/2016 at 09:01:47 PDT Bob was here:,-122.432641 -Aprx Elev.: 1676 ft On 7/14/2016 at 09:14:44 PDT Bob was here:,-122.428550 -Aprx Elev.: 1645 ft On 7/14/2016 at 09:25:53 PDT Bob was here:,-122.433725 -Aprx Elev.: 1644 ft On 7/14/2016 at 09:36:38 PDT Bob was here:,-122.431888 -Aprx Elev.: 1784 ft On 7/14/2016 at 09:50:50 PDT Bob was here:,-122.431873 -Aprx Elev.: 1743 ft On 7/14/2016 at 10:05:25 PDT Bob was here:,-122.427476 -Aprx Elev.: 1564 ft On 7/14/2016 at 10:16:14 PDT Bob was here:,-122.423606 -Aprx Elev.: 1740 ft No visible sky, from inside my kitchen: On 7/14/2016 at 11:34:57 PDT Bob was here:,-122.471001 -Aprx Elev.: 593 ft
  12. Since my only 5529LP was confirmed no longer functioning properly and the likely cause is the USB hub module, there have been some thoughts going through my mind to salvage the core 5529 device on the LP for some good use. And this weekend I have decided to give it a try. As the USB host part is confirmed not functioning, the first step is to verify the F5529 is still good. The easiest way is to try program it and check if it can run new program. With a good F5529 LP (the new replacement board ordered after the old one retired), I removed all the jumpers between the ez-FET and the target device, and then wired the GND, 5V, 3V3, RXD, TXD, SBW RST, and SBW TST from the good ez-FET to the 5529 side of the old LP. This will also power up the old board from the new one as the USB host on the old board is dead and no longer powering it. Soon after an example Energia sketch of SerialCallResponseASCII is uploaded through the new, good board, the good news is displayed on the Serial console confirming the 5529 device is still working flawlessly. At this point, I came into realization that this board can no longer be a handy development board as it once was but only good for deployment, possibly permanently, to some project because I have to rely on that good LP every time for programming. But wait, I recall recently from the forum there are some posts mentioning Forth interpreter for MSP430, one of which by monsonite with comprehensive information on various Forth offerings. However, a common requirement for Forth is serial communication for the console that my old LP is no longer capable to provide with a dead USB hub. Even though I don't have serial to usb converter to bypass the on-board hub for direct serial connection, I remember there is an old Arduino Pro Mini laying around without much used. Combining these two, I could probably build a utility development board that provide ad hoc programming capability (in Forth) on the 5529LP provide the console access required by Forth on the 5529LP via the Arduino Pro Mini (forward the serial communication from the Arduino UART to the 5529LP TX/RX) power the 5529LP via the 5V and 3V3 pin from the Arduino Pro Mini All in all, the goal is to take the Arduino Pro Mini as the controller or programmer of the 5529LP that is programmed to run Forth only. I picked the Mecrisp as it provided out of the box support for the 5529LP and pre-compiled hex file. So the build begin by first flashing the Forth hex file to the 5529LP. Again it required a good 5529LP and I used the latest MSPFlasher for the job. The following is the command line (for Windows). MSP430Flasher.exe -w "forth-mecrisp-5529.hex" -v -g -z [VCC] For a more decent looking of this utility development board, the Pro Mini is mounted to a medium sized breadboard on one end, and with four metal pins (pulled from left over connectors), the 5529LP is somehow "mounted" to the other end. This is enough for some structural support for the 5529LP Now for the Arduino side. Since there is only one set of UART on the Pro Mini, the program on it make use of the SoftSerial library that will emulate another serial port by two digital pins to relay the serial messages from the real UART to the 5529LP. Finally the moment of truth, the serial console to the Arduino is opened for a test. Apart from the line feed being weird, the expression run (1 2 + .<cr>) is successful, so is the programming of the blinky program Moving forward, the Arduino can be programmed in such a way that not only merely relaying serial message, but parse special commands to initiate specific Forth programming to the 5529LP (the Forth programs themselves stored as program in the Arduino). Hopefully this will make the whole package more versatile and practical.
  13. from now UIPEthernet library (v02) are available for MSP430F5529LP too please check on stellarisiti energia forum:
  14. I am working on a school project that requires me to use the MSP430 microprocessor. While the entire class is working primarily with the MSP430G2553 launchpad, I have elected to use the MSP430F5529 launchpad as it uses a superior microprocessor in every respect. I have experience programming AVR chips and I could draw the minimum circuit for the ATMEGA1284p and ATMEGA328p blindfolded, I cannot seem to find a schematic of the minimal circuit for the MSP430F5529 on the web anywhere. Also I would like to point out that as an AVR guy, the documentation provided from Ti is pretty bad by comparison. Any information on these two topics would be helpful.
  15. Some time back I ordered an INA125P Instrumentation Amplifier in order to fool around with a cheap, broken "postal" scale that I had. It arrived and I promptly put it away and forgot it about it. So the other day I was digging through my junk box, saw the scale, and decided to tear it apart. Since it is getting near Halloween, and I knew my grandchildren would be interested, I wrote a little sketch in Energia to estimate the amount of candy in a bowl. Here is a schematic of the circuit. It "works" but given my skills it may not be best. This being a MSP430 project I hooked up the sleep pin on the INA125P. I also made it where I could change out Rg, the gain controlling resistor, easily. Once I had it working I made up a little BoosterPack that goes on the bottom of the LaunchPad. The INA125P sits between the daughter board and the MSP430F5529 LaunchPad - you are looking down on the male pins in the photo above. I hot glued a piece of cardboard on the bottom so as to reduce the chance of shorts and provide a reminder on how to connect it. Below is a view from the bottom with it connected up to the LaunchPad and the scale. The sketch is here on github. There is a little calibration routine it goes through when started up where it asks for the empty bowl and then a known quantity of candy to be placed into it. After that, it displays on a SHARP96 BoosterPack. I thought about connecting it up to the IOT, but after due consideration decided I didn't want the neighborhood kids knowing how much candy I have left.
  16. Here is some code to drive ws281x strips using DMA driven SPI for the msp430f5529. I hadn't seen any example code showing how to use DMA and SPI. The example also provides some code that shows how to use inline asm that will work with both msp430-gcc and msp430-elf-gcc. The code below was tested with a ws2811 strip and msp430-elf-gcc. -rick
  17. Hi Everyone, Anyone has tried the connection already by SPI? Any sample code available? Thanks
  18. Hello! So I'm building a robot that is eventually supposed to implement an autonomous functionality, which means obstacle avoidance. I'll be using the HC-SR04 as the ultrasonic sensor of choice. I started out by verifying that the sensor works by running it using Energia, which is the standard "loop infinitely and take a measurement every so many microseconds". In my actual application, however, I want to send out a pulse on command. So when I say so, the ultrasonic will do a measurement (or an average of a few measurements) to tell me if an object is in the path of my robot or not. My actual code is a combination of C (my main function) and a modification of the original Energia project I started with, whose functionality I call from my main application. In my application I'm using uart interrupts on both A0 and A1, and when a certain character is received by A1 I want to access the ultrasonic sensor and take a reading to see if there is an object in the way of my robot or not. There are a few issues that I've been having. The first is that the micros() function doesn't work, so I've taken to making my own delays by using a volatile integer and burning clock cycles that way. The main issue that I'm having (and the reason for this post) is that no matter what I do, the pulseIn() does not work properly. I've pasted the relevant code below. Note that the sensors.cpp file was originally made in Energia, then imported into code composer so that it could be integrated with the main.c file. So this is how my code works. In main.c, U1 will receive an 'I' as an interrupt. In this case, I will call the function fwd(). In the fwd() function, I call the function detectUltraFwd(), which is in sensors.cpp. (It's labeled fwd because later there will be a second ultrasonic sensor for the reverse direction). detectUltraFwd() calls detectUltrasonic(int trig, int echo), where "trig" and "echo" are the specific pins where the ultrasonic sensor is connected to the msp. (Note again, this file came from Energia, so it's a little different than a standard code composer c file). The problem arrives at the line with the pulseIn() function, which was taken from Arduino. According to the function, 0 is returned when there was no measured pulse within the specified timeout. I've tried timeout values varying from 100us to 1s, the maximum value for the function, to no avail. This function always returns 0 and I don't know why. I'm not sure if it's even possible to take a single sample using an ultrasonic sensor. I've tried having the detectUltrasonic() function loop a few times in case just the initial reading was zero, but that wasn't it. The conclusion that I've come to is that it has something to do with micros() not working. Since I'm using interrupts, calling micros() will return 0. (Which is why I'm using the volatile integers to pass time. And yes, I am well aware that I need to play around with the timing to get it close enough to the values I want.) So maybe it's possible that I just don't have my loops timed right, but I ran the original Energia infinite loop code using my made up senswait() function and it worked, so I don't think that's the case. Any insight / help with this matter would be appreciated. My initial searches did not show a resolution to this issue. main.c: #include <msp430.h> #include <string.h> #include <stdlib.h> #include "motors.h" // my file used for motor control #include "sensors.h" // my file used for sensor control int sensingDist=46; //cm int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT // initialize A0 uart for communication P3SEL = BIT3+BIT4; // P3.4,5 = USCI_A0 TXD/RXD UCA0CTL1 |= UCSWRST; // **Put state machine in reset** UCA0CTL1 |= UCSSEL_2; // SMCLK UCA0BR0 = 9; // 1MHz 115200 (see User's Guide) UCA0BR1 = 0; // 1MHz 115200 UCA0MCTL |= UCBRS_1 + UCBRF_0; // Modln UCBRSx=0, UCBRFx=0, over sampling UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt // initialize A1 uart for communication P4SEL |= BIT4+BIT5; // P4.4,5 = USCI_A1 TXD/RXD UCA1CTL1 |= UCSWRST; // **Put state machine in reset** UCA1CTL1 |= UCSSEL_2; // SMCLK UCA1BR0 = 9; // 1MHz 115200 (see User's Guide) UCA1BR1 = 0; // 1MHz 115200 UCA1MCTL |= UCBRS_1 + UCBRF_0; // Modln UCBRSx=0, UCBRFx=0, UCA1CTL1 &= ~UCSWRST; // **Initialize USCI state machine** UCA1IE |= UCRXIE; // Enable USCI_A1 RX interrupt // Set the pinout for the motor controller. setup(); // see motors.h P1DIR |= 0x01; // set blue led as output 1.0 P4DIR |= 0x80; // set green led as output 4.7 P4OUT |= 0x80; // turn on green led P1OUT &= ~0x01; // turn off blue led __bis_SR_register(LPM0_bits + GIE); // Enter LPM0, interrupts enabled __no_operation(); // For debugger } // lots of irrelevant code was removed, including the A0 interrupt. // USCI_A1 interrupt -- bluetooth module (or terminal if debugging) #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=USCI_A1_VECTOR __interrupt void USCI_A1_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(USCI_A1_VECTOR))) USCI_A1_ISR (void) #else #error Compiler not supported! #endif { switch(UCA1IV) { case 0:break; // no interrupt case 2: // RXIFG - received a character! if('I' == UCA1RXBUF) { // Move forward fwd(); } break; case 4: break; // TXIFG - sending a character default: break; } } void fwd() { // Check to see if there's an object in the way int dist = detectUltraFwd(); if(dist > sensingDist) // if the returned distance is greater than sensingDist, we can freely move forward. { forward(rotateSpeedFB, rotateLengthFB); // see motors.h - tells the robot to move forward. } else // otherwise the ultrasonic sensor has detected an object in the way. blink the blue led a couple times as an indication. { toggleBlue(); volatile int c = 0; for(c=0; c<10000; c++); toggleBlue(); for(c=0; c<10000; c++); toggleBlue(); for(c=0; c<10000; c++); toggleBlue(); for(c=0; c<10000; c++); toggleBlue(); } } sensors.cpp #include "Energia.h" #include "sensors.h" const int ultraTrigFwd = P3_5; const int ultraEchoFwd = P3_6; int detectUltraFwd() { return detectUltrasonic(ultraTrigFwd, ultraEchoFwd); } //ultrasonic function int detectUltrasonic(int trig, int echo) { long duration, cm; // set pin as output pinMode(trig, OUTPUT); // set it low & wait 2us - in order to get a clean signal. digitalWrite(trig, LOW); senswait(3); // Then set it high for 5 us - i.e. begin taking the measurement. digitalWrite(trig, HIGH); senswait(10); digitalWrite(trig, LOW); // now stop taking the measurement //setting up input pin, and receiving the duration in microseconds pinMode(echo, INPUT); duration = pulseIn(echo, HIGH, 1000); // *** THIS RIGHT HERE ALWAYS RETURNS ZERO *** cm = microSecondsToCentimeter(duration); return cm; } long microSecondsToCentimeter(long microseconds) { //The speed of sound is 340 m/s or 29 microseconds per centimeter. //Convert speed return microseconds/29/2; } // This function is being used since micros() will always return zero. So I'm burning clock cycles this way. void senswait(int delay) { for(int i=0; i<delay; i++) { volatile unsigned int x; x = 5000; do x--; while(x !=0); } } If there are small issues like a missing function declaration or header or something, it's because I've had to remove the rest of my project that was irrelevant to my question; my entire code does compile and run! Last notes: the puleIn() function comes directly from Energia. My suspicion is that is somehow is using time, though I did take a look at it and between the bitmasks and counting I didn't see an explicit call to micros() but I'm not sure. All I know is that pulseIn() always returns zero even when I know it shouldn't be. Also if I've violated some rule or completely missed another forum post that's relevant please nudge me in the right direction. And thanks in advance for any help!
  19. Hello! I am a fresh beginner in the domain of embedded systems and this MSP430F5529 is my very first development board. I am now trying to make an ADC conversion and send it through the UART to try a signal treatment algorithm with real-world values. I used an example code in Energia that i modified a little bit: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); // Comment: I see many people preferring the 115200 BR for this board. // Is there a particular reason for this choice? } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin A3: int sensorValue = analogRead(A3); // Comment: I think the F5529 actually writes its ADC results on 12 bits. // Should i try to use a long, 16-bit integer? // print out the value you read: Serial.println(sensorValue); } The Energia console gives me expected readings, using an AA battery and an old function generator. For my first UART tests, I tried using Processing, a multipurpose javascript program that i use for drawing. import processing.serial.*; float[] y; // Array to contain the values read through the UART Serial myPort; // Create object from Serial class int val; // Data received from the serial port void setup() { // I define the size of the drawing board to be 600 X 400 pixels. size(600, 400); // I initialize my 'y' array y = new float[width]; for(int i = 0; i<width; i++){ y[i] = 0.0; } // This is to open the correct port. The number in square brackets might vary. String portName = Serial.list()[3]; // Here i define the baudrate, so it's the same as the one in Energia. myPort = new Serial(this, portName, 9600); } void draw() { // This draws a white background background(255); // This tells that i want to draw with the color black. stroke(0); for (int i = 0; i<width; i++){ // For every entry in my 'y' array, I draw a black dot. point(i,y[i]); } // I read a new value from the UART and feed it to my "update" routine. val =; update(val); } void update(int value){ // I shift every value to the left in my array. // This is to get a "strip-chart" feeling to my graph. for (int i = 0; i<width-1; i++){ y[i] = y[i+1]; } // For the last value, i use the value read from the serial port. // I convert it so that i have a correspondance: // min(UART) = bottom of screen, max(UART) = 2^12 - 1 = 4095 = top of screen. y[width-1] = (float)height - value * (float)height / 4095.0; // I also print the UART read value to this software's console for debugging. print(value,"\n"); } What prints on the console is a repetitive pattern of something like 13-10-48-13-10-48-etc. when my pin is grounded. When it's not grounded i get pretty much the same exact numbers with a little bit more variations. At first I thought it was a long int problem with the UART, beacause of the 12-bit ADC conversion, but i'm not so sure anymore. Help me! Thank you very much! readVoltage_ver1.ino
  20. Hi, I'm trying to read analog values from a SHARP IR sensor GP2Y0A41SK0F using the MSP430F5529 launchpad. There was not any error when I verified and uploaded the codes in Energia. However, when I clicked on the Serial Monitor, nothing showed up. But when I chose the MSP430G2452 from the "Tools" menu, the monitor successfully showed the analog values. I connect Vcc (red wire) to 5 V pin, the ground (black wire) to GND pin, and the analog output (white wire) to P6.4 pin/A4 pin. The same thing also happened to the MSP430G2553 launchpad. It only works when MSP430G2452 is selected. I looked at the codes very thoroughly but I couldn't see any mistakes: const int IR = A4; void setup() { Serial.begin(9600); } void loop() { int maxVal = 0, minVal = 1024, n=200; float x_i, total=0, mean; for (int i=1; i <= n; i++) { x_i = analogRead(IR); total += x_i; Serial.println(x_i); if (x_i < minVal) { minVal = x_i; } if (x_i > maxVal) { maxVal = x_i; } } mean = total / n; Serial.print("minimum = "); Serial.print(minVal); Serial.print(", maximum = "); Serial.print(maxVal); Serial.print(", total = "); Serial.print(total); Serial.print(", mean = "); Serial.println(mean); delay(100); }
  21. Model of LaunchPad used and rev. #: MSP430F5529 Rev.1 Launchpad Evaluation Kit, Bundled with the CC3100EMUBOOST and CC3100BOOST Model of MCU: MSP430F5529 Model of BoosterPack/Sensor used: SimpleLink Wi-Fi CC3100BOOST, with Analog Devices ADXL001-70BEZ (Personally designed SMD eval. board) Link to the sensor datasheet: ADXL001 Rev.A Datasheet Name and version of the IDE used: Energia 14 (0101E0014) OS the IDE is running on: Windows 8.1 64 bit Whenever possible, minimal code to replicate the issue: Will post after I can pinpoint what I'm trying to ask. Hello all! Okay, so I guess I'll start with a few simpler questions I'm seeking an answer to. While looking through the Energia files, I came across "adc12_a.c" and "wiring_analog.c", yet they both seem to provide functionality for initializing analogRead/ADC. I'm looking to change some of the timings around, but I'm not sure if 'adc12_a.c' is even used; my testing appears to not show any differences with code changes there. However, "wiring_analog.c" does! What is the proper way of going about making some modifications? A few specifics as to why: I'm developing a system to detect vibrations, using the Analog Devices ADXL001_70BEZ. This is the +-70G, 3.3V/5V option they have. I've designed a little breakout board including a passive low-pass filter, a unity gain, non-inverting voltage follower buffer, and the datasheet's recommended 100nF cap. Great. Now for sampling! Being an analog device, I intend to take samples at a target rate of 40kHz, so I can hopefully get viable readings for FFT at 20khz. In 3.3V mode, there is 16.0mV/G sensitivity. In 5V mode, 24.2mV/G sensitivity. Note, I am a one man team for this entire project. I have done the circuit design, MSP programming, node.js/d3.js/mySQL/PHP/HTML front-end/back-end all alone... I've settled on using IBM's Bluemix as a cloud host, with an MQTT websocket protocol for interfacing the MSP430F5529 to the IOT webapp we've got going on. I only state all this to give an idea of how stretched my brain is with all this. Anyhow... I first started using the ADXL001 in 5V mode, with the thinking that I would just "Get the damn data now!" and worry about going low-power in later prototypes. I can read from my ADC inputs just fine. For all my preliminary testing, I had the CC3100 Boosterpack unconnected. I used a resistor voltage-divider to knock the ADXL's output down to a safe level. 0 G's should read a typical of 2.5V according to the sheet. With the voltage divider, it does read a nice dead center 1.65V. Good. Now, the noise. This is where I need more information. There -seems- to be a good deal of it. I am unsure as to what the best way to proceed would be. I want to play with ADC software settings and initialization first to attempt to reduce this. Being an analog sensor, I realize there will be noise no matter what. Eventually, I mayyyy be using a 5th order butterworth low-pass filter, but again, I'd like to tackle software first. I read ADC as follows: startT = micros(); for(ict=0; ict<idx; ict++){ samples[ict] = analogRead(A12); } endT = micros(); where idx is the maximum number of samples I want to keep. Great. Now where I'm utterly confused: In "wiring_analog.c" at the #if defined(__MSP430_HAS_ADC12_PLUS__) part of it's analogRead() function, we have all the initialization stuffs. I've been using a mix of "adc12_a.h" "adc12_a.c" "wiring_analog.c" and "msp430f5xx_6xxgeneric.h" to kinda try to jump around and figure out what's happening. NOTE: Many of the ADC12 "Default" values in the comments of "adc12_a.c" are not actually the default... When I noticed this, I stopped tweaking that, and jumped to "wiring_analog". So, with my StartT and endT times in micros, and the number of samples I'm taking, I'm getting a rudimentary way of calculating my sampling frequency. (around 44kHz) Back to "Wiring_analog": I have it use ADC12SSEL_0 as clock source, and ADC12DIV_2 as clock divider. I also use ADC12SHT0_0 which should be a Sampling Timer hold of 4 cycles. I am shooting in the dark with all of this due to my lack of understanding. All I know is that I've been getting around a calculated 44kHz sampling rate. But perhaps this is a big source of my noise? I wish I knew how to better understand this. I also was looking at Page 5 of for the F5529 pin location of VREF+/VREF- .... Pins 9 and 10 respectively. I looked there because of Page 727 of describing using an external reference. Would using an external reference help? I could always bump the ADXL's power down to 3v3 V, (this would lower the noise floor, but also sensitivity, no?) I am against the idea of sampling and averaging; it seems to throw off FFT at higher frequencies in my range. For testing FFT, I am using a modified version of which has processing do serial reads, so I can visualize the sensor readings. It then saves the data to a csv file, and there's a python script for doing the FFT. I could be so way off base with some of these methods, but I am here to learn. I've gotten this far by breaking down each problem into a smaller one, and have had a lot of fun learning what I have so far! Now, there are so many pieces that I am nervous to continue down any set path in fear of wasting time with a better alternative. I know this was probably a doozy to read. I'm hoping it won't scare off the knowledgeable who can help me... I did read somewhere that the best way to get an answer online is to post the wrong way of doing things... but I'm not from that circle of thinking. I'll be happy to answer any further questions. Thanks! Oh! Also, are there any decent IRC resources for Energia/MSP? What I mean is, which would be more viable for answers; the forum, or #energia or #43oh? OH! Another thing! Is there a way I can lock into a certain sampling frequency? Every few sets of sampling intervals will have a slightly lesser frequency. This is gonna add up and throw off FFT. I also read about putting the MCU in low-power, then turning on only ADC12 for better results? Thoughts?
  22. Hello everebody. I am new in this field and i cannot connect msp430f5529LP with mspdebug. This is my code: $ dmesg ..... [ 5799.999208] usb 1-2: new full-speed USB device number 8 using xhci_hcd [ 5800.015833] usb 1-2: New USB device found, idVendor=0451, idProduct=2046 [ 5800.015842] usb 1-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 5800.016156] usb 1-2: ep 0x81 - rounding interval to 1024 microframes, ep desc says 2040 microframes [ 5800.016464] hub 1-2:1.0: USB hub found [ 5800.016570] hub 1-2:1.0: 4 ports detected [ 5800.571488] usb 1-2.2: new full-speed USB device number 9 using xhci_hcd [ 5800.591067] usb 1-2.2: New USB device found, idVendor=2047, idProduct=0013 [ 5800.591075] usb 1-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 5800.591079] usb 1-2.2: Product: MSP Tools Driver [ 5800.591082] usb 1-2.2: Manufacturer: Texas Instruments [ 5800.591085] usb 1-2.2: SerialNumber: 644F0C4716002000 [ 5800.591367] usb 1-2.2: ep 0x81 - rounding interval to 1024 microframes, ep desc says 2040 microframes [ 5800.591406] usb 1-2.2: ep 0x83 - rounding interval to 1024 microframes, ep desc says 2040 microframes [ 5800.592584] cdc_acm 1-2.2:1.0: This device cannot do calls on its own. It is not a modem. [ 5800.592631] cdc_acm 1-2.2:1.0: ttyACM0: USB ACM device [ 5800.593641] cdc_acm 1-2.2:1.2: This device cannot do calls on its own. It is not a modem. [ 5800.593694] cdc_acm 1-2.2:1.2: ttyACM1: USB ACM device and biotin@debian:~/mikro$ mspdebug --usb-list Devices on bus 004: 004:002 8087:0024 004:001 1d6b:0002 Devices on bus 003: 003:004 0489:e056 003:003 0bda:0129 [serial: 20100201396000000] 003:002 8087:0024 003:001 1d6b:0002 Devices on bus 002: 002:001 1d6b:0003 Devices on bus 001: 001:009 2047:0013 001:008 0451:2046 001:003 04f2:b33b 001:002 046d:c52f 001:001 1d6b:0002 biotin@debian:~/mikro$ connect attempt with debugger: 1) biotin@debian:~/mikro$ mspdebug uif -d /dev/ttyACM1 MSPDebug version 0.22 - debugging tool for MSP430 MCUs Copyright (C) 2009-2013 Daniel Beer <> This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Trying to open /dev/ttyACM1 at 460800 bps... Initializing FET... comport: read error: Connection timed out fet: open failed Trying again... Initializing FET... comport: read error: Connection timed out fet: open failed biotin@debian:~/mikro$ 2) biotin@debian:~/mikro$ mspdebug rf2500 MSPDebug version 0.22 - debugging tool for MSP430 MCUs Copyright (C) 2009-2013 Daniel Beer <> This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. usbutil: unable to find a device matching 0451:f432 3) biotin@debian:~/mikro$ mspdebug tilib MSPDebug version 0.22 - debugging tool for MSP430 MCUs Copyright (C) 2009-2013 Daniel Beer <> This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. tilib: can't find cannot open shared object file: No such file or directory Which driver is Correct? What is wrong? With Energia everything is ok. Thank you guys.
  23. Hi guys, I am working on a project and am in need of a second WiFi booster pack for my MSP430f5529LP. I have been using energia code as a base for my project and it has been working great, but I recently decided I need a second MSP + BoosterPack. Anyways, the TI store doesn't seem to be offering the CC3000 booster pack right now so I am wondering how easy it is to make my cc3000 code compatible with the cc3100 or cc3200 BoosterPack. Does anyone have experience with this upgrade? Thanks for the information.
  24. I found out from this post that there are 14 PWM outputs possible on the MSP430F5529 microcontroller, and 10 PWM outputs possible on the MSP430F5529 Launchpad. How many are possible when using Energia? I think it is less, but I can't tell from the .h file. I will be using a custom BoosterPack so it doesn't have to stick to that standard. Thanks, Ben
  25. MSP430F5529 has two I2C interfaces, using P3.0/P3.1 (SDA/SCL) and P4.2/P4.1 (SCL/SDA) and two SPI interfaces using P3.0/P3.1/P3.2/P2.7 (MOSI/MISO/SCK/CS) and P4.2/P4.1/P4.3/P4.0 (MISO/MOSI/SCK/CS). How, or rather maybe, what is the best way to access the non-default I2C/SPI peripherals, without resorting to modifying the Energia core? For instance, I am using the LiquidCrystal_I2C library found here, and it works fine on the G2553 and F5529, but I'd like to move the LCD over to the other I2C peripheral so I can use those pins for an SPI device. On Tiva, one can do "Wire.setModule(1)" or similar to do something with an alternative peripheral, but it seems this isn't possible with the F5529. Might also be worth noting the above mentioned library doesn't play well on the LM4F/TM4C LaunchPads either. And FWIW, the LCD I'm using is a 20x4 with an I2C interface board labeled "Arduino-IIC-LCD GY-LCD-V1"