Showing posts with label MSP430. Show all posts
Showing posts with label MSP430. Show all posts

MSP430 - Online Resourses

Some relevant online resources for those who want to start exploring microcontrollers, especially the TI MSP430G2 LaunchPad development board. This page will be updated from time to time.

How/Where to start?
Manufacturer
Technical Documents
  • SLAC485. Sample MSP4302553 codes.
  • SLAU144J. MSP430x2xx Family User's Guide
Resellers
Tutorials / Webinars / Workshops
Community Sites
University courses based on MSP430
  • ECE2049: Embedded Computing in Engineering Design.
  • EE3376: Microprocessors.
Books
Using other programming languages
  • Assembly programming with MSP430. Contains a list of of online resources related to assembly programming with MSP430.
  • Mecrisp. Another implementation of Forth for MSP430.
  • noForth. Interactive Forth programming language for MSP430. Do this if you want to learn Forth and hardware control through the Egel project.

This Week I Learned - 2017 Week 35

Last week post or revisit some old archived posts.


Long holidays and I finally have extra time to clear off some of those pesky and pending to-do list. Learned quite a lot this week, especially from different electronic devices and computer hardware.


Software development 450 words per minute. (via Reddit / HN). Be grateful. That's probably takeaway from the article itself. I was wondering how it going to affect your hearing if you keep listen to the headphone non-stop for more than 8 hours per day?


Good post on introduction to mechanical key switches, specifically Cherry MX family. For a non-gamer but mostly using your keyboard for typing, Cherry MX Brown and Cherry MX Blue would be the preferred keyboard switch for a mechanical keyboard. The Brown switch was originally developed for Kinesis Keyboard. Yes, that company that created the ergonomic contoured keyboard. Meanwhile, the Blue switch, have same tactile feeling and clicking sound to IBM Model M but less activation force. Does mechanical keyboard worth it? Yes, only if you play lots of games, build a Battlestation, a mechanical keyboard enthusiast, or have extra money to burn.


Buying an air purifier? Fview YouTube channel is probably the best I've watched so far. Honest opinions with lots of satirical remarks in between. Just like taking an advice from a trustworthy friend. So which air purifier to buy? From the result and price point, just get Xiaomi Air Purifier even through you have to tolerate the high fan noise. I was surprised that few European brands are so expensive but the filtering output was mediocre. Most likely you're paying premium to the quality material and long term reliability. One thing I've learned from electronic devices made in China or electronic devices in general these days. There are not built for reliability. a throwaway device that only serve a purpose for a short period.




Yeah, the bokeh, colour, and contrast is phenomenal and surely will make you mouth-watering.  Just make sure you watch the YouTube video in highest resolution. The most important criteria is the colour (in JPEG) format shows the actual colour and contrast representative of what we saw with the reviewer eyes. Be warned, both Sony A9 and Voigtlander 50 Heliar V4 will cost you around MYR 21k. Definitely not worth it unless you have extra cash to burn. Even so, still not worth it.




More lesson regarding ConTeXt. Want to use Times New Roman, make sure you've installed the Tex Gyre package where it includes the Termes aka Times New Roman font.


Installation of more PWM casing fans. The motherboard seemed quite sensitive and there are numerous times I can't get to the POST screen. Reading through the POST troubleshooting steps, manage to boot up the machine again. Suspect loosen power wires, memory slot, or bended CPU pins were likely the contributing causes.

Fan speeds seems to be at an accepted range. There is an increase of volume heard but I like the white noise.
$ sensors | grep fan
fan1:         1704 RPM  (min = 1577 RPM, div = 8)
fan2:         1875 RPM  (min =  784 RPM, div = 8)
fan3:         1577 RPM  (min =  685 RPM, div = 8)
fan4:            0 RPM  (min = 3515 RPM, div = 128)  ALARM
fan5:            0 RPM  (min =  703 RPM, div = 128)  ALARM


Hardware UART in MSP430. I have no idea this is possible. Mainly because I have no idea what and how UART works anyway. And, I also found out that there is a UniFlash, which is the Universal Flash Programmer for all Texas Instruments devices. Seems to support MSP430 and GNU/Linux but I haven't try it out yet.


I was looking for a DAC and my research indicated that using Raspberry Pi with HiFiBerry would be a good choice. Maybe that could put my shelved Pi into good use?


Running Docker on Fedora host but have permission error with mounted volume?
$ docker run -it -v /home/ang/project:/export tts:latest bash

[email protected]:/export# ls -l                
ls: cannot open directory '.': Permission denied

To resolve this properly, since this is a SELinux permission issue (reason why you should always test your stuff in Fedora/Red Hat/CentOS distros), you can append extra `z` or `Z` character to the mounted volume option `(-v)` as shown below.

-v /home/ang/project:/export:z

Meanwhile, setting up Docker in Fedora to support non-root user. (Yes, there are many security concerns).
$ sudo groupadd docker && sudo gpasswd -a ${USER} docker && sudo systemctl restart docker
$ newgrp docker


Readjustment of my night computing usage. Turned on Gnome's Night Light. This is to reduce the effect of blue light affecting the body melatonic production.


LogiFind MSP430 LCD KIT-C - Part 2

Continue with our discussion with this development kit. In part 1, we've discussed on accessing the device through MSPDebug but with limited success. This post will continue on investigating different drivers used by MSPDebug in trying to identify and use it. The investigation will focus on the `tilib` driver.

$ mspdebug tilib
MSPDebug version 0.22 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2013 Daniel Beer
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

tilib: can't find libmsp430.so: libmsp430.so: cannot open shared object file: No such file or directory

Google results indicates that we need to download the driver file, `libmsp430.so` from the TI own MSP Debug Stack itself. See the screenshot below to get the right file.



Once you've downloaded and extracted the MSP Debug Stack package, looks for the right driver file that match your system, either it's 32-bit or 64-bit. Use the command below to identify that.
$ uname -m
x86_64

Since we're running on 64-bit system, we will need to copy the driver file, `libmsp430_64.so` to its path so `mspdebug` program can detect and use it. Based on the description in SLAU56b,
libmsp430_64.so: This file is the dynamic library for Linux 64 bit and contains the device control functions. This file is normally located in the same directory as your application’s executable file, or in your computer system’s default library search path. This file is used during run-time.
Alternatively, you can compile the `tilib` library on your own.

The next step is to identify where is the default library search path. This is where the `ldd` program will help us.
$ ldd $(which mspdebug)
linux-vdso.so.1 =>  (0x00007ffdc6c98000)
libusb-0.1.so.4 => /lib/x86_64-linux-gnu/libusb-0.1.so.4 (0x00007f9817461000)
libreadline.so.7 => /lib/x86_64-linux-gnu/libreadline.so.7 (0x00007f9817217000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9816ff9000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9816df5000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9816a2e000)
libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f9816803000)
/lib64/ld-linux-x86-64.so.2 (0x0000556b71a1a000)

Once we've identified the library search path, copy the dynamic library file and rename it as `libmsp430.so`.
$ sudo cp libmsp430_64.so /lib/x86_64-linux-gnu/libmsp430.so

Rerun MSPDebug program using the `tilib` library and there is no more missing dynamic library error.
$ mspdebug tilib
MSPDebug version 0.22 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2013 Daniel Beer
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

MSP430_GetNumberOfUsbIfs
No unused FET found.

Again but explicitly the device name. We can see the device and chip ID. Unfortunately, I can't understand why it can't detect the chip as MSP430F413?
$ mspdebug tilib -d /dev/ttyUSB0
MSPDebug version 0.22 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2013 Daniel Beer
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

MSP430_Initialize: /dev/ttyUSB0
Firmware version is 0
MSP430_VCC: 3000 mV
MSP430_OpenDevice
MSP430_GetFoundDevice
Device:  (id = 0x0000)
0 breakpoints available
MSP430_EEM_Init
Chip ID data: 04 00 55
......

Nevertheless, we're getting somewhere. More investigation in coming post.

LogiFind MSP430 LCD KIT-C - Part 1

As I was looking into available development kit of MSP430, I've made another curiousity purchase of another kit. This time is LogiFind's MSP430 LCD KIT-C, another tiny MSP430 kit using MSP430F413. Device is shown below (screenshot from local reseller, Partsories). As the device is powered through USB Type B connector (typically used by printer or camera), I've to purchase another USB Type A to Type B connector. Driver and documentation is located at LogiFind site.


Power up the device through my lappy seems straightforward, and the LCD immediately displays the current time and three red LED lights (TEST1, TEST2, and PWR) were turned on. The TEST1 and TEST2 LED lights were blinking continuously.

Checking the device info from the USB port in GNU/Linux shows that USB was detected as serial port or USB to serial interface bridge.
$ lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Even more details on the USB device.
$ sudo lsusb -D /dev/bus/usb/001/003
Device: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Device Descriptor:
bLength                18
bDescriptorType         1
bcdUSB               1.10
bDeviceClass            0 (Defined at Interface level)
bDeviceSubClass         0
bDeviceProtocol         0
bMaxPacketSize0        64
idVendor           0x067b Prolific Technology, Inc.
idProduct          0x2303 PL2303 Serial Port
bcdDevice            3.00
iManufacturer           1 Prolific Technology Inc.
iProduct                2 USB-Serial Controller
iSerial                 0
bNumConfigurations      1
Configuration Descriptor:
bLength                 9
bDescriptorType         2
wTotalLength           39
bNumInterfaces          1
bConfigurationValue     1
iConfiguration          0
bmAttributes         0x80
(Bus Powered)
MaxPower              100mA
Interface Descriptor:
bLength                 9
bDescriptorType         4
bInterfaceNumber        0
bAlternateSetting       0
bNumEndpoints           3
bInterfaceClass       255 Vendor Specific Class
bInterfaceSubClass      0
bInterfaceProtocol      0
iInterface              0
Endpoint Descriptor:
bLength                 7
bDescriptorType         5
bEndpointAddress     0x81  EP 1 IN
bmAttributes            3
Transfer Type            Interrupt
Synch Type               None
Usage Type               Data
wMaxPacketSize     0x000a  1x 10 bytes
bInterval               1
Endpoint Descriptor:
bLength                 7
bDescriptorType         5
bEndpointAddress     0x02  EP 2 OUT
bmAttributes            2
Transfer Type            Bulk
Synch Type               None
Usage Type               Data
wMaxPacketSize     0x0040  1x 64 bytes
bInterval               0
Endpoint Descriptor:
bLength                 7
bDescriptorType         5
bEndpointAddress     0x83  EP 3 IN
bmAttributes            2
Transfer Type            Bulk
Synch Type               None
Usage Type               Data
wMaxPacketSize     0x0040  1x 64 bytes
bInterval               0
Device Status:     0x0000
(Bus Powered)

Next, is to check the connectivity through MSPDebug.
$ mspdebug --usb-list
Devices on bus 002:
    002:002 8087:0024
    002:001 1d6b:0002
Devices on bus 001:
    001:003 067b:2303
    001:002 8087:0024
    001:001 1d6b:0002

It seems I need to find a way to connect to it either through TI, FET, or Olimex FET driver.
$ mspdebug --fet-list | grep "Devices\|MSP430F413"
Devices supported by FET driver:
    MSP430F1611        MSP430F413         MSP430F6435
Devices supported by Olimex FET driver:
    MSP430F4132              MSP430F6730
    MSP430F5333              Preliminary_MSP430F413

More to connecting through MSPDebug in coming post.

This Week I Learned - 2017 Week 09

Last week post or the whole series.

Medical checkup. Enough said.

#1 Geek Career Paths. Or should I just rephrase it as where does old grumpy programmer goes? Tim Bray shares his experiences and explores different different career paths for a technical person. There is one thing missing from the list, being a teacher, especially when come to tech-related stuff. Something which I found surprisingly fulfilling and engaging, putting aside some idiocy office politics.

#2 Why we use 32768 KHz crystals? The MSP430G2 LaunchPad came with a 32k-Hz crystals. Unfortunately, you will need to solder it manually yourself. What is a crystal (think salt) or cyrstal oscillator? Basically a electronic component used generate consistent time.


While we're at electronic, there exists a type of clock which is powered by electric and the accuracy is determined by utility frequency of 50 or 60 Hz.

#6 Design Patterns revisit. The main purpose of any pattern book is to have a common vocabulary of how things are organized. After so many years, some patterns are still not built into the programming languages. Good examples are:
// Unit of work, commits changes before the reference gets removed from stack
public unit CustomerForm { } 

// There can be only one.
public singleton DatabaseConnectionHighlander {}

// Any method called updates values in some way
public builder QueryString {}

#7 What Happens to Your Body on a Thru-Hike (via HN). Most important blogpost I've read so far when come to health. Walk as much as possible, especially after meals may increase your metabolic efficiency. Cut down those refined carbs as well. Before you start any plan to keep yourself healthy, you must measure before you can improve. Knowing what to measure and where you stands is half the effort for healthy lifestyle. List of items to measure are:

Body Mass Index (BMI). To determine your body fat which directly indicates whether you are obese or not. Measure yourself.

Resting Heart Rate (RHR). Measurement is quite easy and you do not need special equipment, just two fingers and a timer. First, locate your pulse. You can sense this at your wrist, side of the neck, inside of elbow, or top of the foot. Then, place index and middle fingers on these areas. Count the number of beats over 30 seconds and double that figure. Similarly, count the beats by 15 seconds and multiple by 4 to get the heart rate per minutes. Do this while resting (after you've wake up in the morning) and log the counts for several times per week.

What does this RHR indicates? It shows physical fitness. RHR is the number of times within a minute for your heart to pump all the blood to your whole body. Figure within the range of 40 till 100 is considered as normal but if your RHR falls within the range of 80 till 100, chances of you getting cardiovascular disease is extremely high. Athlete will have lower RHR of 40. To lower your RHR, there is no other way than exercise.

Blood sugar. Hemoglobin A1c. For screening and diagnosis of diabetes or pre-diabetes.

Cortisol and Testosterone. Especially for a man, both hormones are highly influences to your health. We should striving for low Cortisol and high Testosterone level. Stress is linked to Cortisol level, the higher, the more stressful you are. Meanwhile, Testosterone defines, physically, what makes a man, man. For example, muscle development and your sex drive. I can't seems to find local

Metabolic efficiency. How efficient your body in burning carbs and fat? While it's more relevant for athlete involved with endurance sports, it's good to know how you can fully optimize your body energy usage. Check out Andrew Skurka's detail post on this.

This Week I Learned - 2017 Week 06

Last week post or the whole series.

Slow week. Just back from holiday and my aging brain is slowly picking up the pending tasks on hand. Not a productive week.

Changing my approach to handle to-do list when comes to own personal project. Have an idea or looking at a procastinated long list, just get something up. Don't care it's not working, even a simple "Hello World!" is good enough. Once it's up, you will have to tendency to do something about it later or in future. It's basically just moving an item from a to-do list to another form of to-do list. Nevertheless, something get started somehow. Best to keep the momentum going.

#1 MSP 430 Competitive Benchmarking (SLAA205C, PDF). Is an old (2009) benchmarking results comparing MSP430 (MSP430F5439) against several other microncontrollers. For more up-to-date results, see the report from EEMBC. CPU is not just the main factor, sometimes, power consumption is an important deciding criteria. Top 5 most efficient microcontrollers according to ULPBench.

#2 The answer is seven. When end result have higher social values over hardworks (you can trace it back to financial reason), do we still care crap about the effort? People always looking for shortcuts in life. Some would prefer to call this being smart and efficient where the goal is to spend minimum efforts to obtain maximum output. Have you encounter student who tried to contest the exam result when he put little efforts? There exists a group of people who are lazy and entitied. Well, laziness is virtue right?

#3 Reverse-Engineering work on the TL-WR703N 150M 802.11n Wi-Fi Router. Interesting works on TL-WR730N which was used as a cheapest embedded GNU/Linux platform (OpenWrt). However, it's quite hard to find this in MY anymore but there is another model which superseded it, TL-MR3020. Alternative choices includes GL-MT300N and Nexx WT3020. I was considering getting one but hold that thought because I'm not sure what to do with it. My Raspberry Pi and Beagleboard still collecting dust.

#4 Ceriatone. Surprising good (from the YouTube reviews) and "affordable" (compare to those established amp makers) guitar tube amp board kits from MY. See TubeDepotTV if you want to find out how to assembly your own guitar tube.

While we're on guitar. Thinking of getting a Squier? Watch Squier Roundup: A look at six Squier guitars from worst to first. Which Squier then? Anything over MYR1000 should be a good choice. To be more specific, skip all Affinity or Bullet series and those made in China.

#5 Box Breathing via HN. The steps is quite straight forward, inhale, stop, exhale, and stop. Just four steps with different duration for these four steps. There are several other breathing techniques as well like The Stimulating Breath4-7-8 Breath, and Breath Counting. I've tried different Android app, so far, Breathe (similar to the Box Breathing site) works for me.

This Week I Learned - 2017 Week 05

Last week post or whole series.

Always an interesting CNY holidays. The flood was not as worse as it seems. The weather is good and the air, seems cleaner. I've managed to get some good rest and deep sleep (more on this in #4).

#1 Canonical have launch Ubuntu tutorials, a step-by-step guideline for setting up development or devops related activities. I was surprise that they started the tutorial using Intel Joule 570x (their answer to IoT?) as the reference hardware. With a price tag of USD 369, I failed to see how this development kit is going to gain any traction when compare to Raspberry Pi. Maybe the target audience is not the Maker community but the industry?

#2 I've bought TI MSP430 development kit to learn more about embedded programming. So far,, the only thing I learned is microcontroller or MCU is "computer on a chip" or also known as System on a chip (SoC). Compare to the Arduino, Raspberry Pi, or Beageboard, it's way more low-level and cheaper. Once I've done with this, the next SoC that I will get is the ESP32, the successor to ever popular ESP8266. For the time being, the next step is introductory write-up on the hardware, setup the development board, testing the serial communication, go through the tutorials, and follow these four things to do with new microcontrollers.

I've noticed that there is this M430F1612 chip (square shape) on the launchpad. Feature-wise, it's similar to MSP430G2553 (rectangular shape) but was used for debugging purpose via JTAG from our computer.

I was thinking on getting more MSP430G2553 and stumbled upon this site, FindChip, which can search through all the popular electronic parts resellers. Note that the search links does contains affiliate links. But is a good way to find available stock and prices in one place.

#3 Are we over-dramatize our life or why people need drama in their life? Sometimes, no news is good news. If you ever complain about boring and simple life, you've been trying to mold your life according to a fairy tale. Follow your dream is such a clichéd pieces of advice. Too abstract and too vague. Be more specific, for example, stay healthy by exercising for 30 minutes on 5 days a week.

#4 Interesting idea on restricting exposure of lights can affect your sleep patterns. I've been living in the city for many years and my exposure and computing usage (you brain is kept active and Melatonin production is delayed) have somehow affecting my sleep cycle and thus my health. Maybe I should switch to something like Philips Hue Bulb? Need to readjust my time and remember, bedroom is for sleeping. Is okay to have TV in the room, just for the sake of white noise. Maybe because there is a healthier life without Internet. Remember, there is way to get you hook on an app or site. Off course, there is antidote to that as well.

#5 "Short answer, It doesn't. Long answer, It does not." Regardless the context of the discussion, the comment is both humourous and fscking brilliant. There is a similar saying as well. "To make it short, is a long story". Maybe we should invest our time in writing? While we on writing, be careful when you use the pharase "duly noted". It usually means "heard and ignored" in a sarcastic way or if you add an extran 'l', it becomes "dully" noted, which means you "barely" acknolwdge. To prevent unnecessary misunderstanding, replace it with "Got it, thanks!" (informal) or "Noted, and thanks!" (format).

MSP430 - Serial Communication Monitoring

Follow up on last post, I supposed to write about usage of MSPDebug but instead we will discuss out capturing the output from the LaunchPad.

The default microcontroller, MSP430G2553 was pre-installed with a demo Temperature Measurement program. Once you've powered up the LaunchPad via USB port, the red and green LED will toggle alternatively. Pressing the P1.3 button (left to the blinking LEDs) will start the measurement. To reset back, press the reset button (right to the blinking LEDs).

Since the only visual indicator (did I mentioned I should have bought the other LaunchPad with embedded LCD?) of the program is through the LEDs, how to we obtain the measurement of the temperature? Basically using mspdebug, stty, and cat (similar post but with more descriptions)
$ mspdebug rf2500 exit
$ stty 2400 -F /dev/ttyACM0
$ cat /dev/ttyACM0

There are other ways to read or sniff raw data from serial ports but this is out of the scope of the discussion here.

Press the P1.3 button to start the measurement. You will obtain a series of characters as shown below. Each character is the numerical representation of the ASCII characters. P indicates 80 °F / 26.67 °C and Q indicates 80 °F / 27.22 °C.
QPQPQQQQQQQPQQQQQQQPQQQQQQPQQQPQQQQQPQQQQQQQQQ

From the output above and `dmesg` output when we plugged in the USB cable to power up the LaunchPad, the device will be assigned to device name of `ttyACM0` instead of `ttyUSB0`. TTY stands for TeleTYpewriter.
[21518.005311] cdc_acm 2-1.2:1.0: No union descriptor, testing for castrated device
[21518.005357] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device

Why so? Turn out for any USB communication devices like embedded microcontrollers or mobile phones, it's reusing an old control model called Abstract Control Model (ACM) for exchanging raw data. In other words, these devices were identified as modem and communication is done by reusing an old modem communication standard.

To reconfirm that, show all information on `/dev/ttyACM0' using `udevadm` command. For privacy reason, serial number have been replaced with `XXX`.
$ udevadm info /dev/ttyACM0
P: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/tty/ttyACM0
N: ttyACM0
S: serial/by-id/usb-Texas_Instruments_Texas_Instruments_MSP-FET430UIF_XXX-if00
S: serial/by-path/pci-0000:00:1d.0-usb-0:1.2:1.0
E: DEVLINKS=/dev/serial/by-path/pci-0000:00:1d.0-usb-0:1.2:1.0
/dev/serial/by-id/usb-Texas_Instruments_Texas_Instruments_MSP-FET430UIF_XXX-if00
E: DEVNAME=/dev/ttyACM0
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/tty/ttyACM0
E: ID_BUS=usb
E: ID_MM_CANDIDATE=1
E: ID_MODEL=Texas_Instruments_MSP-FET430UIF
E: ID_MODEL_ENC=Texas\x20Instruments\x20MSP-FET430UIF
E: ID_MODEL_FROM_DATABASE=eZ430 Development Tool
E: ID_MODEL_ID=f432
E: ID_PATH=pci-0000:00:1d.0-usb-0:1.2:1.0
E: ID_PATH_TAG=pci-0000_00_1d_0-usb-0_1_2_1_0
E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
E: ID_PCI_INTERFACE_FROM_DATABASE=EHCI
E: ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
E: ID_REVISION=0105
E: ID_SERIAL=Texas_Instruments_Texas_Instruments_MSP-FET430UIF_XXX
E: ID_SERIAL_SHORT=XXX
E: ID_TYPE=generic
E: ID_USB_DRIVER=cdc_acm
E: ID_USB_INTERFACES=:020201:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=Texas_Instruments
E: ID_VENDOR_ENC=Texas\x20Instruments
E: ID_VENDOR_FROM_DATABASE=Texas Instruments, Inc.
E: ID_VENDOR_ID=0451
E: MAJOR=166
E: MINOR=0
E: SUBSYSTEM=tty
E: TAGS=:systemd:
E: USEC_INITIALIZED=21528600683

MSP430 - Setting Up LaunchPad Development Board with Ubuntu 16.10

Following up on previous post on MSP430 LaunchPad development kit. We'll proceed with setting the console-based development environment for MSP430 in Ubuntu 16.10. Once this is have been done, we will look into how to interact with MSP430 through MSPDebug via USB interface.

First, find all relevant packages for MSP430.
$ apt-cache search msp430
binutils-msp430 - Binary utilities supporting TI's MSP430 targets
gcc-msp430 - GNU C compiler (cross compiler for MSP430)
gdb-msp430 - The GNU debugger for MSP430
msp430-libc - Standard C library for TI MSP430 development
msp430mcu - Spec files, headers and linker scripts for TI's MSP430 targets
mspdebug - debugging tool for MSP430 microcontrollers

However, notice that the GNU toolchain for MSP430 in the repository is still using the old GCC version of 4.6.3. A newer version of the 5.x toolchain (maintained separately by different vendor) exists but you'll need to install it manually.
$ dpkg -L gcc-msp430 | grep bin | grep gcc-
/usr/bin/msp430-gcc-4.6.3

Install all these packages.
$ apt-cache search msp430 | awk '{print $1}' | xargs sudo apt-get install -y -

Open your console and run `dmesg` command in tail mode.
$ dmesg -w

Plug in and power up the LaunchPad to your USB port. By default, MSP430G2553 will have a demo temperature measurement app installed. Once you've connected through USB, there still be a sequence of LED blinking between red and green color. To stop that, please the P1.3 button to start the Temperature Measurement mode (I've no idea what this, just follow the Quick Guide).

Output of `dmesg` as follows. Note I've removed the serial number for privacy reason.
[ 2407.555756] usb 2-1.2: new full-speed USB device number 6 using ehci-pci
[ 2407.687908] usb 2-1.2: New USB device found, idVendor=0451, idProduct=f432
[ 2407.687913] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2407.687917] usb 2-1.2: Product: Texas Instruments MSP-FET430UIF
[ 2407.687920] usb 2-1.2: Manufacturer: Texas Instruments
[ 2407.687922] usb 2-1.2: SerialNumber: 
[ 2407.695830] cdc_acm 2-1.2:1.0: No union descriptor, testing for castrated device
[ 2407.695858] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
[ 2417.806759] hid-generic 0003:0451:F432.0004: usb_submit_urb(ctrl) failed: -1
[ 2417.806843] hid-generic 0003:0451:F432.0004: timeout initializing reports
[ 2417.807991] hid-generic 0003:0451:F432.0004: hiddev0,hidraw0: USB HID v1.01
Device [Texas Instruments Texas Instruments MSP-FET430UIF] on
usb-0000:00:1d.0-1.2/input1

The device, MSP-FET430UIF, is an external USB hardware debugging device but I'm not sure why the embedded USB interface was using the same serial number. Maybe it's using the same chipset? Also, you can probably ignore the error message in the log as we can connect to the board without issue.

You can also check the device id using `lsusb` command.
$ lsusb | grep Tool
Bus 002 Device 009: ID 0451:f432 Texas Instruments, Inc. eZ430 Development Tool

# More verbose details
$ lsusb -v -d 0451:f432

To connect to the board through the USB interface and MSPDebug program. Run this command and observe that the blinking LEDs have stop. Why we use `rf2500` driver? Turn out that the MSPDebug tool was originally written for EZ430-RF2500. The drive name was confirmed by showing the list of USB devices through MSPDebug. Again, serial number was removed for privacy concern. The bus:device number (002:011) may be different every time you plug in the USB cable.
$ mspdebug --usb-list | grep 2500
    002:011 0451:f432 eZ430-RF2500 [serial: ]

There are several ways to connect to MSP430. First way should be sufficient enough.
$ mspdebug rf2500

# Using bus:device id
$ mspdebug -U 002:011 rf2500

If there are no other errors, you should see below results.
MSPDebug version 0.22 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2013 Daniel Beer 
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Trying to open interface 1 on 007
rf2500: warning: can't detach kernel driver: No data available
Initializing FET...
FET protocol version is 30394216
Set Vcc: 3000 mV
Configured for Spy-Bi-Wire
fet: FET returned error code 4 (Could not find device or device not supported)
fet: command C_IDENT1 failed
Using Olimex identification procedure
Device ID: 0x2553
  Code start address: 0xc000
  Code size         : 16384 byte = 16 kb
  RAM  start address: 0x200
  RAM  end   address: 0x3ff
  RAM  size         : 512 byte = 0 kb
Device: MSP430G2xx3
Number of breakpoints: 2
fet: FET returned NAK
warning: device does not support power profiling
Chip ID data: 25 53

Available commands:
    =           erase       isearch     power       save_raw    simio       
    alias       exit        load        prog        set         step        
    break       fill        load_raw    read        setbreak    sym         
    cgraph      gdb         md          regs        setwatch    verify      
    delbreak    help        mw          reset       setwatch_r  verify_raw  
    dis         hexout      opt         run         setwatch_w  

Available options:
    color                       gdb_loop                    
    enable_bsl_access           gdbc_xfer_size              
    enable_locked_flash_access  iradix                      
    fet_block_size              quiet                       
    gdb_default_port            

Type "help " for more information.
Use the "opt" command ("help opt") to set options.
Press Ctrl+D to quit.
(mspdebug)

When you first execute the MSPDebug program, the temperature measurement app in the MSP430 will halt and waiting for your next command. To resume its execution, just type `run` command and the LEDs will start blinking. (provided you don't activate Temperature Measurement mode).
(mspdebug) run
Running. Press Ctrl+C to interrupt...

More to come as we will explore more and different usage with MSPDebug.

MSP430 LaunchPad - Introduction to Low-powered Microcontrollers Development Board

Two months ago, I was working on an assignment which involved writing code for a simulator where the targeted machine was a microcontroller (also known as MCU or SoC). There were numerous issues with the project. One of such issue is using Interrupt Service Routine (ISR) to display the LED light at a specific interval and duration. There are numerious ways to solve this (I only found this after the submission), but we didn't managed to get it done right during that time. Furthermore, the main goal of the assignment was to let everyone experience a software engineering process through different team roles. Hence, correctness is not the priority here. Nevertheless, these unresolved issues piqued my interest on embedded programming and C/C++ programming languages. Also, my own self-exploration exposed me to different microcontroller kits available in the Maker community.

When come to microcontroller kits, Arduino Uno is the preferred choice right now due to its popularity, which again, is due to its beginner friendliness. But these comments by david-given (a), IgorPartola, wyager, Declanomous, david-given (b), and sotojuan at HN convinced me that TI MSP430 LaunchPad would be a better choice. Cheap (I've made a mistake purchasing the wrong LaunchPad kit, more on this later) enough and low-powered microcontroller for anyone to learn embedded programming and study hardware.

The next step is to purchase the microcontroller kits. Now, which MSP43X LaunchPad development kits? I bought the original LaunchPad kit, MSP-EXP430G2 for roughly MYR 50+ inclusive of tax from Element14. Make sure you add comment to the order form that the purchase is for personal use. Otherwise the sales person will have to reconfirm with you again. If you still remember I said I made a mistake picking the wrong kit. If I were to choose again, I will pick MSP-430FR4133 instead although it's more expensive. Two good reasons. First, the development board have an embedded Liquid Crystal Display (LCD). You don't have to buy an additional LCD display and going through the hassle of connecting it through the breadboard. Second, the MSP-EXP430G2 is not supported by GNU/Linux version of Code Composer Studio, the default Integrated Development Environment. These are not critical issues but just merely minor inconveniences. Videos below will show more details on the differences between two development boards.





The item arrived within 3 working days in a black box. The list of items inside the box is clearly explained by video below.


The full list of items are:
  • 1pc Quick Start Guide (slac432a)
  • 1pc MSP-EXP430G2 LaunchPad development board
  • 1pc MSP430G2553 microcontroller (with temperature measure demo app)
  • 1pc MSP430G2452 microcontroller
  • 1pc Mini-USB cable
  • 1pc 32kHz external crystal (I've no idea what this for even I've read slaa322c)
  • 2pc 10-pin PCB Connector (2 male/2 female)
  • 2pc LaunchPad sticker
One mildly interesting thing is the MSP430 part numbers. For example, the breakdown of the part number of microcontroller MSP430G2553 are:
  • MSP430 = CPU
  • MSP = Mixed Signal Processor
  • 430 = 430 MCU platform
  • G = Flash (value line) memory type
  • 2 = Generation 2 series where speed is up to 16 Mhz
  • 5 = Model within the generation
  • 5 = Memory configuration (RAM: 0.5K, ROM: 8K)
  • 3 = Variant of the devices
In the coming post, we will go through on setting the development environment in Ubuntu 16.10. Stay tuned.