在全球电子行业中,中国电子工程师已经成为最具活力和创造力的群体。为了能够让中国“攻城狮”原创的设计理念、经验和方案,在更广泛的电子设计开发社区进行分享和传播,贸泽电子特推出<a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MjM5MTg2OTg4Nw==&mid=2655928723&…; textvalue="『吼狮』计划" data-itemshowtype="0" tab="innerlink" data-linktype="2">『吼狮』计划</a>。
<p>本文为吼狮计划投稿文章,分享自安徽工程大学电气学院教师:查君君。</p>
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105711-1.j…; alt=“” width="600"></center>
CC3200是TI公司一款内置Wi-Fi连接的单芯片微控制器(MCU)。它是一款集成了高性能ARM®Cortex®-M4 MCU的无线MCU,允许客户使用单个IC开发整个应用。本文详细介绍了CC3200 WLAN Station例程测试及烧录过程,帮助大家快速上手,玩转这颗无线MCU。
话不多说,首先上一张开箱图。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105712-2.j…; alt=“图1” width="600"></center><center><i>图1</i></center>
其中包括一根Micro USB数据线、一块开发板、两个跳线帽(烧录程序需要用到)。
首先配置CC3200 LaunchPad的软件开发环境,主要包括四个软件:
1)CC3200 SDK(软件开发包),其中包含主要例程源代码。下载地址如下:
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105714-3.p…; alt=“www.ti.com/tool/download/CC3200SDK” width="300"></center><center><i>www.ti.com/tool/download/CC3200SDK</i></center>
2)IAR集成开发环境。下载地址如下:
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105715-4.p…; alt=“www.iar.com/iar-embedded-workbench/#!?architecture=Arm” width="300"></center><center><i>www.iar.com/iar-embedded-workbench/#!?architecture=Arm</i></center>
3)超级终端,用于查看CC3200运行程序时的状态。前三者作为嵌入式开发工程师都应该很熟悉。
4)程序烧写程序UniFlash。IAR软件只能调试不能烧写CC3200,意味着开发板断电后,原来“下载”的程序就消失了。我们需要借助UniFlash将程序固化到板载Flash中,这样就可以“离线”运行程序了。
首先安装好CC3200 SDK,按图2所示地址栏找到我们测试的项目工程文件夹getting_started_with_wlan_station并找到IAR工程文件,如图2所示。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105716-5.p…; alt=“图2” width="600"></center><center><i>图2</i></center>
打开项目工程wlan_station,在左侧文件树状结构图中找到common.h头文件并打开,按图3所示圆角矩形框修改对应内容。主要包含:
<ul>
<li>
<p>SSID_NAME(热点名字)</p>
</li>
<li>
<p>SECURITY_TYPE(加密形式)</p>
</li>
<li>SECURITY_KEY(密码)</li>
</ul>
大家只要找一个可以上网的无线热点就可以,我这边为了测试方便就用手机作为Wi-Fi热点。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105717-6.p…; alt=“图3” width="600"></center><center><i>图3</i></center>
在具体运行程序之前,我们大致看下WLAN Station例程的含义。WLAN Station程序运行后会先连接到一个无线路由器(AP,就是我们在图3common.h定义的热点),成功后会执行“ping”该路由器的操作。如果该无线路由器能够上网,程序会接着“ping”TI 的官网www.ti.com,这点大家可以在图4所示main主函数方框中找到,当然大家可以自己修改网址。这期间会陆续点亮板子上的LED等灯,如果全部执行成功,则D5、D6、D7全部亮起。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105718-7.p…; alt=“图4” width="600"></center><center><i>图4</i></center>
下面我们通过USB线连接CC3200与电脑,具体如图5所示。注意在设备管理器中查看CC3200占用的端口号,图5显示为COM13口。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105719-8.p…; alt=“图5"></center><center><i>图5</i></center>
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105720-9.j…; alt=“图6” width="600"></center><center><i>图6</i></center>
紧跟着配置超级终端,设置超级终端如下,注意端口号为COM13。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105721-10…; alt=“图7” width="600"></center><center><i>图7</i></center>
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105722-11…; alt=“图8"></center><center><i>图8</i></center>
下面就是编译,调试程序了,大家都很熟吧,具体如图9所示。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105723-12…; alt=“” width="600"></center>
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105724-13…; alt=“图9” width="600"></center><center><i>图9</i></center>
当板子调试开始时,板子运行信息通过串口在超级终端上显示出来,证明该例程运行无误,超级终端显示如图10所示。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105725-14…; alt=“图10” width="600"></center><center><i>图10</i></center>
最后一步我们要下载CC3200的烧写软件UniFlash,因为IAR软件只能调试不能烧写CC3200。该软件官方下载地址如下:
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105726-15…; alt=“www.ti.com/tool/download/UNIFLASH” width="300"></center><center><i>www.ti.com/tool/download/UNIFLASH</i></center>
注意,要下载老的版本V3.4.1,新版本居然找不到设备CC3200-LAUNCHXL。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105727-16…; alt=“图11” width="600"></center><center><i>图11</i></center>
紧跟着完成相关烧写软件配置。File——New Configuration——CC3X Serial(UART)Interface,如图12所示。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105728-17…; alt=“图12” width="600"></center><center><i>图12</i></center>
加载编译生成的wlan_station.bin文件。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105729-18…; alt=“图13” width="600"></center><center><i>图13</i></center>
注意勾选图14红色方框中所示复选框。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105730-19…; alt=“图14” width="600"></center><center><i>图14</i></center>
插上J15的短接帽,进入烧写模式,否则在烧写过程中将出现连接不上开发板的情况。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105731-20…; alt=“图15” width="600"></center><center><i>图15</i></center>
COM Port填入13,单击Program进行烧写。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105732-21…; alt=“图16” width="600"></center><center><i>图16</i></center>
烧写成功,显示如图所示的verification OK。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105733-22…; alt=“图17” width="600"></center><center><i>图17</i></center>
下面就可以离线运行了。拔掉J15的短接帽,按Reset键,让板子运行,再次在超级终端中观测命令执行情况。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105734-23…; alt=“图18” width="600"></center><center><i>图18</i></center>
同时开发板底部的D5、6、7全部点亮,证明测试成功。
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105734-23…; alt=“图19” width="600"></center><center><i>图19</i></center>
<strong>本文小结</strong>
CC3200是TI无线连接SimpleLink Wi-Fi和物联网(IoT)解决方案推出的一款单片无线MCU,是业界第一个具有内置Wi-Fi的MCU,是针对物联网应用、集成高性能ARM Cortex-M4的无线MCU。客户能够使用单个集成电路开发整个应用,借助片上Wi-Fi、互联网和强大的安全协议,无需Wi-Fi经验即可实现快速的开发。CC3200有一个完整平台解决方案,其中包括软件、示例应用、工具、用户和编程指南、参考设计以及TI E2E支持社区。本文详细图解了CC3200 WLAN Station例程测试及烧录过程,希望对大家利用这颗无线MCU进行应用开发有所助力。
扫码获取产品信息
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105736-25…; alt=“” width="300"></center>
<strong>作者:查君君</strong>
<center><img src="http://mouser.eetrend.com/files/2020-08/wen_zhang_/100052365-105737-26…; alt=“” width="200"></center>
安徽工程大学电气学院教师,主讲课程电子创新设计、嵌入式系统设计原理与应用。
<strong><font color="#004a85">该发布文章为独家原创文章,转载请注明来源。对于未经许可的复制和不符合要求的转载我们将保留依法追究法律责任的权利。</font> </strong>
<strong><font color="#FF0000"> 相关阅读:</font></strong>
<a href="http://mouser.eetrend.com/content/2020/100048643.html">悬赏ing!贸泽出台『吼狮』计划,有奖征集工程师原创佳作</a>
<a href="http://mouser.eetrend.com/content/2020/100051301.html">【吼狮计划】BOM管理,还在为物料编码头痛吗?不妨看看贸泽是怎么做的</a>