In this post, I'm going to connect my Connected Launchpad to my Ubuntu 14.04 Notebook.
I hope if you know about Launchpads, you would probably be heard of Energia. Or if you are a beginner to the launchpad, then you would have used one. For the people who don't heard about any of the terms I said above, in simple words, if 'arduino' is for AVRs, then 'Energia' is for launchpads.
"Energia uses the mspgcc compiler by Peter Bigot and is based on the Wiring and Arduino framework. Energia includes an integrated development environment (IDE) that is based on Processing." (source : Energia Reference - Introduction ).
I have previous experience with arduino, so I thought of starting with energia.
Basically we have to do three steps to setup the development environment :
0. Setup Java if you don't have it already.
1. Download and extract energia
2. Setup the udev rules and group permissions
3. Turn On. Tune In, Boot Up
0. Setup Java if you don't have it already.
I'm on my new Ubuntu installation( 14.04 ), I have to setup everything from first. Installing Java in Ubuntu is not a difficult task at all -- you can install OpenJDK from synaptic package manager. But what if you want to use Oracle Java??
Fortunately I found a ppa-repo which hosts ubuntu packages of Java8. Fire up your terminal and key in these commands.
>> sudo add-apt-repository ppa:webupd8team/java
>> sudo apt-get update
>> sudo apt-get install oracle-java8-installer
Now grab a cup of coffee and wait for a few minutes. The installer will download and install the correct java packages.
1. Download and extract energia
You can go to Energia download page Energia Reference - Getting Started. Select your architecture( 32/64 bit ). ( I am having a 64 bit installation and tried to install 32bit version unknowingly and went through a load of crazy errors, which speaks alien languages and very hard to debug. So make sure you have the correct binary) The 32bit binary in approx 140MB .tgz and 64 bit is approx 205MB. Once the package is downloaded, you can extract it to any path you want. I created a folder 'energia' under '/opt'. This is the usual place where the additional software will get installed in your ubuntu.
Once you extract it under '/opt/energia/' it will create a folder 'energia-0101Exxxx'. And now energia is installed( but may not be ready to use ) in your system.
2. Setup the udev rules and group permissions
This is one of the most confusing steps in the installation procedure. Truth to be told, I still don't understand what these things means but found these 'alien codes' by googling. This step is only necessary only if you want to run energia as a non-root user. What we have to do is to setup some rules and tell ubuntu to how to access the launchpads once connected.
What you have to do is create the following files inside '/etc/udev/rules.d/' folder( of course you have to do this as root )
>> cd /etc/udev/rules.d/
>> sudo touch 47-tm4c1294.rules
>> sudo touch 70-mm-no-ti-emulators.rules
>> sudo touch 71-ti-permissions.rules
>> sudo touch 99-icdi.rules
Now we have created four blank files, it's time to fill them. Open each of them as root and copy-paste these contents( you can use >> sudo gedit <filename> ).
Contents in 47-tm4c1294.rules
SUBSYSTEM=="usb",ATTR{idVendor}=="1cbe",ATTR{idProduct}=="00fd",GROUP="dialout",MODE="666"
Contents in 70-mm-no-ti-emulators.rules
ACTION!="add|change", GOTO="mm_usb_device_blacklist_end"
SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end"
ENV{DEVTYPE}!="usb_device", GOTO="mm_usb_device_blacklist_end"
# TI USB Emulators
ATTRS{idVendor}=="2047", ATTRS{idProduct}=="0010", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="2047", ATTRS{idProduct}=="0013", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="2047", ATTRS{idProduct}=="0014", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="2047", ATTRS{idProduct}=="0203", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="2047", ATTRS{idProduct}=="0204", ENV{ID_MM_DEVICE_IGNORE}="1"
LABEL="mm_usb_device_blacklist_end"
Contents in 71-ti-permissions.rules
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="0403",ATTRS{idProduct}=="a6d0",MODE:="0666"
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="0403",ATTRS{idProduct}=="a6d1",MODE:="0666"
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="0403",ATTRS{idProduct}=="6010",MODE:="0666"
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1cbe",ATTRS{idProduct}=="00fd",MODE:="0666"
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1cbe",ATTRS{idProduct}=="00ff",MODE:="0666"
ATTRS{idVendor}=="0451",ATTRS{idProduct}=="bef0",ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="0c55",ATTRS{idProduct}=="0220",ENV{ID_MM_DEVICE_IGNORE}="1"
KERNEL=="ttyACM[0-9]*",MODE:="0666"
Contents in 99-icdi.rules
ACTION!="add|change", GOTO="openocd_rules_end"
SUBSYSTEM!="usb", GOTO="openocd_rules_end"
ENV{DEVTYPE}!="usb_device", GOTO="openocd_rules_end"
# PC Instruments
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="dc48", MODE="777"
# TI Stellaris Evaluation Board (several)
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bcd9", MODE="777"
# TI Stellaris In-Circuit Debug Interface (ICDI) Board
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bcda", MODE="777"
# LMICDI
ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="777"
LABEL="openocd_rules_end"
Once you have saved all those files, now add yourself to the group who can access the TTY devices
>> sudo adduser $USER dialout
And by now, you will be able to access CLP as non-root user.
3. Turn On. Tune In, Boot Up
And now, the 32 bit guys are ready to use energia.( 64bit guys, please wait. We have a few more steps to complete ) You can go the installation directory and start energia script to start energia :
>> cd /opt/energia/energia-0101-Exxxx
>> chmod +x energia
>> ./energia
For the 64 bit guys, it turns out that although our energia installation is 64bit, the internal tool chain being used is still 32-bit. If you try to run energia now, energia will start but while trying to compile you will get wired errors like the compilers not found or the called command doesn't exist. The solution is to install 32bit support for your 64bit system ;
>> sudo apt-get install libc6:i386
This is little hack that will let you run 32bit binaries in 64bit OS. After installing the package, you can start energia by using the above commands used by 32 guys.
After starting energia, you have to set your USB port and Board.
To set board : Tools -> Boards -> Launchpad(Tiva C) w\ tm4c129 (120Mhz )
To set USB port : Tools -> Serial Port -> '/dev/ttyACMx'
Now tryout some examples and make sure that everything works fine.
But what if I'm not able to select my Serial Port???
First make sure that your board is properly connected. Once you connect, the power LED should lit up. Also try ls /dev before and after connecting you launchpad. If a new entry will ttyACMx is showing after connecting launchpad, then the device is connected. Something we got wrong with our udev rules. Don't worry. You can start energia as root user and to all the stuff.
>> sudo ./energia
happy coding,
vish