Thursday, December 9, 2010

IAR Kickstart and MSP430 Launchpad

Well, finally, my toys have arrived. And it's awesome. Naturally the first thing we did was say "Let's hook it up!" We performed the typical unboxing procedure:

1. Tear mail package into many small pieces, remove launchpad box.
2. Tear launchpad box into many small pieces, remove all baggies.
3. Tear anti-static bags into many small pieces, remove all components.
4. Ignore QuickStart guide entirely.
5. Google Getting Started with MSP430 Launchpad.
6. Plug things in without reading any results from search.
7. Lights turn on and off, make 'oooo' and 'aaaa' sounds.
8. Download IAR KickStart and install and try to increase LED duration etc using example code.
9. Realize you skipped a lot of steps and don't have any idea wtf you are doing...

So this was all great and fun, we wired the chip to some opto-isolators with some 1K resistors in series, then use a Darlington array and attach some motors and watch them spin up and down all the while giggling like grade schoolers in recess. Now to download a new program to the MSP430 so we can have a little more control over what's happening and leave H-Bridge design to the mechanical engineer (because this makes sense... right?).

H-Bridge design is less than successful, it rolls into 11pm and it's getting late. We're having issues with the IAR KickStart Software (PEBKAC). The mechanical engineer becomes derailed with gear and motor ideas forgetting entirely that the initial hope was to have a basic prototype within the same day. And now you could analyze the increase of personal tension as a third order derivative.

The issue with downloading the new images to the 430 is as follows:
Failed to initialize device
Well... wtf does that mean? Google yields lots of people saying "Use CCS," and "Make sure your drivers are correct." Not being particularly interested in the first option, due to preference and stubbornness, I check my drivers. Low and behold this is not where my problem lies. So I keep researching, keep researching, finding only more of the same garble... then in the comments on some forum somewhere I see it, the thing I should have known better, the thing that the getting started guides should have explained but didn't.
Project -> Options -> General Options -> Target Device
 Of course, I forgot to set my target device!  Somewhere, I would have thought, they would have mentioned this. But alas they did not, and hopefully if you're reading this you're kicking yourself the same way I did. But with the calm collected realization that your project can continue on. Then it was time to stop and sleep.

Wednesday, December 1, 2010

Powershell and MSDeploy.exe

As some people may know, I've been playing with Powershell a lot for work lately. Most recently I've also been using joining powershell with a Web Deploy executable, msdeploy.exe. And I've run into a couple of bugs I've noticed some other people have also had issues with.

At my place of employment we have a multi-tier development environment. This consists of 3 tiers we adoringly call "dev," "test," and "prod." We also have some lateral environments (lateral to our test environment mostly) which we call "staging" and "training." On to the problem and solution...

The issue was syncing a remote server's IIS AppHostConfig settings to my local machine. I tried to sync our dev environment's settings to a package locally, which I will later sync that package to my localhost environment. This script's goal is to allow us to rebuild a development box in rapid order when a developer gets a new or re-imaged machine. Here's the command I was using:

msdeploy.exe -verb:sync -source:appHostConfig="Site1",computername=devserver -disableLink:ContentExtension -disableLink:CertificateExtension -disableLink:FrameworkConfigExtension -disableLink:HttpCertConfigExtension -dest:package=c:\IIS.zip

This was pretty much stolen right out of Synchronize IIS 7 and was very disappointing to see this error occur:

Error: Unrecognized argument '"-source:appHostConfig=Site1  computername=devserver"'. All arguments must begin with "-".
Error count: 1.

Pretty much my first response was a lipping of  "W.T.F." (we have Mormons in the office who may otherwise be offended if I yelled this top of my lungs) followed by an intense urge to Google the error.

So I did.

I did not find any great results...

Then I realized of course, this is probably because all the information I need is in the error! Unrecognized argument "-source:" So what follows the colon must be the expected argument... which we have "appHostConfig=Site1 computername=devserver" wait a second... That isn't what I typed, there is no space, I used a comma! Where'd it go? I am gonna guess it was stripped out by powershell which then invalidates the whole argument for -source.

The Solution you ask? A little quotation magic:

msdeploy.exe -verb:sync -source:"appHostConfig='Site1',computername=devserver" -disableLink:ContentExtension -disableLink:CertificateExtension -disableLink:FrameworkConfigExtension -disableLink:HttpCertConfigExtension -dest:package=c:\IIS.zip


And presto, the double quotes force the whole inner text to be 1 argument, without stripping out the comma. Which is precisely what msdeploy.exe expects. IIS synced.


Cheers,
  -Ken