Install Visual Studio Code (VSCode) using Microsoft Store. The version with Insiders is the beta (pre-release) version – the release version should work.
Open VSCode and pin it to your taskbar using 🖱️ right click and
selecting Pin to taskbar
.
If you install it for the first time, feel free to follow the tutorial advertised on the first page.
Click File
, Open Folder
. The folder you
will select will house your workspace. I recommend putting all
the projects related to a course to a workspace. So create a folder with
your course name and select it as your workspace.
You may get a pop up asking
Do you trust the authors of the files in this folder?
. This
is an important question because executable programs from untrusted
sources may damage your computer. In this case the folder is empty and
we trust course-related files. So confirm it.
You will see on the left your new workspace in
EXPLORER
bar.
On the left-most bar called Activity bar, click on
Extensions
. It has the icon with four squares where one is
about the fill the gap.
Install PlatformIO
IDE. This extension eases
projects with microcontrollers and FPGAs. In my case it took about one
minute to install it. It requires a restart of VSCode.
When you open VSCode it should open your workspace automatically. Moreover, the PlatformIO should appear on the left side will see the PlatformIO icon similar to 👽. Click on it.
Click on Create New Project
. A new tab called
PIO Home
should open up.
Click on Project Examples
. A small window will pop
up.
You probably won’t see any examples. Click on
Install Embedded Platform
. A new page with a search bar
will show up.
Search for msp
. Click on TI MSP430
. A
new page with a search bar will show up.
You don’t have to search for anything. Click on the 🟦 button
Install
. In my case the installation took about one minute.
After the installation a window with the title
Platform has been ... installed
will pop up.
Click OK
on the pop up window.
Now we will try an example project. Click on the
Examples
tab, which is on the right of Boards
and left of Packages
. You may see that you first have to
install platform files. We already installed it, so try refreshing the
page by clicking on another tab or window and coming back to
Examples
.
We will use the Arduino framework. You should already see the
arduino-blink
example. It shows two files, (1)
platformio.ini
and (2) src\main.cpp
. Click on
the light 🟦 Import
button on the right of the drop-down
menu, where other examples can be found. Probably it will error out. I
filed an issue
on their bugtracker.
We will try another approach. On the PIO Home
tab,
click on Home
.
Click on New Project
. Project Wizard
window should pop up.
On the window:
blink
.f5529
.Arduino
selected.Location
as it is.A installation process status window will pop up. It took about 30
seconds to create the project. In Explorer
, you will see
the new project folder blink
with many folders and
platformio.ini
file inside.
Click on src
folder and main.cpp
. We
will compile and flash this program.
Click on the ✔️ icon on the right, on the same level with the
tabs PIO Home
, main.cpp
etc.
You will see TERMINAL
at the lower bottom of your screen
filled up with messages. PlatformIO will probably install the Energia
framework (Arduino framework adapted to MSP43x microcontrollers) and the
MSP43x toolchain (e.g., compiler, utility to convert an elf executable
to a hex file etc). At the end of this process, you will get
firmware.hex
.
Now let us program the microcontroller. Connect your board. In my case Windows did not ask for anything, so I believe the drivers are installed automatically.
Click on the ⬇️ on the right of the previous ✔️ icon and select
Upload
.
PlatformIO will download and install tool-dslite
. Then
it will try to initialize the MSP430 debugger. In this process you may
get the error:
Failed: MSP430: Error initializing emulator: No USB FET was found
.
This means that your operating system cannot find the MSP debug stack
(MSPDS) probably because it does not have the drivers.
Go to TI MSPDS page.
Click on View all
and scroll to the very bottom. Click on
Download options
for MSPDS-USB-DRIVERS
. There
click on the file corresponding to your operating system and install it.
You have to create an account because of US export controls 😕.
In Windows Device Manager
, after installation the two
serial ports exposed by the board (COM*
) will become:
MSP Application UART1
MSP Debug Interface
In VSCode, try Upload
ing again. In
Terminal
you will see Connecting...
and after
some lines Success
. However your board will do nothing
interesting 😐. So let us try a Hello world program on
microcontrollers: blinking an LED.
Copy and paste the following program from the
Examples
that we saw previously and replace the contents of
main.cpp
.
/*
* Blink
* Turns on an LED on for one second,
* then off for one second, repeatedly.
*/
#include <Arduino.h>
void setup()
{
// initialize LED digital pin as an output.
(RED_LED, OUTPUT);
pinMode}
void loop()
{
// turn the LED on (HIGH is the voltage level)
(RED_LED, HIGH);
digitalWrite// wait for a second
(1000);
delay// turn the LED off by making the voltage LOW
(RED_LED, LOW);
digitalWrite// wait for a second
(1000);
delay}
After using the Upload
function the button on the
right side of your code windows should have turned to a ➡️, which stands
for Upload
.
Click on Upload
. It will automatically build your
project if needed. During programming the red LED101
beside
the USB connector will be active. Then LED101
will turn off
and the red LED1
will start blinking. 🎉🥳
TODO
MSP430: Error initializing emulator: No USB FET was found
TL;DR: Plug your board off, then push the BSL button, plug in again while pressing the BSL button. Then release it. Then plug the board out and in again.
You tried the usual turn it off and on again tool, but you still get this error? This means the programmer cannot find the eZ-FET Onboard Emulator which is used to program the flash of the microcontroller. There are two MSP430 microcontrollers on the board: the target ..5529 and the debugger ..5528, where the latter is also used for programming the target microcontroller. In our case the ..5528 is not responsive and The above TL;DR gives the control ..5529 to the internal bootloader which in turn enables programming. I have experienced that the TL;DR action above made the ..5528 responsive again, however it did not work in another case.
If above did not help, then it may be still possible to reprogram the ..5528 using ..5529, which is described here.