CC3200 with Code Composer Studio and Uniflash under GNU Linux

In this post I’m going to describe all the steps I did to be able to use TI’s Code Composer Studio and Uniflash under Ubuntu for developing on the CC3200 Simplelink WiFi Wireless MCU from Texas Instruments (http://www.ti.com/product/CC3200?keyMatch=cc3200&tisearch=Search-EN-Everything).
These steps may or may not work with other distributions and/or versions of the CC3200 SDK, CCS, CCS ARM compiler, TI-RTOS for simplelink, Uniflash etc.
If you wish to develop under GNU/Linux and you don’t want to use Code Composer Studio (for compiling(TI/gcc compiler) and debugging) but instead use gcc and OpenOCD, check the following link: https://hackpad.com/Using-the-CC3200-Launchpad-Under-Linux-Rrol11xo7NQ

System: Ubuntu 15.10 64 bit, kernel 4.2.0-36-generic .
Code Composer Studio version: v6.1.3
CCS TI ARM compiler: v15.12.2.LTS
TI RTOS for CC3200: v2_16_01_14
CC3200 SDK version: v1.2.0
CC3200 Service Pack: v1.0.1.6-2.6.0.5
Uniflash: v3.4
Board: CC3200-LAUNCHXL Rev 3.2 (http://www.ti.com/tool/CC3200-LAUNCHXL?keyMatch=cc3200&tisearch=Search-EN-Everything) with replaced MCU (see below).

cc3200tool is an open alternative to TI’s Uniflash. Flashing with Uniflash is described in steps 7 and 8. Flashing with cc3200tool is described in steps 7a and 8a. If you intend to use TI’s Uniflash, just ignore step 7a and 8a.

Step 9 describes replacing the XCC3200HZ present on my old revision of Launchpad with the CC3200R1. If you have a Launchpad with CC3200R1 just ignore this step. If your Launchpad has XCC3200HZ you can either 1.Buy a new Launchpad with CC3200R1, 2.Modify the cc3200.gel and cc3200v1p32.cmd for XCC3200HZ, 3.Follow the instructions at step 9 and replace the XCC3200HZ with CC3200R1 revision.

You can click any image in this post to see a larger version of it.

Step 1. Download and install Code Composer Studio
Visit http://www.ti.com/tool/ccstudio and download the Linux web installer. This will be in the form of an archive called CCS_web_linux.tar.gz. This contains two files, a README_FIRST.txt and in my case ccs_setup_6.1.3.00033.bin. Extract the contents of the archive and execute the provided .bin file.

$ tar -zxvf ~/Downloads/CCS_web_linux.tar.gz
$ chmod 777 ccs_setup_6.1.3.00033.bin
$ ./ccs_setup_6.1.3.00033.bin

This will start the installer. Accept the terms and conditions and click Next. The next window will ask you to specify an install folder for CCS, in my case it’s /home/simi/ti3. Click Next. The next page will ask you for what processor support to install. If you don’t care about other CPUs/MCUs/DSPs/etc from TI, but only about CC3200 with TI compiler, choose the following:
CCS1
Click Next. On the “Select Debug Probes” prompt, leave the ones that are selected by default. In my case they are “TI XDS Debug Probe” and “Tiva/Stellaris ICDI Debug Probe” (and they are greyed out, can’t uncheck them).
CCS2
Click Next. On the next page don’t enable anything if you don’t needed (like the EVE compiler and GUI composer), just click Finish. Now the installer will download some of the needed components and install them. Grab a cup of coffee and let it finish.

After this is complete, run as root the install_drivers.sh script from where you installed CCS

$ sudo ~/ti3/ccsv6/install_scripts/install_drivers.sh
TI XDS100 installation completed successfully.  Some versions of Linux
require a reboot in order for the driver to function properly.  For other
versions restarting udev is sufficient.  Restarting udev now ...

Next, start CCS. Either use the shortcut on your desktop or open a terminal and execute it from there

$ ./ti3/ccsv6/eclipse/ccstudio

When CCS is started, it will ask for a workspace location, in my case it’s /home/simi/workspace_v6_1_3_ex .
Next step, go to CCS App Center and select TI-RTOS CC32XX and TI ARM Compiler, click install:
CCS3
After this, CSS will prompt for a restart. Restart it and let it finish installing the selected items.

Step 2. Download and install the CC3200 SDK
Visit http://www.ti.com/tool/cc3200sdk and download the CC3200 SDK. This will be a windows binary, in my case it’s called CC3200SDK-1.2.0-windows-installer.exe . Start it with wine.

$ wine ~/Downloads/CC3200SDK-1.2.0-windows-installer.exe

This will start the installer. Click Next and accept the terms and conditions. The next step will ask you where to install the SDK. Don’t keep the default location (C:\TI\CC3200SDK_1.2.0), preferably make it point to your TI folder, like this Z:\home\simi\ti3 . Click next, let it finish installing. When prompted for installing FTDI drivers, click no. If the installer crashes at this step just ignore it.

Step 3. Import an example and tweak CCS to make it actually work
In this post, I’m choosing the CC3200 “wlan_ap” example. It’s a fairly complex example and if this works OK, probably the other examples will also compile OK.
In CCS, on the Getting Started page, click “Import Project”, click Browse and select the CC3200 SDK folder.
CCS4
Now check “wlan_ap”, “driverlib”, “oslib”, “simplelink” and “ti_rtos_config”. Do not check the “Copy projects into workspace” box, the wlan_ap project will be automatically imported in your workspace, the other projects will remain where they should, in the SDK. Click Finish.
If you try at this point to compile the wlan_ap example you’ll get a bunch of unresolved symbol errors. If you look at oslib project, it will give an error: “This project was created using a version of compiler that is not currently installed: 5.2.6 [ARM].”
Right click on this project and select properties. Under the Compiler Version , choose the compiler that you have installed instead of the old 5.2.6. In my case it’s 15.12.2.LTS.
CCS5
Repeat this step for the rest of the projects, “wlan_ap”, “driverlib”, “simplelink” and “ti_rtos_config”.
Now rebuild the projects. Right click on “driverlib” and click Rebuild Project.
CCS6
Repeat this step for “oslib” project.

When trying to rebuild the “simplelink” project, it will fail with :
gmake: *** No rule to make target ‘/home/simi/ti3/cc3200-sdk/simplelink/Source/device.c’, needed by ‘device.obj’. simplelink Unknown C/C++ Problem
gmake: *** No rule to make target ‘/home/simi/ti3/cc3200-sdk/simplelink/Source/driver.c’, needed by ‘driver.obj’. simplelink Unknown C/C++ Problem
……..
gmake: *** No rule to make target ‘/home/simi/ti3/cc3200-sdk/simplelink/Source/wlan.c’, needed by ‘wlan.obj’. simplelink Unknown C/C++ Problem

gmake: Target ‘all’ not remade because of errors. simplelink C/C++ Problem

The problem is caused by TI using a mix of uppercase and lowercase characters in their Makefiles for the “source” directory. (Source and source). A simple dirty fix for this is to make symlink.

$ ln -s ~/ti3/cc3200-sdk/simplelink/source ~/ti3/cc3200-sdk/simplelink/Source

After creating this symlink, right click on the “simplelink” project and hit Rebuild Project. This time it will compile.

Next is the “ti_rtos_config” project. This step may generate an error if an incompatible version of TI RTOS is installed, or a warning if a compatible version of TI RTOS is installed. Right click on the “ti_rtos_config” project and select properties. Under the RTSC tab, under “TI-RTOS for CC32XX”, check the version of TI RTOS that you have installed. In my case it’s 2.16.1.14.
CCS7
After selecting the TI RTOS for CC3200 version, click OK try to rebuild the “ti_rtos_config” project again. This may fail with the following error:
“makefile:38: recipe for target ‘configPkg/linker.cmd’ failed
/home/simi/ti3/xdctools_3_32_00_06_core/xs.x86_64U: error: can’t create session manager: can’t find a JVM; the environment variable ‘XDCTOOLS_JAVA_HOME’ is set, but does not appear to be a directory containing a 64-bit Java Runtime Environment (1.7 or greater); e.g., ‘/usr/lib/jvm/java-7-openjdk-amd64′.”

Right click again on the “ti_rtos_config”, click Properties. Go to “Build”, click the “Environment” tab. There should be an XDCTOOLS_JAVA_HOME variable. Select it, click on edit and replace “/home/simi/ti3/ccsv6/eclipse/jre” with a location pointing to your JRE installation, in my case it’s “/usr/lib/jvm/java-7-openjdk-amd64″
CCS8
Click OK, OK. Right click on “ri_rtos_config” project and rebuild it. This time it should compile without issues.

After “driverlib”, “oslib”, “simplelink” and “ti_rtos_config” projects were compiled, it’s time for the actual example, “wlan_ap”. Right click on it and select rebuild project. It should compile without issues.

Connect the Launchad to your computer with an USB cable. You should see the following in dmesg:

$ dmesg | tail
[12350.305079] usb 1-4: new full-speed USB device number 9 using xhci_hcd
[12350.438043] usb 1-4: New USB device found, idVendor=0451, idProduct=c32a
[12350.438046] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12350.438048] usb 1-4: Product: USB <-> JTAG/SWD
[12350.438050] usb 1-4: Manufacturer: FTDI
[12350.438051] usb 1-4: SerialNumber: cc3200

Set the “wlan_app” project active by double clicking on it. The next step would be to press F11 or click Run->Debug in CCS but this won’t work because it’s missing the configuration file for debugging the CC3200 device.
CCS9
Click No. Go to View->Target Configurations. A “Target Configuration” window will appear. Right click on “User Defined” and select “Import Target Configuration”.
CCS10
Import the CC3200.xml file from your CC3200 SDK directory, in my case the file is located in /home/simi/ti3/cc3200-sdk/tools/ccs_patch/CC3200.xml. Click OK and select “Copy files” when prompted. Now in the “Target Configuration” window right click on the CC3200.xml under “User Defined” -> “Link File To Project” and select your project. In this case it’s “wlan_ap”.
CCS11
Now a CC3200.ccxml entry will appear in the “wlan_ap” project. After this step you can click Run->Debug/press F11 to start debugging the application.
CCS12

Step 4. UART connection

If the J6 and J7 jumpers are set on the “FLASH” position, the CC3200 UART goes to the FT2232C device on the LAUNCHPAD. If dmesg if checked, there is no ttyUSB* or ttyACM* device created.
In order to to this, first stop debugging in CCS. Under root run the following:

$ sudo su
# modprobe ftdi-sio
# echo 0451 c32a > /sys/bus/usb-serial/drivers/ftdi_sio/new_id

I created an udev rule for the above, which also changes the /dev/ttyUSB* file permission.

# cat /etc/udev/rules.d/71-ti-cc3200.rules 
ATTRS{idProduct}=="c32a", ATTRS{idVendor}=="0451", RUN+="/sbin/modprobe ftdi_sio", RUN+="/bin/sh -c '/bin/echo 0451 c32a > /sys/bus/usb-serial/drivers/ftdi_sio/new_id'"
KERNEL=="ttyUSB[0-9]*",MODE:="0666"

If dmesg is checked again ttyUSB0 and ttyUSB1 devices will appear:

[13714.326040] usbserial: USB Serial support registered for generic
[13714.329882] usbcore: registered new interface driver ftdi_sio
[13714.329906] usbserial: USB Serial support registered for FTDI USB Serial Device
[13725.876536] ftdi_sio 1-4:1.0: FTDI USB Serial Device converter detected
[13725.876663] usb 1-4: Detected FT2232C
[13725.877050] usb 1-4: FTDI USB Serial Device converter now attached to ttyUSB0
[13725.877116] ftdi_sio 1-4:1.1: FTDI USB Serial Device converter detected
[13725.877181] usb 1-4: Detected FT2232C
[13725.877482] usb 1-4: FTDI USB Serial Device converter now attached to ttyUSB1

Don’t worry about /dev/ttyUSB0, this is used by CCS while debugging and the /dev entry will actually disppear leaving only /dev/ttyUSB1.
/dev/ttyUSB1 can be used for seeing the CC3200 UART output or for flashing the SPI flash memory attached to the microcontroller (with Uniflash or cc3200tool alternative).

Open a terminal and start minicom (or your favorite alternative)

$ minicom -s

And select 115200 baud rate, 8n1, no flow control:
MNCM1
Now that minicom is started and listening on ttyUSB1, go back to CCS and start debugging the application.

CCS13

Both debugging and UART output from the MCU are working. Note that at this point ttyUSB0 device no longer exists.

$ dmesg | tail
[13714.329882] usbcore: registered new interface driver ftdi_sio
[13714.329906] usbserial: USB Serial support registered for FTDI USB Serial Device
[13725.876536] ftdi_sio 1-4:1.0: FTDI USB Serial Device converter detected
[13725.876663] usb 1-4: Detected FT2232C
[13725.877050] usb 1-4: FTDI USB Serial Device converter now attached to ttyUSB0
[13725.877116] ftdi_sio 1-4:1.1: FTDI USB Serial Device converter detected
[13725.877181] usb 1-4: Detected FT2232C
[13725.877482] usb 1-4: FTDI USB Serial Device converter now attached to ttyUSB1
*started debugging*
[14066.447232] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[14066.447252] ftdi_sio 1-4:1.0: device disconnected
$ ls /dev/ttyUSB*
/dev/ttyUSB1

Step 5. CCS debugging problems
First time when debugging and running the code on the CC3200 it will work properly. As we can see in the next picture, the MCU is now waiting for UART input:
CCS14
If debugging is stopped and started again, it will fail:
CCS15
The next time debugging is started it will work properly. 1 OK, 1 FAIL, 1 OK, 1 FAIL and so on.
A simple fix for this is simply to press the Reset button on the Launchpad each time after ending a debugging session.

Step 6. CC3200 service pack installation

Go to http://www.ti.com/tool/cc3200sdk and download the CC3200 service pack (CC3200SDK-SERVICEPACK). At the time of writing this post, the latest version is v1.0.1.6-2.6.0.5.
This will again download a windows .exe. Install it with wine.

$ wine ~/Downloads/CC3100_CC3200_ServicePack-1.0.1.6-2.6.0.5-windows-installer.exe

Click next, accept the terms and conditions, next. When prompted for the install path remove the default location (C:\TI\CC3100_CC3200_ServicePack_1.0.1.6-2.6.0.5) and preferably install it in your ti directory, in my case it’s “Z:\home\simi\ti3\CC3100_CC3200_ServicePack_1.0.1.6-2.6.0.5″.
If the installer fails like this:
WINE1
Don’t worry, all the needed files were already copied. If this bother you, you can open a terminal and change wine’s Windows version:

$ winecfg

WINE3
I had Windows 7 selected. After changing to Windows XP, the Service Pack installer completed successfully.

Now, in your service pack installation directory, you will have the following files installed:

$ tree  ti3/CC3100_CC3200_ServicePack_1.0.1.6-2.6.0/
ti3/CC3100_CC3200_ServicePack_1.0.1.6-2.6.0/
-- host_programming
-----host_programming_1.0.1.6-2.6.0.5_ucf.h
-----host_programming_1.0.1.6-2.6.0.5_ucf-signed.h
-- license.pdf
-- manifest.html
-- ota
----- ota_1.0.1.6-2.6.0.5.ucf.signed.bin
----- ota_1.0.1.6-2.6.0.5.ucf.ucf
-- readme.txt
-- servicepack_1.0.1.6-2.6.0.5.bin
-- uninstall.exe

2 directories, 9 files

Step 7. Flashing – TI’s Uniflash

For flashing the SOP2 jumper must be installed on the board. If the MCU is reset whith this jumper present, it will go into bootloader/programming mode.
Note that while debugging on the CC3200 Launchpad with CCS, it doesn’t matter if the SOP2 jumper is present or not.
After flashing, to be able to actually run your application, remove this jumper and reset the MCU.

Flashing uses the same serial port that’s used for seeing the MCU UART output. If you have minicom or another program keeping that /dev/ttyUSB1 device open, close that program first.

Ensure that J6 and J8 jumpers are set on FLASH position and SOP2 jumper is set:
20160610_013505

Go to http://processors.wiki.ti.com/index.php/Category:CCS_UniFlash and download the Linux version of Uniflash. Next execute the downloaded bin file. In my case it’s called uniflash_setup_3.4.1.00012.bin.

$ chmod 777 Downloads/uniflash_setup_3.4.1.00012.bin
$ ./Downloads/uniflash_setup_3.4.1.00012.bin

When the installer is started, click next, accept the agreement, next. Now choose the installation directory. I recommend to install it along the other TI tools installed earlier. I installed it in /home/simi/ti3/uniflash_3.4 . The next page will ask you about the platform support that you wish to install. If you don’t care about other MCUs/CPUs/DSPs, just check the items related to CC3200, like this:
UNIF2

Click Next, don’t check any additional JTAG debug probes (like Blackhawk and Spectrum Digital debug probes), click Next, Next. After all the files are copied, click Finish.

Now start the Uniflash tool. If you haven’t installed the above udev rule, you will need to run Uniflash with root rights. This post is going to cover only the GUI version, not the CLI one.

./ti3/uniflash_3.4/eclipse/uniflash

Now that Uniflash is started, click File->New Configuration. Under Target Setup, at Connection, select CC3X Serial(UART) Interface.
UNIF3

Click OK. Now under CC31XX/CC32XX Flash Setup and Control page, under COM port, enter your serial port number. DO NOT enter something like /dev/ttyUSB1 or ttyUSB1, even if that device does not exist (like /dev/ttyUSB999, Uniflash will just ask you to restart the device and complaing about not getting an ACK).
UNIF4

If your flashing port is /dev/ttyUSB1, just enter 1 under COM port. Now click “Get Version” to verify if the connection is OK.
UNIF5

Now go to “System Files” and click on “/sys/mcuimg.bin”. Under URL, select the wlan_ap binary of the example that was compiled in CCS, eg. /home/simi/workspace_v6_1_3_ex/wlan_ap/Release/wlan_ap.bin .
Check the “Erase”, “Update” and “Verify” boxes
UNIF6

Next click on Operation->Program. If everything is OK, it should look like this:
UNIF7

Complete flashing log:
[16:14:47] Begin Program operation.
[16:14:47] INFO: > Executing Operation: Connect
[16:14:49] WARNING: flush succeeded
[16:14:49] INFO: setting break signal
[16:14:49] INFO: — please restart the device —
[16:14:49] INFO: connection succeeded
[16:14:49] INFO: getting storage list
[16:14:49] INFO: > Executing Operation: Init
[16:14:49] INFO: reading version info
[16:14:49] INFO: DEVICE CC3200 ES1.33
[16:14:49] INFO: reading version info
[16:14:50] INFO: reading version info
[16:14:52] INFO: > Executing Operation: Program
[16:14:52] INFO: > File name: /sys/mcuimg.bin, Update: true, Erase: true
[16:14:52] INFO: > Erase File: /sys/mcuimg.bin
[16:14:52] INFO: erasing file “/sys/mcuimg.bin”
[16:14:52] INFO: deleting file “/sys/mcuimg.bin”
[16:14:52] INFO: erase file completed
[16:14:52] INFO: > Size of file = 62804
[16:14:52] INFO: > Update File: /sys/mcuimg.bin
[16:14:52] INFO: Downloading file “/sys/mcuimg.bin” with size 62804
[16:14:55] INFO:

New Token is 0x0
[16:14:55] INFO: Download complete
[16:14:55] INFO: Verifying Data…
[16:14:55] INFO: get file
[16:14:58] INFO: Done. Reading 62804 bytes
[16:14:58] INFO:

Verification OK
[16:14:59] INFO: > Updated Token value: 0x0
[16:14:59] INFO: > File name: /cert/ca.pem, Update: false, Erase: false
[16:14:59] INFO: > File name: /cert/client.pem, Update: false, Erase: false
[16:14:59] INFO: > File name: /cert/private.key, Update: false, Erase: false
[16:14:59] INFO: > File name: /sys/macadd.bin, Update: false, Erase: true
[16:14:59] INFO: > Erase File: /sys/macadd.bin
[16:14:59] INFO: erasing file “/sys/macadd.bin”
[16:14:59] INFO: deleting file “/sys/macadd.bin”
[16:14:59] INFO: erase file completed
[16:14:59] INFO: > File name: /sys/mode.cfg, Update: false, Erase: false
[16:14:59] INFO: > File name: /sys/ipcfg.ini, Update: false, Erase: false
[16:14:59] INFO: > File name: /sys/ap.cfg, Update: false, Erase: false
[16:14:59] INFO: > File name: /sys/devname.cfg, Update: false, Erase: false
[16:14:59] INFO: > File name: /sys/mdns.cfg, Update: false, Erase: false
[16:14:59] INFO: > File name: /sys/dhcpsrv.cfg, Update: false, Erase: false
[16:14:59] INFO: > File name: /sys/httpsrv.cfg, Update: false, Erase: false
[16:14:59] INFO: > File name: /sys/pref.net, Update: false, Erase: false
[16:14:59] INFO: > File name: /sys/smartconfigkeys.cfg, Update: false, Erase: false
[16:14:59] INFO: > File name: /sys/stacfg.ini, Update: false, Erase: false
[16:14:59] INFO: > File name: /sys/p2p.cfg, Update: false, Erase: false
[16:14:59] INFO: > File name: /sys/pmcfg.ini, Update: false, Erase: false
[16:14:59] INFO: > Executing Operation: Disconnect
[16:14:59] Operation Program returned.

Now the wlan_ap.bin is stored on the FLASH memory attached to the CC3200 (on the FLASH FS it’s called mcuimg.bin). Remove SOP2 jumper (for normal operation after reset as in don’t go to flashing mode), start minicom on /dev/ttyUSB1 and press the RESET button for normal operation:
MNCM2
At this point if an SSID is provided, a new wireless network will appear with that name.

Step 8. Flash formatting, service pack update – TI’s Uniflash
In Uniflash, under “CC31XX/CC32XX Flash Setup and Control” click the Format button. A pop-up window will appear where the FLASH size must be selected. The CC3200 Launchpad has 1MB of SPI FLASH.
UNIF8
After clicking OK, Uniflash will format the FLASH. Complete log of the operation should look like this:

[16:28:06] Begin Format operation.
[16:28:06] INFO: > Executing Operation: Connect
[16:28:08] WARNING: flush succeeded
[16:28:08] INFO: setting break signal
[16:28:08] INFO: — please restart the device —
[16:28:08] INFO: connection succeeded
[16:28:08] INFO: getting storage list
[16:28:08] INFO: > Executing Operation: Init
[16:28:08] INFO: reading version info
[16:28:08] INFO: DEVICE CC3200 ES1.33
[16:28:08] INFO: reading version info
[16:28:09] INFO: reading version info
[16:28:11] INFO: > Executing Operation: Format
[16:28:11] INFO: Erase storage SFLASH
[16:28:12] INFO: erase storage succeeded
[16:28:12] INFO: erase storage completed
[16:28:12] INFO: > Executing Operation: Disconnect
[16:28:12] Operation Format returned.

Next step is updating the service pack. Under “CC31XX/CC32XX Flash Setup and Control” click the “Service Pack Programming” button. Now select the service pack .bin file from the CC3200 Service Pack installation directory. In my case the file is called servicepack_1.0.1.6-2.6.0.5.bin and is located in ~/ti3/CC3100_CC3200_ServicePack_1.0.1.6-2.6.0 directory.
UNIF9
Click OK to begin the Service Pack update. The service pack update log should look like this:
[16:31:54] INFO: connection succeeded
[16:31:54] INFO: getting storage list
[16:31:54] INFO: > Executing Operation: ServicePackProgramming
[16:31:54] INFO: Path to the service pack file: /home/simi/ti3/CC3100_CC3200_ServicePack_1.0.1.6-2.6.0/servicepack_1.0.1.6-2.6.0.5.bin
[16:31:54] INFO: reading version info
[16:31:54] INFO: CC3200R Device detected.
[16:31:54] INFO: NWP/MAC/PHY Version from Service Pack:
[16:31:54] INFO: NWP Patch version: 2.6.0.5
[16:31:54] INFO: MAC Patch version: 1.4.0.1
[16:31:54] INFO: PHY Patch version: 1.0.3.34
[16:31:54] INFO: reading version info
[16:31:54] INFO: DEVICE CC3200 ES1.33
[16:31:54] INFO: reading version info
[16:31:56] INFO: reading version info
[16:31:57] INFO: Downloading file “/sys/servicepack.ucf” with size 25820
[16:32:02] INFO:

New Token is 0x3764C432
[16:32:02] INFO: Download complete
[16:32:02] INFO: > Executing Operation: Disconnect
[16:32:02] Operation ServicePackProgramming returned.

Click on “List File System” under “CC31XX/CC32XX Flash Setup and Control” it will list all the files that are stored on the flash memory:
[16:33:52] INFO: N/A 0 5 N/A 5 FATFS
[16:33:52] INFO: 4 5 5 yes 10 /tmp/phy.cal
[16:33:52] INFO: 6 15 33 yes 66 /sys/servicepack.ucf

Now the CC3200 has the latest service pack on its flash memory. Since the flash was formatted earlier, no user code is present (mcuimg.bin). Follow the instructions from step 7 and flash the wlan_ap example (don’t format the flash, just select the bin file and click Program.
After flashing /home/simi/workspace_v6_1_3_ex/wlan_ap/Release/wlan_ap.bin, clicking on the “List File System” button should list the following:

[16:37:25] INFO: N/A 0 5 N/A 5 FATFS
[16:37:25] INFO: 0 81 16 yes 32 /sys/mcuimg.bin
[16:37:25] INFO: 4 5 5 yes 10 /tmp/phy.cal
[16:37:25] INFO: 6 15 33 yes 66 /sys/servicepack.ucf

Great, flash was formatted, service pack is updated, wlan_ap example is flashed (mcuimg.bin).

Step 7a. Flashing – cc3200tool – open alternative to Uniflash

If you intend to use TI’s Uniflash, ignore this part about cc3200tool.

For flashing the SOP2 jumper must be installed on the board. If the MCU is reset whith this jumper present, it will go into bootloader/programming mode.
Note that while debugging on the CC3200 Launchpad with CCS, it doesn’t matter if the SOP2 jumper is present or not.
After flashing, to be able to actually run your application, remove this jumper and reset the MCU.

Flashing uses the same serial port that’s used for seeing the MCU UART output. If you have minicom or another program keeping that /dev/ttyUSB1 device opened, close that program first.
There’s an open alternative to TI’s Uniflash cc3200tool. You can read more about it at https://github.com/ALLTERCO/cc3200tool

Install cc3200tool:

$ git clone http://github.com/ALLTERCO/cc3200tool.git
$ cd cc3200tool
$ sudo python setup.py install
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running install
running build
running build_py
running build_scripts
running install_lib
running install_scripts
changing mode of /usr/local/bin/cc3200tool to 775
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/cc3200tool-0.1.0.egg-info
Writing /usr/local/lib/python2.7/dist-packages/cc3200tool-0.1.0.egg-info

cc3200tool requires pyserial. The one present in Ubuntu 15.10 repos isn’t working, cc3200tool would just fail with:

2016-06-09 21:37:09,170 -- Could not connect to target: 'Serial' object has no attribute 'send_break'

If you have installed pyserial from Ubuntu’s repo, remove it and install a newer one. You can check out commit 5d772fcd6969652fb8f2361f1fd5c1c5884e7a80 , that worked fine for me.

$ git clone https://github.com/pyserial/pyserial.git
Cloning into 'pyserial'...
remote: Counting objects: 4950, done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 4950 (delta 13), reused 0 (delta 0), pack-reused 4908
Receiving objects: 100% (4950/4950), 1.36 MiB | 540.00 KiB/s, done.
Resolving deltas: 100% (3608/3608), done.
Checking connectivity... done.
$ cd pyserial
#optional step:
$ git checkout 5d772fcd6969652fb8f2361f1fd5c1c5884e7a80
sudo python setup.py install

Now we can flash the board with cc3200tool. Ensure that J6 and J8 jumpers are set on FLASH position and SOP2 jumper is set:
20160610_013505

Let’s flash the newly compiled “wlan_ap” example. Press the RESET button when prompted.

$ sudo cc3200tool -p /dev/ttyUSB1  --reset  prompt write_file /home/simi/workspace_v6_1_3_ex/wlan_ap/Release/wlan_ap.bin /sys/mcuimg.bin
2016-06-10 01:38:27,344 -- Connecting to target...
Reset the device with SOP2 asserted and press Enter

2016-06-10 01:38:32,494 -- timed out while waiting for ack
2016-06-10 01:38:34,751 -- timed out while waiting for ack
2016-06-10 01:38:35,005 -- Connected, reading version...
2016-06-10 01:38:35,006 -- connected to target
2016-06-10 01:38:35,007 -- Version: CC3x00VersionInfo((0, 4, 1, 2), (0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0), (16, 0, 0, 0))
2016-06-10 01:38:35,007 -- This is a CC3200 device
2016-06-10 01:38:35,007 -- Switching to NWP bootloader...
2016-06-10 01:38:35,008 -- Switching UART to APPS...
2016-06-10 01:38:35,009 -- Resetting communications ...
2016-06-10 01:38:38,265 -- timed out while waiting for ack
2016-06-10 01:38:38,522 -- Uploading rbtl3100s.dll...
2016-06-10 01:38:38,523 -- Getting storage list...
2016-06-10 01:38:38,523 -- Getting storage info...
2016-06-10 01:38:38,524 -- storage info bytes: 0x10, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0
2016-06-10 01:38:39,196 -- APPS version: CC3x00VersionInfo((0, 4, 0, 2), (0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0), (16, 0, 0, 0))
2016-06-10 01:38:39,198 -- File exists on target, erasing
2016-06-10 01:38:39,200 -- Erasing file /sys/mcuimg.bin...
2016-06-10 01:38:39,348 -- Uploading file /home/simi/workspace_v6_1_3_ex/wlan_ap/Release/wlan_ap.bin -> /sys/mcuimg.bin [62804]...
................
2016-06-10 01:38:41,500 -- All commands done, bye.

Now remove SOP2 jumper (for normal operation after reset as in don’t go to flashing mode), start minicom on /dev/ttyUSB1 and press the RESET button for normal operation:
MNCM2
At this point if an SSID is provided, a new wireless network will appear with that name.

Step 8a. Flash formatting, service pack update – cc3200tool – open alternative to Uniflash

If you intend to use TI’s Uniflash, ignore this part about cc3200tool.

Next step if formatting the flash, copy the service pack files and the wlan_ap example. The flash size on the Launchpad is 1MB. SOP2 jumper must be in place.

sudo cc3200tool -p /dev/ttyUSB1  --reset  prompt format_flash \
--size=1M write_file  --signature \
home/simi/ti3/CC3100_CC3200_ServicePack_1.0.1.6-2.6.0/ota/ota_1.0.1.6-2.6.0.5.ucf.signed.bin \
/home/simi/ti3/CC3100_CC3200_ServicePack_1.0.1.6-2.6.0/ota/ota_1.0.1.6-2.6.0.5.ucf.ucf \
/sys/servicepack.ucf write_file \
/home/simi/workspace_v6_1_3_ex/wlan_ap/Release/wlan_ap.bin \
/sys/mcuimg.bin

2016-06-10 14:40:15,688 -- Connecting to target...
Reset the device with SOP2 asserted and press Enter

2016-06-10 14:40:16,585 -- Connected, reading version...
2016-06-10 14:40:16,587 -- connected to target
2016-06-10 14:40:16,587 -- Version: CC3x00VersionInfo((0, 4, 1, 2), (0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0), (16, 0, 0, 0))
2016-06-10 14:40:16,587 -- This is a CC3200 device
2016-06-10 14:40:16,587 -- Switching to NWP bootloader...
2016-06-10 14:40:16,589 -- Switching UART to APPS...
2016-06-10 14:40:16,590 -- Resetting communications ...
2016-06-10 14:40:17,846 -- Uploading rbtl3100s.dll...
2016-06-10 14:40:17,847 -- Getting storage list...
2016-06-10 14:40:17,847 -- Getting storage info...
2016-06-10 14:40:17,848 -- storage info bytes: 0x10, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0
2016-06-10 14:40:18,520 -- APPS version: CC3x00VersionInfo((0, 4, 0, 2), (0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0), (16, 0, 0, 0))
2016-06-10 14:40:18,520 -- Formatting flash with size=1024
2016-06-10 14:40:19,711 -- Uploading file /home/simi/ti3/CC3100_CC3200_ServicePack_1.0.1.6-2.6.0/ota/ota_1.0.1.6-2.6.0.5.ucf.ucf -> /sys/servicepack.ucf [25820]...
.......
2016-06-10 14:40:20,874 -- Uploading file /home/simi/workspace_v6_1_3_ex/wlan_ap/Release/wlan_ap.bin -> /sys/mcuimg.bin [62804]...
................
2016-06-10 14:40:23,007 -- All commands done, bye.

After removing the SOP2 jumper, starting minicom on ttyUSB1 and resetting the board:
MNCM3

Step 9. CC3200 IC replacement
My Launchapd had an experimental silicon revision of the CC3200, called XCC3200HZ.
20160609_170403
I replaced this with CC3200R1. XCC3200HZ has only 192kB of RAM (with 176kB actually usable for user application) vs 256kB for the CC3200R1.
When debugging the XCC3200HZ, there may be some errors (like Trouble Reading Memory Block at 0x20030008 on Page 0 of Length 0x4: Debug Port error occurred. ) if the cc3200.gel (/ccsv6/ccs_base/emulation/gel/cc3200.gel) and cc3200v1p32.cmd (from project) files are not modified.
Also, the latest CC3200 Service Pack is not compatible with XCC3200HZ.

New IC:
20160609_170534
Removed the old one using a hot air tool:
20160609_171506
Added leaded solder to the pads, wicked it to remove the old+new solder and tinned the pads with leaded solder followed by a clean-up with isopropyl alcohol.
20160609_172448
Added flux, placed the new IC on the pads and soldered it with a hot air tool.
20160609_174028

I hope that this post may be of some help for some other troubled souls out there. If you have any questions, post them in the comments and I’ll do my best to answer them.

One comment on “CC3200 with Code Composer Studio and Uniflash under GNU Linux

  1. Icaro J February 12, 2017 2:00 pm

    Thank you for this man! :)

Leave a Reply to Icaro J Cancel Reply

Your email address will not be published.


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>