Jump to content


Popular Content

Showing content with the highest reputation since 06/16/2018 in all areas

  1. 5 points

    RFC: CNC BoosterPack

    Driver code for a few boards is available from my github account. A PCB design with reduced size allows two boards to be mounted to the EK-TM4C1294XL LaunchPad providing up to 6 axes of control (needs to be verified). I have also added TCP streaming to the EK-TM4C1294XL LaunchPad but usure if I can publish the code due to the "viral" clause in many of TIs files - even the startup code 🙁. Grbl is released under GPL and I have a hard time understanding the legalese related to that... I am currently working on a DRO/MPG for my lathe with Grbl running on a MSP432, and the DRO/MPG code on a Tiva C/MSP430 combo. Threading support is a part of that work and hopefully I'll be able to get it working reliably - looks promising this far.
  2. 4 points

    Sensirion SHTC3 temperature-humidity sensor

    Sensirion has recently introduced an inexpensive, low-power temperature humidity sensor SHTC3 designed for operation in the range 1.62--3.6V . It should be a useful peripheral for MSP430 battery-powered applications. I have tested 3 sensors with the F5529 Launchpad and they exhibit reliable, consistent behavior. For reference, I have written some demo code for I2C communication that is available on github: https://github.com/microphonon/SHTC3 The SHTC3 comes in a small DFN package, so to do breadboard testing I had to build my own breakout boards and use reflow soldering (see photo).
  3. 3 points

    Bosch Sensortech BME280

    The Bosch BME280 pressure-temperature-humidity sensor is very popular for projects because there are breakout boards available from Adafruit and Sparkfun as well as a large library of code to interface it to Arduino MCUs. Not so much for the MSP430, especially transparent code to understand what is happening at the register level. I have written and tested some demo C-code that hopefully fills that gap. It sacrifices generality and efficiency for compactness and transparency. I use the F5529 Launchpad and communication with the sensor is via SPI using the UCB0 module. I2C is also available for the BME280 but not implemented here. Temperature and relative humidity (no pressure) data is obtained using the forced mode with periodic polling by the MSP430. Sensor and MCU are in low-power sleep modes when not active. Data is streamed to a terminal program that is interfaced to the Launchpad via serial UART. Each BME280 has unique trimming parameters that must be retrieved and properly parsed to convert the raw data. This process is quite complicated, so separate functions were developed to handle them and placed in an include library. My IDE is CCS 6.1.3 with nofloat printf support. This code should work directly in the MSP430x5xx and MSP430x6xx families. Other MSP430 series such as FR and value-line will need to make appropriate module/register modifications. Link to github is here: https://github.com/microphonon/BME280
  4. 3 points

    TI HDC2010 temp-humidity sensor

    There is code available to implement I2C communication between the MSP430 and the HDC2010 temperature-humidity sensor, but it's a bit like an onion -- you have to peel away layer after layer in various libraries to drill down into what is happening at the register level. I decided to write some transparent demo code for this sensor that is self-contained: everything related to the I2C interface is in a single C program. It has been successfully tested with the F5529 Launchpad. This is a simple MCU polling operation that periodically makes a T-H measurement using the on-demand mode of the sensor. The data is sent to the serial port for display on a terminal program. The on-board heater is activated for a few seconds upon reset. I have not implemented the temperature-humidity high/low interrupts. One could also configure the sensor to output data periodically and toggle its DRDY pin to wake-up the MCU from LPM4. Polling code is here: https://github.com/microphonon/HDC2010 The HDC2010 is a tiny sensor with a 6-bump BGA footprint. TI makes an evaluation module that uses an MSP430F5528 to interface the sensor with a configuration/graphing GUI program. Their program only runs on 64-bit Windows. The portion of the PCB hardware containing the sensor can be broken off (permanently) to reduce thermal mass and allow placement in a project. I decided to make my own breakout boards (see photo), but just learned that MikroElektronika started selling essentially the same thing for $13 (MIKROE-2937).
  5. 3 points
    If you're just after free shipping, the code OPT4FREE should work for the whole of 2018.
  6. 1 point

    Using a CP2102 with BSL-Scripter

    I don't know if this has any application for Energia, but might be of use to someone at some point. I've been working on a way to embed a generic USB-to-UART adapter like the CP2102, FT232 or CH340 in an MSP340 project so firmware can be updated without having to buy a Launchpad. The newer MSP430 parts presented a problem because BSL-Scripter, TI's software for BSL flashing for those parts, doesn't transmit the special invoke pattern on /Reset and Test. Instead, it just brings both lines low, which messes things up. I gave up on trying to recompile Scripter, but I've written a Windows program that generates the pattern, and developed methods to disconnect DTR from /Reset after the pattern has invoked BSL, but before BSL-Scripter is run, which allows flashing to proceed with /Reset high. A full explanation, source code, executable, and schematic are in my Github repo. It all seems to work, at least with an FR2311 under Windows 7. https://github.com/gbhug5a/CP2102-with-BSL-Scripter-for-MSP430
  7. 1 point

    MSP430FR2433 SleepSeconds 18ua

    Have you looked at what's happening "under the hood" with CCS or similar? All things considered, I find it amazing that the current is as low as it is. Energia is a great place to start and experiment, but it's not intended to replace coding that is far closer to the metal, er, silicon. Given it's heritage as a msp430 version of the Arduino, it's a very impressive piece of work. But, to manage the supporting classes, and the ever-present loop, it is constrained if your're looking for ultra-low power apps. You have already demonstrated that differential with your driverlib version.
  8. 1 point

    Microphone MSP430F5438A

    A quick google search of "msp430 microphone" doesn't yield much, but there are examples for recording and playback with the msp430FG4618. What type of analysis??? Your intended study appears to be very broad in its potential scope.
  9. 1 point
    Thank you, Robert! That worked. (And thank you for the suggestion, Fmilburn, but older versions also had the black board removed. I even tried and failed with a manual setup on a PC that I kept offline.)
  10. 1 point
    I think this is because, when there is no external XTAL connected, Energia (wiring) usually falls back to the VLO source (~12k Hz). But on the FR2433 the clock falls back to the REFO source which runs about 3x faster ( ~32768 Hz). However the code in wiring.h does not reflect this. Please look around line 144 in wiring.c (hardware/energia/msp430/cores/msp430/wiring.c): /* ACLK = VLO = ~ 12 KHz */ vlo_freq = 8000; /* Source ACLK from REFO */ CSCTL4 |= SELA__REFOCLK; Where I think it should be: /* ACLK = REFO = ~ 32 KHz */ vlo_freq = 32768; /* Source ACLK from REFO */ CSCTL4 |= SELA__REFOCLK; Since Sleep() uses the clock for timing and Delay() uses the CPU frequency for timing, this could explain your difference. Pinging @StefanSch
  11. 1 point

    MSP430G2553 Workshop

    Hi Zeke, Yes, that is exactly what I have done, and the end result is exactly what I needed. Thanks again for your help. Cheers, Mark
  12. 1 point
    Rei Vilo

    Dual LCD Chess Clock

    You can combine the LaunchPad with LCD with a second LCD. The MSP-EXP430FR4133 with LCD goes for USD14 while the MSP-EXP430FR2433 is USD10. The larger MSP-EXP430FR6989 with LCD is USD18 vs. USD16 for the MSP-EXP430FR5969. If power consumption is critical, why not consider an e-ink screen? Pervasive Displays have a wide range of displays, B&W and also tri-colours with red. All are supported with an Energia library. At this state, we need to know more about your project. And no need to double post your question at Which MSP430 to pick? Advice please. This is against netiquette: see Netiquette for Newbies.
  13. 1 point
    Cool concept to adding boards to the Raspberry Pi. Atomo is a complete system for building electronic things with four parts: Control, IO, Power, and Connector. https://www.indiegogo.com/projects/atomo-modular-electronics-system-arduino--2#/ https://youtu.be/0uOsLvB1of0
  14. 1 point

    MSP430 Serial Monitor not working

    You might have one of those LaunchPads that comes out of the box configured to use software uart. On a Rev 1.5 LaunchPad, J3's RX and TX jumpers need to be set to the horizontal position to work with Serial. Also make sure that you match the baudrate set in the Sketch in the Serial monitor. In your test Sketch, you might want to add a small delay (e.g. delay(200)) at the end of the loop to not flood the Serial monitor. Please see the pinmap:
  15. 1 point

    Error during download

    I don't know that any of these ideas will help, it's just what I looked at when I tried to see what the problem might be. When you first start the Boards Manager, do you see the message "Downloading platforms index..."? It gets the small file http://www.energia.nu/pacakges/package_index.json . If you can see that, then it's talking to the package server OK. I've got a slow dial-up connection, so it sits there long enough for me to read it (and wait a little, too!). If you have a fast connection then it might blip past in an instant. It's interesting that it wants to get a 1.0.2 release, when there's a 1.0.3 release up on the site. Have you made any changes in Preferences / Network? If so, could they be blocking something?
  16. 1 point
    I think the issue is resolved now, so the first thing is to update MSP430 core as you mentioned before. The 2nd thing is I put pack the jumpers TXD and RXD in their original orientation as when I bought the board first time. Thank you so much for your help.
  17. 1 point

    MSP430 GPS

    I have had no problems with TinyGPS on a MSP430F5529. Given that the communication is Serial, have you correctly configured your '2553 for Serial? Your statement "doesn't seem to work" is so broad that there's virtually no way to offer any specific or more useful suggestions.
  18. 1 point
    googling seems to indicate this is a known problem.
  19. 1 point
    The TI store has 10% off selected LaunchPad and tools with free shipping for the next week. http://www.ti.com/store/featured/junemidyear2018.html?HQS=ecm-tistore-promo-junemidyear18-bhp-lp-null-wwe
  20. 1 point
    Let me know if you have a problem with the above steps.
  21. 1 point

    Implementing an I2C slave device.

    Clavier's Short Guide to I²C Slaves on the MSP430x2xx Family Read section of the User's Guide, and the example code. Slave mode is somewhat easier than master mode because you do not have to care about getting the transaction sequence correct; you just react to the master's requests. The slave address is an arbitrary but unique 7-bit number. Just put it into the I2COA ("own address") register; the USCI module will automatically handle transactions to this address. You do not need to configure a clock source; the clock signal is supplied by the master. When the master has written a byte, you get an RXIFG interrupt. Your interrupt handler must read that byte from RXBUF. (You can set the TXNACK bit after reading RXBUF, this will tell the master to stop after the following byte.) When the master wants to read a byte, you get a TXIFG interrupt. Your interrupt handler must write a byte to TXBUF. If your code is slow, the USCI module will automatically stop the bus via clock stretching until you have reacted. You can get notifications when start and stop conditions happen (STTIFG and STPIFG), but that is not always necessary. The I²C protocol itself defines only byte reads and writes. If you have registers, you have to handle the register address yourself. Typically, the first write after a start condition is the register address, and all following writes (and all reads) are from/to the specified register (and often the register address automatically increments). As a slave, you have no control over what the master does; you must react to any write and read requests at any time. (If you really have nothing to read, just send the last byte again, or some garbage byte.)
  22. 1 point

    Industrial / commercial sensors

    By the way, this is the light level sensor we went with: http://www.acuitybrands.com/products/detail/147289/Sensor-Switch/CM-PC-ADC/Photocell-Dimming-Ceiling-Low-Volt Kind of expensive at ~$140, but when you need it NOW, hehe you usually end up paying through the nose. Eventually we may end up designing our own sensors, if there is a need . . . Problem is, finding good enclosures for a decent price.
  23. 1 point
    Hello everyone, There is a couple of similar projects available on the internet. Some of them base on Arduino and PIC performs very basic mount control without math intensive computation implemented in embedded controller. I decided to build my own with the following goals: ease of use by an inexperienced amateur astronomer (full automatic operation) precision and resolution of position last but not least: the price Final, or better say at the moment, design comprises of the following components: Stellaris LM4F launchpad central control unit, two ULN2003 unipolar stepper motor driver chips, two 28byj-48 stepper motors one moving in azimuth, and in elevation via gear train, communication module: Bluetooth serial module. It allows sending a coordinate set-point and provides position feedback to Stellarium, GPS module providing position and precise time reference - PPS gives 1us accuracy, Nokia 5110 display unit and joystick for standalone operation, now obsolete mouse (PS/2) modified to provide independent (incremental) position information Resolution that was reached is a single step of approx. 5". Given the size of Jupiter to range from 30" to 50", this positioning resolution makes the view comfortably stable in standard 60° FOV eyepiece at reasonably high magnification, without the need to adjust AZ/ALT continuously. During the development I made use of several opensource and projects available online, namely: AccelStepper for stepper control, TinyGPS++ for NMEA decoding, Arduino telescope controller was my inspiration and reference for Taki's matrix method for coordinates transformation, of course Energia as my IDE Upon power-up the mount is performing: homing acquisition of current location (longitude/latitude) and time via NMEA stream moves to 3 brightest (most convenient) stars in succession to perform 3 star alignment procedure - they are selected from the list of over 500 stars in built-in catalog (the brightest are used for the alignment, tough), once aligned the mount is in tracking mode: it tracks the view to counter the apparent movement of objects in the sky, waiting, either for the user to move to particular object - selected from the library of stars and Messier objects, or awaits connection via Bluetooth from a PC running Stellarium with a plugin and slews to selected object. search for the object that should be visible in the eyepiece and display important information on LCD - I compiled in 500 brightest stars from HYGXYZ and full Messier catalog. I have very little experience as amateur astronomer so far, so some of the objectives might have been not very obvious for me in the beginning. This project was also a good way to make use of my free time and gain experience in embedded system design. With kind regards, Szymon
  24. 1 point

    [POTM] dAISy - A Simple AIS Receiver

    The radio on its own does not much. It needs an MCU to control it and talk to the computer, which is the MSP430 Launchpad in this case. See the first post of this thread and just replace the custom breakout board with the Ebay radio (minus the changes in wiring as documented). There are several options to program the LaunchPad. For this project I used TI's full IDE Code Composer Studio (CCS). http://www.ti.com/ww/en/launchpad/software.html The repository I published on Github includes the CCS project file. https://github.com/astuder/dAISy Simply copy the whole tree into your CCS workspace and open it in CCS. From there you can compile the code and program the LaunchPad. The radio configuration data generated by WDS is in the radio_config.h source file. dAISy USB is the standalone version of all this, where I designed and built my own PCB that includes radio and MCU on one board.
  25. 1 point
    Hello, I've been lurking here for well over a year and finally figured I should post something. I've been learning to use the USCI I2C interface on the on MSP430G2553 and came up with this code for talking to the 24LC256 chip. The code implements single/multibyte read/write routines for the 24LC256 EEPROM. It should work on the 24LC512 without modification and on other 24LCxx family chips with minimal modification to the addressing. I have probably broken numerous coding rules and best practices, there is no error checking to speak of, and nothing has timeouts. So use at your own risk. I also have screen captures from the logic analyzer showing the SCL/SDA timings. If anyone is interested, please let me know and I'll post them. Comments are welcome and appreciated. Thanks Brian //************************************************************************************* // MSP430G2553 24LC256/512 I2C Interface // Brian McClure NZ8D // first.lastname@gmail.com // July 2014 // /********************************************************************************************/ /* Include */ /********************************************************************************************/ #include "msp430g2553.h" /********************************************************************************************/ /* I2C Definitions */ /********************************************************************************************/ //I2C Port Definitions #define i2cAddress 0x50 //Address GPIO Address //USCI I2C PIN Definition #define SDA_PIN BIT7 //Bit 7 USCI Port 1(SDA) #define SCL_PIN BIT6 //Bit 6 USCI Port 1(SCL) /********************************************************************************************/ /* UART Function Definitions */ /********************************************************************************************/ void UART_puts(char * s); void UART_outdec(long data, unsigned char ndigits); /********************************************************************************************/ /* I2C Function Definitions */ /********************************************************************************************/ void I2C_Write_EEProm(unsigned char slave_address, unsigned int register_address, char * data, unsigned char DataLength ); void I2C_Read_EEProm(unsigned char slave_address, unsigned int memory_address, char * data, unsigned char DataLength ); /********************************************************************************************/ /* Misc Function Definitions */ /********************************************************************************************/ void delay_ms(unsigned int delay); //Delay /********************************************************************************************/ /* Main */ /********************************************************************************************/ void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT BCSCTL1 = CALBC1_16MHZ; //set DCO to 16Mhz DCOCTL = CALDCO_16MHZ; // make sure to update the Delay_ms function if the DCO is changed //UART Initial P1SEL = BIT1 + BIT2; // P1.1 = RX pin, P1.2=TX pin P1SEL2 = BIT1 + BIT2 ; // P1SEL and P1SEL2 = 11--- Secondary peripheral module function is selected. UCA0CTL1 |= UCSSEL_2; // SMCLK UCA0BR0 = 69; // 16MHz 230400 UCA0BR1 = 0; // 16MHz 230400 UCA0MCTL = UCBRS0; // Modulation UCBRSx = 1 UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt //USCI_I2C_Init P1SEL |= SDA_PIN + SCL_PIN; // Assign I2C pins to USCI_B0 P1SEL2|= SDA_PIN + SCL_PIN; UCB0CTL1 = UCSWRST; // Enable SW reset, HOLD USCB in a reset state UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, MODE 3 = I2C, synchronous mode UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset UCB0BR0 = 72; // Set I2C master speed 72 gives approx 200Khz clock at 16Mhz UCB0BR1 = 0; // Set I2C master speed UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation UART_puts("Starting...\r\n"); //output to UART to indicate the program is running __bis_SR_register(CPUOFF + GIE); // LPM0 with interrupts enable while (1){ } } void UART_puts(char * s) { while (*s) { while (!(IFG2 & UCA0TXIFG)); // USCI_A0 TX buffer ready? UCA0TXBUF = *s++; } } void UART_outdec(long data, unsigned char ndigits){ //UART_outdec modified/hacked to properly handle negative numbers. unsigned char sign, s[15]; //I copied this from a TI example or the 40oh forum, but I'm not sure of the original author. unsigned int i; sign = 0x00; if(data < 0) { sign='-'; data = -data; } i = 0; do { s[i++] = data % 10 + '0'; //adds the value of data least sig digit to ascii value of '0' if(i == ndigits) { s[i++]='.'; } } while( (data /= 10) > 0); if (i < ndigits) //fixes loss of leading 0 in fractional portion when number of digits is less than length of data { do { s[i++]='0'; } while (ndigits > i) ; s[i++]='.'; } if (sign == '-') //if value is negative then include the '-' sign { s[i] = sign; } else { //if value is positive then reduce 'i' counter by 1 to prevent the do loop from trying to output a sign character. i--; } do { while (!(IFG2 & UCA0TXIFG)); UCA0TXBUF = s[i]; } while(i--); } void delay_ms(unsigned int delay) { while (delay--) { __delay_cycles(16000); //1ms = 1000 cycles per 1Mhz clock freq. } } void I2C_Read_EEProm(unsigned char slave_address, unsigned int memory_address, char * data, unsigned char DataLength ) { //Reading from a 24LCxxx series is much easier then writing. Reading doesn't have to be done in 64 byte pages. /* * Todo: * 1. add checks to make sure write does not exceed maximum length of EEprom * 2. check for valid memory_address * */ int rLoop = 0; //loop counter while (UCB0STAT & UCBBUSY); //wait for USCI B0 bus to be inactive UCB0I2CSA = slave_address; //set SLAVE address UCB0CTL1 |= UCTR + UCTXSTT; //set USCI to be I2C TX, send start condition UCB0TXBUF = (memory_address & 0x7F00) >> 8; //transfer memory_address MSB while (UCB0CTL1 & UCTXSTT); // waiting for slave address to transfer while ((IFG2 & UCB0TXIFG) != UCB0TXIFG); //wait for TX IFG to clear UCB0TXBUF = (memory_address & 0x00FF); //transfer memory_address LSB while ((IFG2 & UCB0TXIFG) != UCB0TXIFG); //wait for TX IFG to clear UCB0CTL1 &= ~UCTR; //set USCI to be RECEIVER UCB0CTL1 |= UCTXSTT; //send restart while (UCB0CTL1 & UCTXSTT); // wait until I2C STT is sent for (rLoop=0; rLoop<DataLength; rLoop++) //receive loop { while ((IFG2 & UCB0RXIFG) != UCB0RXIFG); //wait for RX buffer to have data data[rLoop] = UCB0RXBUF; //Move rvcd data of or USCI buffer. This also clears the UCB0RXIFG flag if (rLoop == DataLength-2) //NACK and STOP must be send before the last byte is read from the buffer. //if not the CPU will read an extra byte. { UCB0CTL1 |= UCTXNACK; //generate a NACK UCB0CTL1 |= UCTXSTP; //generate a stop condition } } } void I2C_Write_EEProm(unsigned char slave_address, unsigned int memory_address, char * data, unsigned char DataLength ) { /* * Todo: * 1. add checks to make sure write does not exceed maximum length of EEprom * 2. check for valid memory_address * */ int NumPages = (DataLength)/64 ; //Count of full 64 byte pages, 0 means the data is less than a full 64 byte page int PartialPageBytes = DataLength % 64; //this is the number of bytes remaining that do not make up a full page int address = 0; //EEprom memory starting address, this is different from the I2C slave address int NP =1; //loop counter to iterate though pages of memory int offset = 0; int offsetlimit = 0; if (PartialPageBytes > 0) { NumPages++; //if we have left over bytes that do not make up a full page, this will add a page to handle those bytes. } __disable_interrupt(); //prevent interrupts from messing with the I2C functions while (UCB0STAT & UCBBUSY); //wait for USCI B0 bus to be inactive UCB0I2CSA = slave_address; //set SLAVE address for (NP=1; NP<=NumPages; NP++) { address = ((NP-1) * 64) + memory_address; //this is the full page start address UCB0CTL1 |= UCTR + UCTXSTT; //set USCI to be I2C TX, send start condition UCB0TXBUF = (address & 0x7F00) >> 8; //transferring memory_address MSB while (UCB0CTL1 & UCTXSTT); // waiting for slave address was transferred while ((IFG2 & UCB0TXIFG) != UCB0TXIFG); //wait for TX IFG to clear UCB0TXBUF = (address & 0x00FF); //transferring memory_address LSB while ((IFG2 & UCB0TXIFG) != UCB0TXIFG); //wait for TX IFG to clear offsetlimit = 63; //set the offset limit to 63 if ((NP == NumPages) && (PartialPageBytes > 0)) //if we are preparing to send the last/partial page { offsetlimit = PartialPageBytes-1; //set the offset limit to the number of partial page bytes } for (offset=0; offset <=offsetlimit; offset++) { UCB0TXBUF = data[((NP-1)*64)+offset]; //send data. //UART_outdec(offset,0); while ((IFG2 & UCB0TXIFG) != UCB0TXIFG); //wait for TX IFG to clear } UCB0CTL1 |= UCTXSTP; // set I2C stop condition while ((UCB0STAT & UCSTPIFG) == UCSTPIFG); //wait for Stop condition to be set //delay while the EEPROM completed its write cycle. //It would be better to use NACK polling here as described in the datasheet. delay_ms(6); //24LC256 has a max page write time of 5ms, so we will wait 6ms to be sure } UART_puts("Done...\r\n"); __enable_interrupt(); } // ----------------------------------------------------------------------------- // Interrupt Handlers // ----------------------------------------------------------------------------- #pragma vector=USCIAB0RX_VECTOR __interrupt void USCI0RX_ISR(void) { __bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR) char RxChar = 0x00; //char used to receive serial data RxChar = UCA0RXBUF; // copy the RX buffer into RxChar char buf[4] = {0}; //i2c received data buffer //void I2C_Write_EEProm(unsigned char slave_address, unsigned int memory_address, char * data, unsigned char DataLength ) I2C_Write_EEProm(i2cAddress,0x00,"ABCDEFGHIJKLMNOP",15); //void I2C_Read_EEProm(unsigned char slave_address, unsigned int memory_address, char * data, unsigned char DataLength ) I2C_Read_EEProm(i2cAddress,0x05,buf,5); //reads three bytes starting at memory location 0x05 and returns the data into 'buf' UART_puts("READING: \r\n"); UART_puts(buf); UART_puts("\r\n"); __bis_SR_register(CPUOFF + GIE); // LPM0 with interrupts enable } //end UART RCV ISR