第一个CC3200WIFI网络通信程序

准备工具:

硬件:

电脑

MICRO USB数据线

CC3200-LAUNCHXL开发板

软件:

IAR/CCS IDE工具

Uniflash3.4  FLASH编程工具 不能使用4.X或更高版本

http://processors.wiki.ti.com/index.php/Category:CCS_UniFlash

CC3200SDK-1.2.0-windows-installer CC3200软件库

http://www.ti.com.cn/tool/cn/cc3200sdk

调试过程:

安装好所需软件

打开c: ti\CC3200SDK_1.2.0\cc3200-sdk\docs文件夹会看到很多文档

CC3200-Getting_Started_Guide.pdf介绍了如何使用不同IDE调试CC3200程序

CC3200-Programmers_Guide.pdf详细介绍了CC3200的开发和怎样使用Uniflash下载程序

Example文件夹是SDK自带例程的说明文档

Hardware是CC3200 LaunchPad的硬件资料

需要重点看一下CC3200-LaunchPad_Hardware_User_Guide.pdf

和CC3200-LAUNCHXL_SCH_Rev4p1-a.pdf

包含跳线的说明和CC3200 LaunchPad电路图

使用IAR打开SDK中的例程C:\ti\CC3200SDK_1.2.0\cc3200-sdk\example\get_time\ewarm

这是一个通过对时服务器获取时间的程序

修改common.h中的SSID、密码和加密方式

修改main.c中的g_acSNTPserver对时服务器地址,因为默认的总是连接不上

打开http://tf.nist.gov/tf-cgi/servers.cgi网址可以看到很多服务器

自己ping一下看哪个速度快选哪个就可以

我选了nist-time-server.eoni.com

编译工程

连接开发板

短接SOP跳线中的J15(100 FLASH)

关于SOP跳线介绍在CC3200-LaunchPad_Hardware_User_Guide.pdf

和CC3200-Programmers_Guide.pdf中有介绍

在实际使用中我理解为插上J15从RAM引导并调试,断开J15从FLASH引导

打开串手助手,按照设备管理器中的串口号连接,速率为115200

使用IAR下载程序运行调试

看到串口数据

因为网络通信问题有时会有连接服务器失败的情况,蓝色为对时成功,红色为对时失败

 

 

 

 

          *************************************************

 

               CC3200 Get Time Application      

 

          *************************************************

 

 

 

 

GET_TIME: Test Begin

 

Host Driver Version: 1.0.1.6

 

Build Version 2.7.0.0.31.1.4.0.1.1.0.3.34

 

Device is configured in default state

 

Started SimpleLink Device: STA Mode

 

 

[WLAN EVENT] STA Connected to the AP: www.int8.cn , BSSID: 8c:a6:df:27:b2:fa

 

[NETAPP EVENT] IP acquired by the device

 

Device has connected to www.int8.cn

 

Device IP Address is 192.168.0.103

 

 

Socket created

 

 

Get Host IP succeeded.

 

Host: nist-time-server.eoni.com IP: 216.228.192.69

 

 

 

response from server: nist-time-server.eoni.com

 

Tue Sep 28 19:51:52 2016

 

 

 

response from server: nist-time-server.e

oni.com

 

Tue Sep 28 19:51:59 2016

 

 

 

Error [-11] at line [307] in function [GetSNTPTime] 

 

Server Get Time failed

 

Socket closed

 

SL Disconnect...

 

[WLAN EVENT]Device disconnected from the AP: www.int8.cn, BSSID: 8c:a6:df:27:b2:fa on application's request

 

 

GET_TIME: Test Complete

 

 

 

虽然已经调试好程序,但此时数据下载到RAM中,断电后数据即丢失

如果想把数据永久固化到FLASH中需要使用UNIFLASH编程工具

安装uniflash只能使用3.4版本,

为什么要用3.4版本可以看下边的网址

For CC3100 and CC3200, please continue to use UniFlash v3.4.

http://processors.wiki.ti.com/index.php/Category:CCS_UniFlash

CC31xx & CC32xx UniFlash

http://processors.wiki.ti.com/index.php/CC31xx_%26_CC32xx_UniFlash

打开uniflash新建配置文件,connection选择CC3X Serial(UART)Interface后确定

设置COM Port为开发板的虚拟串口

 

修改SYS/MCUIMG.BIN为刚刚编译生成的文件C:\ti\CC3200SDK_1.2.0\cc3200-sdk\example\get_time\ewarm\free_rtos\Exe\get_time.bin

点Operation菜单下的Program下载程序(下载时需将串口助手断开)

程序输出

[22:46:04] Begin Program operation.

[22:46:05] INFO: > Executing Operation: Connect

[22:46:07] INFO: setting break signal

[22:46:08] INFO: detecting FTDI for device reset

[22:46:09] INFO: connection succeeded

[22:46:09] INFO: getting storage list

[22:46:09] INFO: > Executing Operation: Init

[22:46:09] INFO: reading version info

[22:46:09] INFO: DEVICE CC3200 ES1.33

[22:46:09] INFO: reading version info

[22:46:10] INFO: reading version info

[22:46:12] INFO: > Executing Operation: Program

[22:46:12] INFO: > File name: /sys/mcuimg.bin, Update: true, Erase: false

[22:46:12] INFO: > Size of file = 43716

[22:46:12] INFO: > Update File: /sys/mcuimg.bin

[22:46:12] INFO: Downloading file "/sys/mcuimg.bin" with size 43716

[22:46:14] INFO:

 

New Token is 0x0

[22:46:14] INFO: Download complete

[22:46:14] INFO: > Updated Token value: 0x0

[22:46:14] INFO: > File name: /cert/ca.pem, Update: false, Erase: false

[22:46:14] INFO: > File name: /cert/client.pem, Update: false, Erase: false

[22:46:14] INFO: > File name: /cert/private.key, Update: false, Erase: false

[22:46:14] INFO: > File name: /sys/macadd.bin, Update: false, Erase: true

[22:46:14] INFO: > Erase File: /sys/macadd.bin

[22:46:14] INFO: erasing file "/sys/macadd.bin"

[22:46:14] INFO: deleting file "/sys/macadd.bin"

[22:46:14] INFO: erase file completed

[22:46:14] INFO: > File name: /sys/mode.cfg, Update: false, Erase: false

[22:46:14] INFO: > File name: /sys/ipcfg.ini, Update: false, Erase: false

[22:46:14] INFO: > File name: /sys/ap.cfg, Update: false, Erase: false

[22:46:14] INFO: > File name: /sys/devname.cfg, Update: false, Erase: false

[22:46:14] INFO: > File name: /sys/mdns.cfg, Update: false, Erase: false

[22:46:14] INFO: > File name: /sys/dhcpsrv.cfg, Update: false, Erase: false

[22:46:14] INFO: > File name: /sys/httpsrv.cfg, Update: false, Erase: false

[22:46:14] INFO: > File name: /sys/pref.net, Update: false, Erase: false

[22:46:14] INFO: > File name: /sys/smartconfigkeys.cfg, Update: false, Erase: false

[22:46:14] INFO: > File name: /sys/stacfg.ini, Update: false, Erase: false

[22:46:14] INFO: > File name: /sys/p2p.cfg, Update: false, Erase: false

[22:46:14] INFO: > File name: /sys/pmcfg.ini, Update: false, Erase: false

[22:46:14] INFO: > Executing Operation: Disconnect

[22:46:14] Operation Program returned.

 

将跳线J15取下

连接串口助手

复位

又可以看到串口打印信息

哦了,

我的第一个CC3200程序调试结束

你可能感兴趣的:(wifi,CC3200_TI)