Skip to content
Corentin Altepe edited this page May 31, 2016 · 10 revisions

InnovasubBSL430 is a C# library for field firmware update on MSP430 devices via USB. It is NOT a C# wrapper for TI's C++ BSL430 library. It is rather written from zero, using the excellent HidLibrary by mikeobrien.

All contributions are welcome!

In order to run a firmware update:

  1. Ensure the flash BSL of the MSP430 is running and the device is connected to the computer with a USB cable.
  2. Run the following code:
// Considering BSL already enumerated - attempt connection
FirmwareUpdater firmwareUpdater = new FirmwareUpdater(File.ReadAllText("pathToFile.txt"), true);

The code will poll in background for a USB device corresponding to the BSL (vid:0x2047; pid:0x0200) and then automatically initiate the firmware update. "pathToFile.txt" must contain the hex code generated by Code Composer Studio.

If you need to integrate InnovasubBSL430 in your UI, you're advised to use a background worker:

private void FirmwareWorker_DoWork(object sender, DoWorkEventArgs e)
{
	// Considering BSL already enumerated - attempt connection
	FirmwareUpdater firmwareUpdater = new FirmwareUpdater(File.ReadAllText("pathToFile.txt"), false);

	// Leave some time for the connection to establish
	Thread.Sleep(1000);

	if (firmwareUpdater.Connected)
	{
		// Start updating
		firmwareUpdater.startFirmwareUpdate();

		// Wait for update to complete (or canceled)
		while (firmwareUpdater.Status == FirmwareUpdater.CONNECTED ||
			  firmwareUpdater.Status == FirmwareUpdater.SENDINGDATA)
		{
			// Report the progress to the UI
			firmwareWorker.ReportProgress((int)(firmwareUpdater.Percentage * 100.0));

			Thread.Sleep(1000);
		}

		// End of update - Handle errors if any
		if(firmwareUpdater.Status == FirmwareUpdater.COMPLETE)
		{
			// Firmware update has worked properly
		}
		else if (firmwareUpdater.Status == FirmwareUpdater.CANCELED)
		{
			// Update was canceled
		}
		else
		{
			// Other issues
		}
	}
	else
	{
		// Device not connected
	}
}
Clone this wiki locally