Ticker

6/recent/ticker-posts

TI CC3100: programming serial FLASH with a simple FTDI adapter

I’ve spent the last few days learning how to use the CC3100 click from MikroElektronika, which I plan to include in some of my future projects.

You might ask yourself why this hassle? The CC3100 is quite complicated, it requires its own drivers, and the SDK offers only examples for some architectures. Why not ESP8266, as many makers do?

Well, there’s a good reason for adopting the CC3100: it’s one of the very few WiFi chips that are able to work with SSL content. Of course, this complicates things a lot, as we have to deal with SSL certificates, to keep the current time updates and so on, but the perspective on connecting to API’s that use SSL is quite rewarding. Just imagine, being able to pull Twitter feeds, or get the number of your Facebook fans using the Graph API. Or secure your beloved IoT project – a major concern, as IoT is plagued by a plethora of security issues.

Anyway, as I’m starting to learn how to use the CC3100 I’ve come to the first issues: the need to upload security certificates to the serial FLASH. And this is what I will show you today: how to program the CC3100 using just an ordinary FTDI chip, like those used to program Arduino boards. I used the USB UART click, also from MikroElektronika, configured for 3.3V operation. But rest assured, any 3.3V FTDI board will work just fine.

The programming rig looks like this:

Simple FTDI programming of the CC3100 WiFi adapter
 

The power is supplied via the USB connector. The RX pin of the USB-UART connects to the TX pin of the CC3100 click. TX pin of the USB-UART is connected to the RX pin of the CC3100 click. There is no need to change the position of jumpers J1A and J2A on the CC3100 click board, as CCS UniFlash doesn’t use any kind of flow control.

The nHIB pin of the CC3100 click has a 10k pull-up resistor, and a push-button connected to the ground. This will be used to enter bootloader mode when working with CCS UniFlash.

This tutorial uses UNIFLASH_PREVIOUS version v3.4.1 – that is “Previous versions of UniFlash with support for CC3200/CC3100” as TI website states. So, before going any further, please download and install CCS UniFlash – mind the software export restrictions. This software might not be available to anyone.

Before using the CCS UniFlash a small change in the configuration of the serial port must be done, as the CC3100 requires a baud rate of 921600. I will explain how to do this in Win10: first, open the device manager, and the identify the COM port corresponding to the USB-UART click. Right-click on the COM port and select “Properties”. In the properties window, change the baud rate to 921600. You have to do this only once.

Win10: Device manager

 
Win10: COM port properties

 WIN10: Changing the Baud rate

Now we are ready to start CCS Uniflash.

CC3100 WiFi adapter: testing the communication

After starting the CCS Uniflash, we go to File -> New configuration and we choose “CC3x Serial (UART Interface)”. Then we select the COM port corresponding to our USB-UART click.

CCS UniFlash: Selecting CC3100 chip

At this point, we can test the communication, by clicking on the “Get Version” button. If everything is OK, in the console area we should see:

[10:47:51] Begin GetVersion operation.
[10:47:51] INFO: > Executing Operation: Connect
[10:47:53] INFO: setting break signal
[10:47:54] INFO: detecting FTDI for device reset
[10:47:54] ERROR: No device USB ports were found
[10:47:54] INFO: --- please restart the device ---

When the red error line appears, briefly press the push button.

CC3100 – push the button when the red error line appears in the console

In the console you should see something like this:

[10:47:56] INFO: connection succeeded
[10:47:56] INFO: getting storage list
[10:47:56] INFO: > Executing Operation: GetVersion
[10:47:56] INFO: reading version info
[10:47:56] INFO: > Bootloader version: 2.0.4.0
[10:47:56] INFO: > Executing Operation: Disconnect
[10:47:56] Operation GetVersion returned.

If you got this, then the communication is OK. It also pays off to display the file content of the CC3100, by clicking on the “List File System” button. Once again, briefly press the push-button when the red error line appears.

[10:49:55] Begin ListFileSystem operation.
[10:49:56] INFO: > Executing Operation: Connect
[10:49:58] INFO: setting break signal
[10:49:59] INFO: detecting FTDI for device reset
[10:49:59] ERROR: No device USB ports were found
[10:49:59] INFO: --- please restart the device ---
[10:50:00] INFO: connection succeeded
[10:50:00] INFO: getting storage list
[10:50:00] INFO: > Executing Operation: Init
[10:50:00] INFO: reading version info
[10:50:00] INFO: DEVICE CC3100 ES1.33
[10:50:00] INFO: reading version info
[10:50:02] INFO: > Executing Operation: ListFileSystem
[10:50:02] INFO: extracting file system information...
[10:50:02] INFO: Serial Flash block size:	4096 bytes
[10:50:02] INFO: Serial Flash capacity:		256 blocks

[10:50:02] INFO: 	file	start	size	fail	total size	filename
[10:50:02] INFO: 	index	block	[BLKs]	safe	[BLKs]
[10:50:02] INFO: ----------------------------------------------------------------------------
[10:50:02] INFO: 	N/A	0	5	N/A	5		FATFS
[10:50:02] INFO: 	4	5	33	yes	66		/sys/servicepack.ucf
[10:50:02] INFO: 	6	71	5	yes	10		/tmp/phy.cal
[10:50:02] INFO: 	7	81	1	yes	2		/sys/stacfg.ini
[10:50:02] INFO: 	8	83	2	yes	4		/sys/pref.net
[10:50:02] INFO: 	9	87	1	yes	2		/sys/ipcfg.ini
[10:50:02] INFO: 	10	89	1	yes	2		/sys/mode.cfg
[10:50:02] INFO: 	11	91	1	yes	2		/sys/pmcfg.ini
[10:50:02] INFO: 	12	93	1	yes	2		/sys/mdns.cfg
[10:50:02] INFO: 	13	95	1	yes	2		/sys/ap.cfg
[10:50:02] INFO: 	14	97	1	yes	2		/sys/devname.cfg
[10:50:02] INFO:


[10:50:02] INFO: 	Flash usage
[10:50:02] INFO: -------------------------
[10:50:02] INFO: used space:	99 blocks
[10:50:02] INFO: free space:	157 blocks
[10:50:02] INFO: memory hole:	[99-255]
[10:50:02] INFO: > Executing Operation: Disconnect
[10:50:02] Operation ListFileSystem returned.

CC3100 – firmware upgrade

Now, let’s go to the interesting part: updating to the latest service pack, which you can get from http://www.ti.com/tool/cc3100SDK. The service pack files swill be in C:\ti\CC3100_CC3200_ServicePack_1.0.1.6-2.7.0.0 for the current service pack version.

Next, using UniFlash for the CC31xx/CC3200 format the Serial Flash, select 1MB.

CC3100: Flash format settings

As always in this tutorial, press the push button when the red error line appears. The console output will be:

[10:53:10] Begin Format operation.
[10:53:11] INFO: > Executing Operation: Connect
[10:53:13] INFO: setting break signal
[10:53:14] INFO: detecting FTDI for device reset
[10:53:14] ERROR: No device USB ports were found
[10:53:14] INFO: --- please restart the device ---
[10:53:27] ERROR: ---reading ACK signal failed---
[10:53:27] WARNING: ---seting break signal to false failed---
[10:53:29] INFO: setting break signal
[10:53:30] INFO: detecting FTDI for device reset
[10:53:30] ERROR: No device USB ports were found
[10:53:30] INFO: --- please restart the device ---
[10:53:31] INFO: connection succeeded
[10:53:31] INFO: getting storage list
[10:53:31] INFO: > Executing Operation: Init
[10:53:31] INFO: reading version info
[10:53:31] INFO: DEVICE CC3100 ES1.33
[10:53:31] INFO: reading version info
[10:53:33] INFO: > Executing Operation: Format
[10:53:33] INFO: Erase storage SFLASH
[10:53:34] INFO: erase storage succeeded
[10:53:34] INFO: erase storage completed
[10:53:34] INFO: > Executing Operation: Disconnect
[10:53:34] Operation Format returned.

 

Then, click on “Service pack programming” button and select the service pack file. The console output should be:

[10:54:42] Begin ServicePackProgramming operation.
[10:54:42] INFO: > Executing Operation: Connect
[10:54:44] INFO: setting break signal
[10:54:45] INFO: detecting FTDI for device reset
[10:54:45] ERROR: No device USB ports were found
[10:54:45] INFO: --- please restart the device ---
[10:54:49] INFO: connection succeeded
[10:54:49] INFO: getting storage list
[10:54:49] INFO: > Executing Operation: ServicePackProgramming
[10:54:49] INFO: Path to the service pack file: C:/ti/CC3100_CC3200_ServicePack_1.0.1.6-2.7.0.0/servicepack_1.0.1.6-2.7.0.0.bin
[10:54:49] INFO: reading version info
[10:54:49] INFO: CC3100R Device detected.
[10:54:49] INFO: NWP/MAC/PHY Version from Service Pack:
[10:54:49] INFO:  NWP Patch version: 2.5.99.8
[10:54:49] INFO:  MAC Patch version: 1.4.0.1
[10:54:49] INFO:  PHY Patch version: 1.0.3.34
[10:54:49] INFO: reading version info
[10:54:49] INFO: DEVICE CC3100 ES1.33
[10:54:49] INFO: reading version info
[10:54:51] INFO: Downloading file "/sys/servicepack.ucf" with size 28236
[10:54:54] INFO:

New Token is 0x6B1B696F
[10:54:54] INFO: Download complete
[10:54:54] INFO: > Executing Operation: Disconnect
[10:54:54] Operation ServicePackProgramming returned.

Now, if we list the files on the CC3100 we will have:

[10:57:48] Begin ListFileSystem operation.
[10:57:48] INFO: > Executing Operation: Connect
[10:57:50] INFO: setting break signal
[10:57:51] INFO: detecting FTDI for device reset
[10:57:51] ERROR: No device USB ports were found
[10:57:51] INFO: --- please restart the device ---
[10:57:53] INFO: connection succeeded
[10:57:53] INFO: getting storage list
[10:57:53] INFO: > Executing Operation: Init
[10:57:53] INFO: reading version info
[10:57:53] INFO: DEVICE CC3100 ES1.33
[10:57:53] INFO: reading version info
[10:57:55] INFO: > Executing Operation: ListFileSystem
[10:57:55] INFO: extracting file system information...
[10:57:55] INFO: Serial Flash block size:	4096 bytes
[10:57:55] INFO: Serial Flash capacity:		256 blocks

[10:57:55] INFO: 	file	start	size	fail	total size	filename
[10:57:55] INFO: 	index	block	[BLKs]	safe	[BLKs]
[10:57:55] INFO: ----------------------------------------------------------------------------
[10:57:55] INFO: 	N/A	0	5	N/A	5		FATFS
[10:57:55] INFO: 	4	5	5	yes	10		/tmp/phy.cal
[10:57:55] INFO: 	6	15	33	yes	66		/sys/servicepack.ucf
[10:57:55] INFO:


[10:57:55] INFO: 	Flash usage
[10:57:55] INFO: -------------------------
[10:57:55] INFO: used space:	81 blocks
[10:57:55] INFO: free space:	175 blocks
[10:57:55] INFO: memory hole:	[81-255]
[10:57:55] INFO: > Executing Operation: Disconnect
[10:57:55] Operation ListFileSystem returned.

Oh, no! We have lost the configuration files!

Reconfiguring the CC3100 click

We lost the configuration files. No problem, we will have to rebuild them. To do this, first we go to “CC31XX/CC32XX Config groups”, make all the desired changes and we will have to check all the “Update” boxes.

CC3100 changing configurations

Then, we go to the main screen and we hit the “Program button”.

[11:02:26] Begin Program operation.
[11:02:27] INFO: > Executing Operation: Connect
[11:02:29] INFO: setting break signal
[11:02:30] INFO: detecting FTDI for device reset
[11:02:30] ERROR: No device USB ports were found
[11:02:30] INFO: --- please restart the device ---
[11:02:32] INFO: connection succeeded
[11:02:32] INFO: getting storage list
[11:02:32] INFO: > Executing Operation: Init
[11:02:32] INFO: reading version info
[11:02:32] INFO: DEVICE CC3100 ES1.33
[11:02:32] INFO: reading version info
[11:02:34] INFO: > Executing Operation: Program
[11:02:34] INFO: > File name: /sys/mcuimg.bin, Update: false, Erase: false
[11:02:34] INFO: > File name: /cert/ca.pem, Update: false, Erase: false
[11:02:34] INFO: > File name: /cert/client.pem, Update: false, Erase: false
[11:02:34] INFO: > File name: /cert/private.key, Update: false, Erase: false
[11:02:34] INFO: > File name: /sys/macadd.bin, Update: false, Erase: true
[11:02:34] INFO: > Erase File: /sys/macadd.bin
[11:02:34] INFO: erasing file "/sys/macadd.bin"
[11:02:34] INFO: deleting file "/sys/macadd.bin"
[11:02:34] INFO: erase file completed
[11:02:34] INFO: > File name: /sys/mode.cfg, Update: true, Erase: false
[11:02:34] INFO: > Size of file = 80
[11:02:34] INFO: > Update File: /sys/mode.cfg
[11:02:34] INFO: Downloading file "/sys/mode.cfg" with size 80
[11:02:35] INFO:

New Token is 0x0
[11:02:35] INFO: Download complete
[11:02:35] INFO: Verifying Data...
[11:02:35] INFO: get file
[11:02:35] INFO: Done. Reading 80  bytes
[11:02:35] INFO:

Verification OK
[11:02:36] INFO: > Updated Token value: 0x0
[11:02:36] INFO: > File name: /sys/ipcfg.ini, Update: true, Erase: false
[11:02:36] INFO: > Size of file = 200
[11:02:36] INFO: > Update File: /sys/ipcfg.ini
[11:02:36] INFO: Downloading file "/sys/ipcfg.ini" with size 200
[11:02:36] INFO:

New Token is 0x0
[11:02:36] INFO: Download complete
[11:02:36] INFO: Verifying Data...
[11:02:36] INFO: get file
[11:02:36] INFO: Done. Reading 200  bytes
[11:02:36] INFO:

Verification OK
[11:02:37] INFO: > Updated Token value: 0x0
[11:02:37] INFO: > File name: /sys/ap.cfg, Update: true, Erase: false
[11:02:37] INFO: > Size of file = 126
[11:02:37] INFO: > Update File: /sys/ap.cfg
[11:02:37] INFO: Downloading file "/sys/ap.cfg" with size 126
[11:02:37] INFO:

New Token is 0x0
[11:02:37] INFO: Download complete
[11:02:37] INFO: Verifying Data...
[11:02:37] INFO: get file
[11:02:37] INFO: Done. Reading 126  bytes
[11:02:37] INFO:

Verification OK
[11:02:38] INFO: > Updated Token value: 0x0
[11:02:38] INFO: > File name: /sys/devname.cfg, Update: true, Erase: false
[11:02:38] INFO: > Size of file = 79
[11:02:38] INFO: > Update File: /sys/devname.cfg
[11:02:38] INFO: Downloading file "/sys/devname.cfg" with size 79
[11:02:38] INFO:

New Token is 0x0
[11:02:38] INFO: Download complete
[11:02:38] INFO: Verifying Data...
[11:02:38] INFO: get file
[11:02:39] INFO: Done. Reading 79  bytes
[11:02:39] INFO:

Verification OK
[11:02:40] INFO: > Updated Token value: 0x0
[11:02:40] INFO: > File name: /sys/mdns.cfg, Update: true, Erase: false
[11:02:40] INFO: > Size of file = 2016
[11:02:40] INFO: > Update File: /sys/mdns.cfg
[11:02:40] INFO: Downloading file "/sys/mdns.cfg" with size 2016
[11:02:40] INFO:

New Token is 0x0
[11:02:40] INFO: Download complete
[11:02:40] INFO: Verifying Data...
[11:02:40] INFO: get file
[11:02:40] INFO: Done. Reading 2016  bytes
[11:02:40] INFO:

Verification OK
[11:02:41] INFO: > Updated Token value: 0x0
[11:02:41] INFO: > File name: /sys/dhcpsrv.cfg, Update: true, Erase: false
[11:02:41] INFO: > Size of file = 32
[11:02:41] INFO: > Update File: /sys/dhcpsrv.cfg
[11:02:41] INFO: Downloading file "/sys/dhcpsrv.cfg" with size 32
[11:02:41] INFO:

New Token is 0x0
[11:02:41] INFO: Download complete
[11:02:41] INFO: Verifying Data...
[11:02:41] INFO: get file
[11:02:41] INFO: Done. Reading 32  bytes
[11:02:41] INFO:

Verification OK
[11:02:42] INFO: > Updated Token value: 0x0
[11:02:42] INFO: > File name: /sys/httpsrv.cfg, Update: true, Erase: false
[11:02:42] INFO: > Size of file = 88
[11:02:42] INFO: > Update File: /sys/httpsrv.cfg
[11:02:42] INFO: Downloading file "/sys/httpsrv.cfg" with size 88
[11:02:42] INFO:

New Token is 0x0
[11:02:42] INFO: Download complete
[11:02:42] INFO: Verifying Data...
[11:02:42] INFO: get file
[11:02:42] INFO: Done. Reading 88  bytes
[11:02:42] INFO:

Verification OK
[11:02:43] INFO: > Updated Token value: 0x0
[11:02:43] INFO: > File name: /sys/pref.net, Update: true, Erase: false
[11:02:43] INFO: > Size of file = 3696
[11:02:43] INFO: > Update File: /sys/pref.net
[11:02:43] INFO: Downloading file "/sys/pref.net" with size 3696
[11:02:44] INFO:

New Token is 0xB6C289A0
[11:02:44] INFO: Download complete
[11:02:44] INFO: > Updated Token value: 0xb6c289a0
[11:02:44] INFO: > File name: /sys/smartconfigkeys.cfg, Update: true, Erase: false
[11:02:44] INFO: > Size of file = 80
[11:02:44] INFO: > Update File: /sys/smartconfigkeys.cfg
[11:02:44] INFO: Downloading file "/sys/smartconfigkeys.cfg" with size 80
[11:02:44] INFO:

New Token is 0xB7B446C4
[11:02:44] INFO: Download complete
[11:02:44] INFO: > Updated Token value: 0xb7b446c4
[11:02:44] INFO: > File name: /sys/stacfg.ini, Update: true, Erase: false
[11:02:44] INFO: > Size of file = 104
[11:02:44] INFO: > Update File: /sys/stacfg.ini
[11:02:44] INFO: Downloading file "/sys/stacfg.ini" with size 104
[11:02:44] INFO:

New Token is 0x0
[11:02:44] INFO: Download complete
[11:02:44] INFO: Verifying Data...
[11:02:44] INFO: get file
[11:02:44] INFO: Done. Reading 104  bytes
[11:02:44] INFO:

Verification OK
[11:02:45] INFO: > Updated Token value: 0x0
[11:02:45] INFO: > File name: /sys/p2p.cfg, Update: true, Erase: false
[11:02:45] INFO: > Size of file = 21
[11:02:45] INFO: > Update File: /sys/p2p.cfg
[11:02:45] INFO: Downloading file "/sys/p2p.cfg" with size 21
[11:02:46] INFO:

New Token is 0x0
[11:02:46] INFO: Download complete
[11:02:46] INFO: Verifying Data...
[11:02:46] INFO: get file
[11:02:46] INFO: Done. Reading 21  bytes
[11:02:46] INFO:

Verification OK
[11:02:47] INFO: > Updated Token value: 0x0
[11:02:47] INFO: > File name: /sys/pmcfg.ini, Update: true, Erase: false
[11:02:47] INFO: > Size of file = 10
[11:02:47] INFO: > Update File: /sys/pmcfg.ini
[11:02:47] INFO: Downloading file "/sys/pmcfg.ini" with size 10
[11:02:47] INFO:

New Token is 0x0
[11:02:47] INFO: Download complete
[11:02:47] INFO: Verifying Data...
[11:02:47] INFO: get file
[11:02:47] INFO: Done. Reading 10  bytes
[11:02:47] INFO:

Verification OK
[11:02:48] INFO: > Updated Token value: 0x0
[11:02:48] INFO: > Executing Operation: Disconnect
[11:02:48] Operation Program returned.

A new listing of the file system:

[11:04:57] Begin ListFileSystem operation.
[11:04:57] INFO: > Executing Operation: Connect
[11:04:59] INFO: setting break signal
[11:05:00] INFO: detecting FTDI for device reset
[11:05:00] ERROR: No device USB ports were found
[11:05:00] INFO: --- please restart the device ---
[11:05:03] INFO: connection succeeded
[11:05:03] INFO: getting storage list
[11:05:03] INFO: > Executing Operation: Init
[11:05:03] INFO: reading version info
[11:05:03] INFO: DEVICE CC3100 ES1.33
[11:05:03] INFO: reading version info
[11:05:05] INFO: > Executing Operation: ListFileSystem
[11:05:05] INFO: extracting file system information...
[11:05:05] INFO: Serial Flash block size:	4096 bytes
[11:05:05] INFO: Serial Flash capacity:		256 blocks

[11:05:05] INFO: 	file	start	size	fail	total size	filename
[11:05:05] INFO: 	index	block	[BLKs]	safe	[BLKs]
[11:05:05] INFO: ----------------------------------------------------------------------------
[11:05:05] INFO: 	N/A	0	5	N/A	5		FATFS
[11:05:05] INFO: 	4	5	5	yes	10		/tmp/phy.cal
[11:05:05] INFO: 	6	15	33	yes	66		/sys/servicepack.ucf
[11:05:05] INFO: 	7	81	1	yes	2		/sys/mode.cfg
[11:05:05] INFO: 	8	83	1	yes	2		/sys/ipcfg.ini
[11:05:05] INFO: 	9	85	1	yes	2		/sys/ap.cfg
[11:05:05] INFO: 	10	87	1	yes	2		/sys/devname.cfg
[11:05:05] INFO: 	11	89	1	yes	2		/sys/mdns.cfg
[11:05:05] INFO: 	12	91	1	yes	2		/sys/dhcpsrv.cfg
[11:05:05] INFO: 	13	93	1	yes	2		/sys/httpsrv.cfg
[11:05:05] INFO: 	14	95	2	yes	4		/sys/pref.net
[11:05:05] INFO: 	15	99	1	yes	2		/sys/smartconfigkeys.cfg
[11:05:05] INFO: 	16	101	1	yes	2		/sys/stacfg.ini
[11:05:05] INFO: 	17	103	1	yes	2		/sys/p2p.cfg
[11:05:05] INFO: 	18	105	1	yes	2		/sys/pmcfg.ini
[11:05:05] INFO:


[11:05:05] INFO: 	Flash usage
[11:05:05] INFO: -------------------------
[11:05:05] INFO: used space:	107 blocks
[11:05:05] INFO: free space:	149 blocks
[11:05:05] INFO: memory hole:	[107-255]
[11:05:05] INFO: > Executing Operation: Disconnect
[11:05:05] Operation ListFileSystem returned.

Operation completed. We have now an updated CC3100 module, with all config files ready.

As one can see, the CC3100 can be uploaded without the CC31XXEMUBOOST. However, other functions performed by the EMUBOOST board won’t be available. No debugging, for example.

What’s next? Uploading of the certificates, setting the time, and establishing a connection to SSL sites…

Post a Comment

0 Comments