MSP430-related notes

Gökçe Aydos

Environment installation for 62752 Measurement and control using Microcontroller

Windows

  1. Install Visual Studio Code (VSCode) using Microsoft Store. The version with Insiders is the beta (pre-release) version – the release version should work.

  2. Open VSCode and pin it to your taskbar using 🖱️ right click and selecting Pin to taskbar.

  3. If you install it for the first time, feel free to follow the tutorial advertised on the first page.

  4. 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.

  5. 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.

  6. You will see on the left your new workspace in EXPLORER bar.

  7. 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.

  8. 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.

  9. 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.

  10. Click on Create New Project. A new tab called PIO Home should open up.

  11. Click on Project Examples. A small window will pop up.

  12. You probably won’t see any examples. Click on Install Embedded Platform. A new page with a search bar will show up.

  13. Search for msp. Click on TI MSP430. A new page with a search bar will show up.

  14. 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.

  15. Click OK on the pop up window.

  16. 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.

  17. 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.

  18. We will try another approach. On the PIO Home tab, click on Home.

  19. Click on New Project. Project Wizard window should pop up.

  20. On the window:

    1. Name your project blink.
    2. You probably have the Launchpad MSP-EXP430F5529LP. So, search for f5529.
    3. Leave Arduino selected.
    4. Leave 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.

  21. Click on src folder and main.cpp. We will compile and flash this program.

  22. 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.

  23. 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.

  24. 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.

  25. 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:

    1. MSP Application UART1
    2. MSP Debug Interface
  26. In VSCode, try Uploading 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.

  27. 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.
      pinMode(RED_LED, OUTPUT);
    }
    
    void loop()
    {
      // turn the LED on (HIGH is the voltage level)
      digitalWrite(RED_LED, HIGH);
      // wait for a second
      delay(1000);
      // turn the LED off by making the voltage LOW
      digitalWrite(RED_LED, LOW);
       // wait for a second
      delay(1000);
    }
  28. After using the Upload function the button on the right side of your code windows should have turned to a ➡️, which stands for Upload.

  29. 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. 🎉🥳

Mac

TODO

Troubleshooting

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.