Friday, 23 December 2016

Build your own Router with Raspberry Pi 3

Build your own Router with Raspberry Pi 3

This project aims at developing a simple Router device using Raspberry Pi 3. Most of the people don't feel like going out and buying a new router and want something that just fits in your pocket. The process here is actually pretty simple and after installing a few bits of software you'll be ready to go. This setup uses the Raspberry Pi 3. After it's all set up, you can use your Pi as a headless machine so you don't need to deal with a monitor, keyboard and mouse.

How it works

The process is very simple. Raspberry pi 3 is already have Wifi chip on the board so after configuring and installing procedure you just need two things LAN cable and 2-Amps micro Usb power adapter for Raspberry Pi 3.
The Application of Building Raspberry Pi 3 Router include:
  1. Raspberry Pi 3.
  2. SD card with latest Raspbian OS installed.
  3. Power Adapter (5Volts, 2.5 Amps).
  4. Mouse.
  5. Keyboard.
  6. HDMI to VGA adapter.
  7. Standard PC monitor.
Setup:
To setup please follow the steps mentioned bellow:
Prepare the Raspberry Pi-3:
Connect the monitor to Raspberry Pi 3 Via VGA to HDMI converter and also plug in the Usb mouse and keyboard.
Boot up Raspberry Pi 3 you will see Raspberry Pi desktop (assuming you have already installed Raspbian OS) like below fig 1, fig 2, fig 3.

Fig 1:
Fig 2:
​Fig 3:

In order to act Raspberry Pi as Wifi router or access point you need to check weather Raspberry PI is up to date and all the new packages are available for download/installation just open the terminal (fig 4)
and type below commands:
$ sudo apt-get update
$ sudo apt-get upgrade


​Fig 4:

Install and Configure the router softwares:
The first thing you need to do is to configure your wlan0 interface with a static IP.
Note: For this, Raspberry Pi 3 should be connected to Local LAN cable.
In newer Raspian versions, interface configuration is handled by dhcpcd by default. We need to tell to ignore wlan0, as we will configure it with a static IP address. So open the dhcpcd configuration file with
$ sudo nano /etc/dhcpcd.conf
and add the following line to the bottom of the file:
denyinterfaces wlan0

Note:
This must be ABOVE any interface lines you may have added!
allow-hotplug wlan0  
iface wlan0 inet static  
    address 172.24.1.1
    netmask 255.255.255.0
    network 172.24.1.0
    broadcast 172.24.1.255
#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Restart dhcpcd with

$ sudo service dhcpcd restart

and then reload the configuration for wlan0 with 

$ sudo ifdown wlan0; sudo ifup wlan0

ISC-DHCP-SERVER:

isc-dhcp-server is the Internet System Consortium’s implementation of a DHCP server. A DHCP server is responsible for assigning addresses to computers/devices connection to the WiFi access point.
To install the DHCP software run the following command:
$ sudo apt-get install hostapd isc-dhcp-server
Note: Hostapd is explained in next steps.
Next file to edit is /etc/default/isc-dhcp-serveryou can open it in nano using this command:
$ sudo nano /etc/default/isc-dhcp-server
Scroll down to the line saying interfaces and update the line to say:
INTERFACES="wlan0"
This will make the DHCP server hand out network addresses on the wireless interface. Save the file and exit nano.

DHCP server:

Be wise and always make a backup of the default config
$ sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf"

Edit the default config file
$ sudo nano /etc/dhcp/dhcpd.conf

Comment the following lines:
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org
And uncomment below line:

authoritative;
Scroll down to bottom of the file and add below lines:
subnet 172.24.1.0 netmask 255.255.255.0 {
        range 172.24.1.10 172.24.1.50;
        option broadcast-address 172.24.1.255;
        option routers 172.24.1.10;
        default-lease-time 600;
        max-lease-time 7200;
        option domain-name "local";
        option domain-name-servers 8.8.8.8, 8.8.4.4;
}

HOSTAPD:


Hostapd is a user space daemon for access point and authentication servers. That means it can turn your Raspberry Pi into a access point that other computers can connect to. It can also handle security such that you can setup a WiFi password.
Next, we need to configure hostapd. Create a new configuration file using:
$ sudo nano /etc/hostapd/hostapd.conf
with the following contents:
# This is the name of the WiFi interface we configured above
interface=wlan0

# Use the nl80211 driver with the brcmfmac driver
driver=nl80211

# This is the name of the network
ssid=RPI3-AP

# Use the 2.4GHz band
hw_mode=g

# Use channel 6
channel=6

# Enable 802.11n
ieee80211n=1

# Enable WMM
wmm_enabled=1

# Enable 40MHz channels with 20ns guard interval
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]

# Accept all MAC addresses
macaddr_acl=0

# Use WPA authentication
auth_algs=1

# Require clients to know the network name
ignore_broadcast_ssid=0

# Use WPA2
wpa=2

# Use a pre-shared key
wpa_key_mgmt=WPA-PSK

# The network passphrase
wpa_passphrase=raspberry

# Use AES, instead of TKIP
rsn_pairwise=CCMP
We can check whether it's working at this stage by running below command:

$ sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf
If it's all gone well thus far, you should be able to see the network RPI3-AP! If you try to connect it, you will see some output from the Raspberry Pi, but you won't receive any IP address until you set up finish. Use Ctrl+C to stop it.
We aren't quite done yet, because we also need to tell hostapd where to look for the config file when it starts up on boot. Open the default configuration file with:
$ sudo nano /etc/default/hostapd
and find the line

#DAEMON_CONF=""
and replace it with
DAEMON_CONF="/etc/hostapd/hostapd.conf".
Enable the NAT using IPV4 FORWARDING:
One that we need to do before we send traffic anywhere is to enable packet forwarding. To do this, open the sysctl.conf file with:

$ sudo nano /etc/sysctl.conf
and remove the # from the beginning of the line containing "net.ipv4.ip_forward=1" This will enable it on the next reboot. but, as we know everyone is impatient and to activate it immediately with:
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
We also need to share our Raspberry Pi's Internet connection to our devices connected over WiFi by configuring a NAT between our wlan0 interface and our eth0 interface. We can do this using the following commands:
$ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE  
$ sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT  
$ sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT  
However, we need these rules are to be applied every time when we reboot the Raspberry Pi, so run below command to save the rules in a file:
$ sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
Now we need to run this after each reboot, so open the rc.local file with:
$ sudo nano /etc/rc.local
before "exit 0" add the following line:
iptables-restore < /etc/iptables.ipv4.nat  

Test by Starting your wireless router:

Now you are ready to start the DHCP server and the Hostapd access point application.You can do so by running:
$ sudo service isc-dhcp-server start
$ sudo service hostapd start
At this point you should be able to find your wireless network on your laptop/devices by which you can access the Internet!

Final Steps:

While it is pretty cool, you have your Raspberry Pi running as a wireless access point. You have to login every time when it reboots to start the Hostapd and DHCP software.
To avoid this run the bellow commands, then it will reload even if Raspberry Pi reboots:
$ sudo update-rc.d hostapd enable 
$ sudo update-rc.d isc-dhcp-server enable
At this point try to reboot the raspberry pi just to make sure everything works as intended - you can reboot with the command:
$ sudo reboot

Now you can remove all connections Like keyboard, mouse and also VGA to HDMI converter cable between monitor and Raspberry pi and then restart the Raspberry PI 3 device, and enjoy.

Monday, 19 December 2016

How to Compile Linux Kernel from Source to Build Custom Kernel

Linux kernel is the life force of all Linux family of operating systems including Ubuntu, CentOS, and Fedora.

For most part, you don’t need to compile the kernel, as it is installed by default when you install the OS. Also, when there is a critical update done to the kernel, you can use yum, or apt-get to update the kernel on your Linux system.

However you might encounter certain situation, where you may have to compile kernel from source. The following are few situation where you may have to compile Kernel on your Linux system.
  • To enable experimental features that are not part of the default kernel.
  • To enable support for a new hardware that is not currently supported by the default kernel.
  • To debug the kernel
  • Or, just to learn how kernel works, you might want to explore the kernel source code, and compile it on your own.
In this tutorial, we’ll explain how to compile Linux kernel from source.
Also, please note that if you just want to compile a driver, you don’t need to compile the kernel. You need only the linux-headers package of the kernel.

1. Download the Latest Stable Kernel

The first step is to download the latest stable kernel from kernel.org.
# cd /usr/src/

# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.3.tar.xz

2. Untar the Kernel Source

The second step is to untar the kernel source file for compilation.
# tar -xvJf linux-3.9.3.tar.xz

3. Configure the Kernel

The kernel contains nearly 3000 configuration options. To make the kernel used by most people on most hardware, the Linux distro like Ubuntu, Fedora, Debian, RedHat, CentOS, etc, will generally include support for most common hardware. You can take any one of configuration from the distro, and on top of that you can add your own configuration, or you can configure the kernel from scratch, or you can use the default config provided by the kernel.# cd linux-3.9.3
# make menuconfig
The make menuconfig, will launch a text-based user interface with default configuration options as shown in the figure. You should have installed “libncurses and libncurses-devel” packages for this command to work.

We will use the default config provided by the kernel. So select “Save” and save the config in the file name “.config”.
The following is a sample of the “.config” file:
CONFIG_MMU=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_HWEIGHT=y

4. Compile the Linux Kernel

Compile the main kernel:
# make
Compile the kernel modules:
# make modules
Install the kernel modules:
# make modules_install
At this point, you should see a directory named /lib/modules/3.9.3/ in your system.

5. Install the New Kernel

Install the new kernel on the system:
# make install
The make install command will create the following files in the /boot directory.
  • vmlinuz-3.9.3 – The actual kernel
  • System.map-3.9.3 – The symbols exported by the kernel
  • initrd.img-3.9.3 – initrd image is temporary root file system used during boot process
  • config-3.9.3 – The kernel configuration file
The command “make install” will also update the grub.cfg by default. So we don’t need to manually edit the grub.cfg file.

6. Boot Linux to the new Kernel

To use the new kernel that you just compiled, reboot the system.
# reboot
Since, in grub.cfg, the new kernel is added as default boot, the system will boot from the new kernel. Just in case if you have problems with the new kernel, you can select the old kernel from the grub menu during boot and you can use your system as usual.
Once the system is up, use uname command to verify that the new version of Linux kernel is installed.
$ uname -r
3.9.3

ARMKernelCrossCompile

The following instructions show how to properly download, tweak and cross compile an Ubuntu ARM kernel from an x86 Ubuntu host.

Vanilla Ubuntu armhf omap4 kernel compilation

First install the necessary tools for source code management and compilation:
sudo apt-get install fakeroot build-essential kexec-tools kernel-wedge gcc-arm-linux-gnueabihf
sudo apt-get install gcc-arm-linux-gnueabihf libncurses5 libncurses5-dev libelf-dev 
sudo apt-get install asciidoc binutils-dev
sudo apt-get build-dep linux
Then download the code, switch to the omap4 branch and kick a build:
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git

cd ubuntu-precise
git checkout -b ti-omap4 origin/ti-omap4

export $(dpkg-architecture -aarmhf); export CROSS_COMPILE=arm-linux-gnueabihf-
fakeroot debian/rules clean
fakeroot debian/rules binary-omap4
At the end of the process you will have an header and an image .deb in the upper level directory:
ls ../*.deb
linux-headers-3.2.0-1410-omap4_3.2.0-1410.13_armhf.deb  linux-image-3.2.0-1410-omap4_3.2.0-1410.13_armhf.deb

Config modify an Ubuntu omap4 kernel

Pretty much as above, but between the 'fdr clean' and 'fdr binary-omap4' you issue:
fakeroot debian/rules editconfigs
where 'fdr' stands for 'fakeroot debian/rules'.
Choose the architecture you want to do modifications (armhf in our case):
dh_testdir;
/bin/bash -e debian/scripts/misc/kernelconfig editconfigs
Do you want to edit config: armel/config.flavour.omap4? [Y/n]n
Running splitconfig.pl for armel

Reading config's ...
  processing config.common.armel ... done.
  processing config.flavour.omap4 ... done.

Merging lists ... 
   processing config.common.armel ... done.
   processing config.flavour.omap4 ... done.

Creating common config ... done.

Creating stub configs ...
  processing config.common.armel ... done.
  processing config.flavour.omap4 ... done.
Do you want to edit config: armhf/config.flavour.omap4? [Y/n] Y
do the config changes, save and 'fdr binary-omap4' to start a compilation of the new kernel.

FAQ

1) What's the difference between armel and armhf? And which should i pick?
Armhf requires a cpu with an FPU unit, while armel doesn't strictly enforce it. As a rule of thumb, remember that from Precise onward Ubuntu uses armhf, while Oneiric and previous were armel based.
To create a package for armel, you need the armel toolchain (gcc-arm-linux-gnueabi) and an armel environment:
sudo apt-get install gcc-arm-linux-gnueabi

export $(dpkg-architecture -aarmel); export CROSS_COMPILE=arm-linux-gnueabi-
the rest is identical to the armhf case.
2) How do i mark my custom kernel to distinguish it form the stock one?
It's possible to a add a suffix to kernel name modifying the changelog file. So, in our example, _before_ the 'fdr clean', open debian.ti-omap4/changelog, look for the first line and change it from:
linux-ti-omap4 (3.2.0-1410.13) precise; urgency=low
to
linux-ti-omap4 (3.2.0-1410.13~mycustomkernel) precise; urgency=low
This way the resulting .deb packages will have the custom "~mycustomkernel" suffix in their names. Remember, only letters and numbers are allowed.
3) Ok, but what about my Beagle/XM? How do i compile a kernel for an omap3 board?
Omap3 support is fully present in mainline, so stay in the master branch (do not switch to ti-omap4) and:
fakeroot debian/rules binary-omap
4) So far all the examples were Precise based, what about the other releases?
Feel free to pick the release you prefer from http://kernel.ubuntu.com/git (see http://wiki.ubuntu.com/Kernel/Dev/KernelGitGuide for more info).
5) After export $(dpkg-architecture -aarmhf) i get a warning, what's that?
Yes, it's something like dpkg-architecture: warning: Specified GNU system type arm-linux-gnueabi does not match gcc system type i686-linux-gnu and it's harmless. Forget about it.
6) How do i compile a vanilla/upstream arm kernel that works with an Ubuntu userspace?
i assume your cwd is a checkout of Linus git tree and we are compiling an armhf kernel for an omap3 board.
a) make ARCH=arm omap2plus_defconfig
b) edit .config and modify the following options:
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_XATTR=y
Since 3.5 EHCI is broken for omap3 and was disabled upstream, to enable it again:
CONFIG_USB_EHCI_HCD=y
CONFIG_MFD_OMAP_USB_HOST=y
CONFIG_USB_EHCI_TT_NEWSCHED=y
CONFIG_USB_EHCI_HCD_OMAP=y
CONFIG_TWL4030_USB=y
c) make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- uImage
d) copy arch/arm/boot/uImage to the sd card first partition overwriting ubuntu stock uImage
e) insert the sd card, and reboot

Saturday, 17 December 2016

How to Install and Configure IPFire Firewall

IP Fire is an open source firewall distribution. It can be used as a firewall, a proxy server or a VPN gateway.It has following features.

  • Easily configurable
  • Support true random generator
  • High availability
  • Hardware accelerator for cryptography algorithm (AES-NI)
IPFire is forked from IPCop and Endian firewall distro's. Installation and basic configuration of firewall is given in following section.

Installation

In this tutorial, IPfire firewall will be installed on the VM, created on the Virtual Box software. The detail of our VM is given below.
VM details
After clicking on start button, following window appears for IPfire installation.
installation using iso
Press "Enter" button to start installation procedure.  Select the desired language from the given list.
language selection
Press "Enter" button to start installation and accept GPL license.
start installation
GPL license acceptance is shown following.
accept gpl lincese
After GPL license acceptance, windows appear for the partition of  hard disk and filesystem. Ext4 file system is selected in this installation of IPfire.
disk setup
File system selection is shown below.
file system selection
IPfire installation progress is shown in the below figure.
installation of the system
IPfire firewall successfully  installed on the VM.
successfully installed

Configuration

After reboot, basic configuration of IPfire firewall will be done. First of all, keyboard layout and time zone  are selected.
keyboard selection
time zone
Host name and local domain setting for IPfire firewall.
setting hostname
setting local domainPassword setting for root user which is used for CLI access of IPfire.
setting root user password
Password setting for admin user which is used for web access of IPfire.
admin user setting
Network configuration of IPfire is shown below. As shown in the figure that the default network configuration isGREEN RED zones . However, it supports BLUE and ORANGE zones as well
networking creation greenandred
IPfire supported zones are shown in the following figure.
networking configuration types
In a standard IPfire  firewall installation, Green Red means 2 Networks. Green network for home or LAN side and  Red network for  internet/external connection.
Usage of each zone is given in the following table.
zone
Assignment of available NICs to GREEN and RED zone is shown in the following snapshots.
GREEN zone
assinging cards
RED zone
red selection
Interfaces assigned to both GREEN and RED zones are shown in the below figure.
card selected
IP address setting for GREEN zone is shown below.
address selection on green
Assigned IP address and net mask is following IP = 192.168.1.115 , Net mask = 255.255.255.0
 ip address on green
IP address setting for RED zone is shown below.
red ip address setting
Assigned Static IP address and net mask are  following.  However, DHCP and PPP DIALUP (PPPoE) modes are also supported on RED interface for IP assignment.
IP = 192.168.100.1 , Net mask = 255.255.255.0
red ip address
DNS and Gateway setting for  RED interface are shown in the following snapshot.
dns and gateway setting
DHCP configuration on the GREEN interface for automatic IP assignment is given below.
dhcp server on green side configuraiton
After DHCP configuration, basic setting of IPfire are complete.
coplete setup
IPfire will reboot to apply changes and gives CLI access to user "root".
setup complete and restarting
To access CLI , enter password for user "root".
cli login
root login
Web Access of IPfire is required for further configuration. It is also used to configure firewall rules, snort configuration and VPN setting etc.
Enter IP address of GREEN interface along port 444 for web interface access. All web browsers gives exception due to untrusted certificates. Therefore accept the exception  to view the web pages.
web interface access
accept exception
Enter password for "admin" user to access the pages.
web access cred
After correct username and password, following main dashboard appears, which shows the network configuration (IP addresses on RED and GREEN zones).
main dashboard

IPFire Menu

System

This menu is used for basic setting of the  IPFire machine such as enabling ssh access, backup and setting web access password etc. System sub menu is shown in the following figure.
system menu

Status

In this menu, firewall administrator view the status of system resources such as RAM & CPU, internal and external network, entropy for TRNG and statistics for VPN's.
status

Network

As shown in the following figure that network settings such as static routing, webproxy, url filtering and wake on Lan etc is available under this menu
network menu

Services

Services such as VPN which include IPsec & OpenVPN , intrusion detection, QoS , time server etc  are listed under this menu.
services

Firewall

Main feature of IPFire distribution is providing firewall feature. Administrator or user  uses this menu to push  iptables rules on back end.
firewall

IPFire

Pakfire is used to install Addons/packages on the IPFire machine for more feature.
ipfire

Logs

As shown in the following figure that, logs of services such has IDS, firewall, proxy  and system can be view from Logs menu.
logs

Conclusion

In this article, our focus was installation and configuration of another open source firewall, IPFire. It is forked from well-known open source firewalls IPCop and Endian. It provides high availability, usage of TRNG and AES-NI features.

Wednesday, 7 December 2016

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.
1
2
3
$ 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
1
2
3
4
$ 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
1
$ ./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.
1
$ 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.
1
$ 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:
1
2
3
4
5
6
7
$ 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:
1
2
3
$ 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.
1
2
3
# 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:
1
2
3
4
5
6
7
8
9
[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)
1
$ 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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ 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.
1
$ 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:
1
$ 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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ 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.
1
2
$ 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.
1
./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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ 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:
1
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.
1
2
3
4
5
6
7
8
9
10
11
12
$ 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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ 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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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.