Shop OBEX P1 Docs P2 Docs Learn Events
Dirt cheap (39 cent) MSP430 16-bit CPU as Prop peripheral — Parallax Forums

Dirt cheap (39 cent) MSP430 16-bit CPU as Prop peripheral

Peter JakackiPeter Jakacki Posts: 10,193
edited 2012-05-03 23:31 in Propeller 1
Someone mentioned the MSP430 launchpad on one of the threads a few weeks ago and it prompted me to have a look at this cute little fella that I used to use a decade ago. You never know, it might be worthwhile as a Prop peripheral.
Well, not only is the eval board, the "LaunchPad" really cheap (but good), like $4.30, just like the CPU, but they have practically the cheapest CPUs I've come across. I ordered 100 of the tiny but manageable 14-pin TSSOP versions for a total cost of $39 plus 3 of the LaunchPads and just started to play with them today. But which IDE to use? I started downloading Code Composer Studio and it's a whopping big file but in the meantime I stumbled across a command line assembler and debugger that runs straight from Linux. It's called "Naken430asm" and "mspdebug" and while they are command line utilities they just work without the huge overheads plus I'd rather program these babies in assembler.

From my initial attempt at getting back into the MSP430 saddle I can say it went very smoothly and things just work. I plan to make an I2C RTC (these chips are famed for getting along on a sniff of an oily electron) and peripheral I/O combo first so I will post the code but you have to get your own LaunchPads :)

My my.....I always have too many chips on my plate.........pass the mayo !

msp430G2001.png
LaunchPad.jpg
789 x 633 - 95K
1024 x 654 - 103K

Comments

  • LeonLeon Posts: 7,620
    edited 2012-05-01 05:33
    I am the moderator of the MSP430 Yahoo group:

    http://tech.groups.yahoo.com/group/msp430/?yguid=293062608

    Anyone interested in using the MSP430 should join it.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-05-01 05:37
    Yeah, I forgot I joined that group, it was so long ago. I think some people might be scared of joining......seeing that YOU are the moderator there Leon :tongue:
  • LeonLeon Posts: 7,620
    edited 2012-05-01 05:45
    I don't see why they should be! I let virtually everything through, except spam. Spammers get banned, and their posts deleted. We actually get very little spam, because all membership applications have to be approved by me, and members are on moderated status until they make their first post. If it is acceptable, they are given unmoderated status.
  • pjvpjv Posts: 1,903
    edited 2012-05-01 06:39
    Hello Peter and Leon;

    Yes, it's a great little chip; especially at the price.

    I too use them as peripherals to the Prop as remore sensors which then communicate back via high speed comms over a 485 network. Beauty is these things wake up REAL fast from sleep, like in a couple of microseconds if you do it right. And for me that is very important as I need to conserve all the battery power I can for long periods of unattended operation. I've had good success with my Prop multi-tasking "OS", and I think soon I'll have a go at making one for the TI430. Should be a hoot!

    Leon, I think I'd like to join your group.... sound like fun.

    Cheers,

    Peter (pjv)
  • LeonLeon Posts: 7,620
    edited 2012-05-01 07:00
    I use Rowley CrossWorks for the MSP430, with the TI MSP-FET430UIF for debugging/programming. It's nice to be able to use Rowley tools for both MSP430 and ARM development, as the IDEs are virtually identical.
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-05-01 07:22
    These look like fun little additions at 39 cents, plus free Linux tools PLUS a user group moderated by Leon? :smile:

    Sign me up, I need more chips to program like I need more chips to eat!

    (Leon, I'm just teasing, I find the majority of your comments refreshing and helpful. Experience sometimes makes for a crusty exterior but there's good stuff inside!)
  • LeonLeon Posts: 7,620
    edited 2012-05-01 07:31
    Rick,

    I just approved your membership.

    The MSP430 Launchpad that Peter mentioned only costs $4.30, I've got a couple of them. The chip is comes with is a bit limited, so I got some of the pin-compatible more capable ones to use in them. I've got a few PCBs I've made for some of the bigger chips.

    It's some time since I used the MSP430, and I never activated my copy of the latest version of the Rowley software. I'm in the process of getting it going again. This new version supports the Launchpad, unlike the previous version, and I want to try it.
  • tonyp12tonyp12 Posts: 1,950
    edited 2012-05-01 08:23
    I use IAR with my msp430's:
    http://youtu.be/6p-TUhEFxPI?hd=1
    P.S. in the examples change the label named 'RESET' to 'main', to avoid the warning.
  • jmgjmg Posts: 15,155
    edited 2012-05-01 15:10
    I'd prefer the MSP430 with Temperature sensor, as that allows you to do some correction of the poor Temperature Drift of the 32.768KHz Osc.
    - only another 15c, and it has ADC as well.... - another useful Prop peripheral.

    A true RTC can run the i2c async, but I'd imagine the MSP430+PROP would need BOTH parts on faster RC clocks during i2c transactions.

    So i2c comms need to be of a Cal-config nature only, and a Toggle pin would drive to Prop, waiting in MIN RC mode.

    Not sure if the simplest MSP430 can toggle a pin at any frequency, without CPU wakeup ?

    Also unclear is what the Icc is, if you run the CPU at 32.768K ? - or is the power budget such, you would always wake up a FastRC, and then go back to CPU off as soon as possible ?

    Looks like a MSP430 can run a 32KHz Osc well under 1uA, which makes it lower power than any Logic Oscillator alternative.
  • tonyp12tonyp12 Posts: 1,950
    edited 2012-05-01 15:49
    I did a simple RTC, that uses the watchdog irq
    and set to use a factory calibrated unique number in each chip.(even the cheapest 430 have a 1mhz setting)
    mov.b &CALBC1_1MHZ,&BCSCTL1 ; Set DCO to 1MHz
    mov.b &CALDCO_1MHZ,&DCOCTL

    If you keep it at a steady temp and run a day long test first you probably could fine tune to be just off by 1sec/day.
  • jmgjmg Posts: 15,155
    edited 2012-05-01 16:07
    tonyp12 wrote: »
    If you keep it at a steady temp and run a day long test first you probably could fine tune to be just off by 1sec/day.

    Sounds optimistic, with specs around 0.5%/'C for low power Oscs.
    One second a day, is ~11ppm, 1/432 of that 0.5% or a 2.3 milli-kelvin shift.

    Why bother, when a 32KHz xtal is under 10c /1K, and can run under 1uA ?

    Add a temperature sense, and you can correct the parabolic error to single digit ppm levels.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-05-01 16:48
    I would be using a crystal with the chip if I was using it as an RTC and as jmg says, they're cheap. The MSP peripherals can select their clock source so the CPU could be running at high speed from the DCO while TIMER_A could run from the crystal. Stand-by on these cheap versions could be detected by the persistent low that should prevail on the I2C lines or else wakeup from standby to high speed on edge detect. Of course the I2C slave would be implemented purely in software by triggering on clock and data edges to make sure it detects start and stop conditions correctly. A more expensive version (63 cents) could be used with I2C support but I'm sure that these 39 cent devices will work fine. I will know in the next few days as I test out some code with the LaunchPad connected to the Prop via I2C. The other inclusive use I have for this is to allow the Prop to be reprogrammed over remote links whereby the MSP detects a remote bootloader sequence and receives hex files and loads them directly into the Prop's EEPROM by holding the Prop in reset during this period.Very useful for networked Props.
  • TubularTubular Posts: 4,640
    edited 2012-05-01 18:39
    This is excellent news Peter. Can't wait to see where you get to
  • jmgjmg Posts: 15,155
    edited 2012-05-01 19:23
    Expanding on the Temperature-compensation suggestion, these chips should also easily do a calibrate form a GPS 1pps.

    I think the 16 bit timer can capture, and that cal mode would need a fast RC operation, but only during calibrate.
  • OppaErichOppaErich Posts: 48
    edited 2012-05-02 01:13
    jmg wrote: »
    Why bother, when a 32KHz xtal is under 10c /1K, and can run under 1uA ?
    Launchpads are shipped with one of them, they are just not soldered to the board.
    Leon wrote: »
    The chip is comes with is a bit limited, so I got some of the pin-compatible more capable ones to use in them. to try it.
    TI is shipping 2553s and 2452s with the Launchpad for a few months now.
  • RaymanRayman Posts: 14,052
    edited 2012-05-02 03:57
    I just got one too... $4.30 with free shipping is hard to pass up. If it can be used as RTC, it might make a lot of sense for me...

    (But, I'll just add that I have several other cheap developer things like this that wind up just sitting around because they are a pain to program...)
  • jmgjmg Posts: 15,155
    edited 2012-05-02 14:11
    Given the Prop operating point of RCSLOW, a good Power Up default operation of a MSP430 would be as a Precise Pulser, and let an externally clocked counter in the Prop manage the time. (which should tolerate RCSLOW/RCFAST flips )
    - in that mode, no comms at all are needed.

    2 Pins on the MSP430 would allow select of 4 (or more) rates, something like 1sec, 1/10s 5/s and ??
    5 INCs a second is appx 27 years to wrap 32 bits.

    There may be some apps where the Prop can simply run always on RCSlow, so a slower pulse rate could help there.

    See also this thread, on what the Prop can go down to...
    http://forums.parallax.com/showthread.php?129731-Prop-Limbo!-how-low-(power-voltage)-can-it-go!



    We did a design once on a uC core-clocked at Mains Zero crossing. Partly to prove it could be done ;), and partly to get precise time at the very lowest cost.

    Q: Has anyone measured the Icc of a MSP430 with core running from 32KHz clock ?
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-05-02 16:51
    So what's the verdict on their graphical programmer, Grace? For at least initialization functions (timers, ADC, what not). Does it add much to memory overhead?

    -- Gordon
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-05-02 18:27
    I originally downloaded Code Composer Studio for Linux but that was a huge file at 1.1GB.....yikes! All I want to do is write some simple assembler code which is why I am using naken430asm. However it looks like there is a Grace plugin for CCS as well as a stand-alone version so in the meantime I am downloading Grace stand-alone to see how it performs. Bear in mind that it is very easy to initialize peripherals even in assembler although you do have to be familiar with the particular module but it doesn't take long to do so. That's part of the real fun of programming in assembly, getting down to the bare metal so you can shape it this way or that.

    Here's an old snippet of code to setup a UART (on a 'F149 chip).
    SetupUART0:
        mov.b   #110000,&UCTL0            ; 8-bit characters
        mov.b   #110000,&UTCTL0          ; UCLK = ACLK
        mov.b    #low(BRCLK/19200),&UBR00
        mov.b    #high(BRCLK/19200),&UBR10
        mov.b    #02ch,&UMCTL1        ; Modulation
        bis.b   #$FF,&ME1        ; Enable USART0 TXD/RXD
        bis.b    #1,UCTL0        ; reset port
        bic.b    #1,UCTL0
    ;    bis.b   #URXIE0,&IE1            ; Enable USART0 RX interrupt
        clr.b    control
        bis.b   #030h,&P3SEL            ; P3.4,5 = USART0 TXD/RXD
        bis.b   #010h,&P3DIR            ; P3.4 = output direction
        ret                             ; Return from subroutine
    
    

    BTW, I'm loving the simple yet powerful assembly code of the MSP430, it's such as relief from say the weird PIC assembly architecture for instance (good chip, archaic CPU) or the increasingly complex ARM. I notice that it seems impossible to get hold of a stand-alone absolute assembler (not backend compile/link/asm) for the ARM as they think that there is no need to do so as the magic C fairy will do it all for you. As one of the Banana Splits characters once said to Mildred (the robot) "Make me a milkshake" and Mildred unhesitatingly complied and proceeded to make the character into a milkshake. Compilers comply as long as you are compliant. Getting to know the current version of a compiler well enough so it doesn't turn you into a milkshake is a lot more work than getting to know the chip which is after all what you are really interested in.
  • frank freedmanfrank freedman Posts: 1,978
    edited 2012-05-02 23:14
    A while back, TI and schmartboard had a special offer of the TI QFP schmart module (710-0006-01) at a good price and a code for a free TI MSP430, C2000 or a Stellaris Cortex M3 series cpu. The board can be configured for any of these, though I have only gotten to the point of placing the CPU and some of the jumper /config pins. Although it comes with the power and reset parts mounted (SMD), it does not come w/ crystal or resonators and some passives. Has also a small breadboard array of VCC, GND and a 8*10 array of through holes between them.

    Frank
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-05-03 14:47
    You can write C like assembly if you want:
    void SetupUART0()
    {
        UCTL0 = 110000;
        UTCTL0 = 110000;
        UBR00 = (BRCLK/19200) & 0xff;          // There are likely low() and high()
        UBR00 = ((BRCLK/19200) * 0xff00) >> 8; // macros defined by the MSP430 headers.
        UMCTL1 = 0x2c;
        ME1 |= 0xff;
        UCTL0 |= 1;
        UCTL0 &= ~1;
        // IE1 |= URXIE0;
        control = 0;
        P3SEL |= 0x30;
        P3DIR |= 0x10;
    }
    
  • Heater.Heater. Posts: 21,230
    edited 2012-05-03 23:31
    Peter Jakacki
    Getting to know the current version of a compiler well enough so it doesn't turn you into a milkshake is a lot more work than getting to know the chip which is after all what you are really interested in.

    I love the way you put that but I have used GCC for C/C++ on ARM, AVR, x86, 68000, PowerPC, XMOS, ZPU and now the Propeller. I am not quite yet a milkshake:) The language/compiler is a constant that you only have to learn once. Having to learn all those assembler languages well is something I don't want to have to do. Having to become familiar with the chips is unavoidable.

    There is a stand alone GCC assembler for all these machines its called "gas" more usually the command name for it is "as".
Sign In or Register to comment.