两侧同时换到之前的修订记录前一修订版后一修订版 | 前一修订版 |
ocrobot:modules:seed [2017/04/07 10:03] – 外部编辑 127.0.0.1 | ocrobot:modules:seed [2023/06/07 04:23] (当前版本) – 外部编辑 127.0.0.1 |
---|
| ======OCROBOT SEED (WIFI模块)====== |
| |
| =====概况===== |
| OCROBOT SEED 是基于ESP8266芯片平台的一款超低成本的串口WIFI解决方案模块。 |
| |
| |
| {{:ocrobot:modules:esp8266-photo-2.jpg?300|}} |
| =====参数===== |
| ----------------------- |
| * 802.11 b/g/n 协议 |
| * Wi-Fi 2.4 GHz, 支持WPA/WPA2 |
| * 具有10-bit ADC |
| * 具有TCP/IP 协议集 (ipv4) |
| * +20dBm 输出功率802.11b模式 |
| * 内置低功耗 32-bit MCU |
| * SDIO 2.0, SPI, UART |
| * STBC, 1×1 MIMO, 2×1 MIMO |
| * 温度范围 -40C ~ 125C |
| |
| =====固件的简单更新与升级===== |
| ------------------ |
| |
| 如何上传新固件到模块 |
| |
| 首先要按照升级模式来链接硬件 |
| |
| {{:ocrobot:modules:2.png?400|}} |
| |
| 很简单的接线,反接TX RX 供电 然后短接中间的两个IO(可以用跳线帽),然后插上USB就进入了升级模式了。 |
| |
| 下载windows下的升级软件(linux用户看后面的教程) |
| |
| {{:ocrobot:modules:模块固件更新工具.zip|固件上传工具}} |
| |
| 下载此工具,然后根据需要选择固件 |
| |
| |
| {{:ocrobot:modules:ocorobot_bin_0.9.1_.zip|ocorobot固件(基于0.9.1)}} {{:ocrobot:modules:bin_0.9.2_.zip|官方0.9.2版本固件}} |
| |
| |
| 好了,我们以升级官方固件为例来演示,其实所有的操作都是一样的。。 |
| |
| 解压缩所有的文件,像这样放好 |
| |
| {{:ocrobot:modules:up:1.png?|}} |
| |
| |
| 双击这个可执行文件启动下载器 |
| |
| {{:ocrobot:modules:up:2.png?|}} |
| |
| |
| {{:ocrobot:modules:up:3.png?|}} |
| |
| 按照要求选择好bin文件,文件名要和后面的存储地址对应,不然会出问题 |
| |
| 然后下面要选择com口(一定要选择模块的com口号),点击下载START就会开始下载,如果你发现进度条不动,在链接的状态下,拔插一下VCC线重置模块即可。 |
| |
| |
| [[ocrobot:modules:seed:updata|官方固件的升级指南]] |
| |
| |
| |
| |
| =====编译环境的建立(固件开发)===== |
| ----------------------- |
| ====虚拟平台的搭建==== |
| |
| 我们需要一个UBUNTU的系统环境,请windows用户下载下面的虚拟机软件,Ubuntu用户请自便 |
| |
| <code> |
| https://www.virtualbox.org/wiki/Downloads |
| </code> |
| |
| 然后去Ubuntu官网下载一个Ubuntu, 系统版本由你自己的计算机系统确定,32位的就下载32位 64位的就下载64位 |
| <code> |
| http://www.ubuntu.com/ |
| </code> |
| |
| 然后使用虚拟机建立一个Ubuntu环境,您可以使用任何你熟悉的虚拟环境,我们以vbox为例。 |
| |
| 虚拟机的安装我们就不介绍了,下面看创建虚拟机 |
| |
| 依图创建安装好虚拟机 |
| |
| {{:ocrobot:modules:vbox:1.png?600|}} |
| |
| {{:ocrobot:modules:vbox:2.png?600|}} |
| |
| {{:ocrobot:modules:vbox:3.png?600|}} |
| |
| {{:ocrobot:modules:vbox:4.png?600|}} |
| |
| {{:ocrobot:modules:vbox:5.png?600|}} |
| |
| {{:ocrobot:modules:vbox:6.png?600|}} |
| |
| 血泪的教训,给8G硬盘是不够的,至少保证12GB |
| |
| {{:ocrobot:modules:vbox:7.png?600|}} |
| |
| {{:ocrobot:modules:vbox:8.png?600|}} |
| |
| |
| |
| {{:ocrobot:modules:vbox:9.png?600|}} |
| |
| 然后在这个位置,选择下载好的UBUNTU 的ISO文件即可 |
| |
| {{:ocrobot:modules:vbox:13.png?600|}} |
| |
| {{:ocrobot:modules:vbox:14.png?100|}} |
| |
| 然后就启动虚拟机,Ubuntu的安装,大家自己去找教程看看吧。我们不做涉及 |
| |
| 安装系统需要等待一段时间,可以去喝喝茶,出门晃荡一圈 |
| |
| |
| ====环境的建立==== |
| ------------------- |
| 系统装好后,我们可以按快捷键 |
| |
| Ctrl+Alt+T |
| |
| 启动控制台 |
| |
| 然后用root用户权限执行命令 |
| |
| 32位系统 |
| |
| <code> |
| sudo apt-get install git autoconf gperf bison flex texinfo libtool libncurses5-dev wget gawk libc6-dev-amd64 |
| </code> |
| |
| <code> |
| sudo apt-get install build-essential |
| </code> |
| |
| <code> |
| sudo mkdir /opt/Espressif |
| </code> |
| |
| <code> |
| sudo chown $username /opt/Espressif |
| </code> |
| 其中$username为你系统创建时你建立的用户名,请自行修改 |
| |
| 64位系统用户执行 |
| |
| <code> |
| sudo apt-get install git autoconf gperf bison flex texinfo libtool libncurses5-dev wget gawk libc6-dev-i386 |
| </code> |
| |
| <code> |
| sudo apt-get install build-essential |
| </code> |
| |
| <code> |
| sudo mkdir /opt/Espressif |
| </code> |
| |
| <code> |
| sudo chown $username /opt/Espressif |
| </code> |
| 其中$username为你系统创建时你建立的用户名,请自行修改 |
| |
| |
| 然后依次执行以下语句 |
| |
| <code> |
| cd /opt/Espressif |
| |
| git clone -b lx106 git://github.com/jcmvbkbc/crosstool-NG.git |
| |
| cd crosstool-NG |
| |
| ./bootstrap && ./configure --prefix=`pwd` && make && make install |
| |
| ./ct-ng xtensa-lx106-elf |
| |
| ./ct-ng build |
| </code> |
| 其中第二个语句是github拷贝数据 |
| |
| 最后一个构建都是很费时间的,耐心等待,如果异常出错,基本就是下载出问题,我们有第二套解决方案 |
| 去http://mirror.bjtu.edu.cn/gnu/地址 |
| 检索下载以下文件 |
| |
| gcc4.8.2 |
| |
| binutil2.24 |
| |
| isl0.12.2 |
| |
| mpfr3.1.2 |
| |
| cloog0.18.1 |
| |
| gmp5.1.3 |
| |
| mpc1.0.2 |
| |
| 后缀名tar.xx均可 |
| |
| |
| 然后放到目录/opt/Espressif/crosstool-NG/.build/tarballs下 |
| |
| 再次**./ct-ng build**即可 |
| |
| 经过漫长的等待,环境就OK了。 |
| |
| |
| ====安装SDK==== |
| ------------------ |
| 下面我们就要安装SDK了。我们以目前的最新版0.92版本为例讲解,日后可以再后面的资源区下载最新版本 |
| |
| 点击下载SDK(0.92) |
| |
| 下载解包后将目录拷贝到 |
| <code> |
| /opt/Espressif/ESP8266_SDK/ |
| </code> |
| |
| 下载添加一些库文件(依次输入) |
| <code> |
| wget -O /opt/Espressif/ESP8266_SDK/lib/libc.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libc.a |
| |
| wget -O /opt/Espressif/ESP8266_SDK/lib/libhal.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a |
| </code> |
| |
| 再添加头文件 |
| <code> |
| wget -O /opt/Espressif/include.tgz https://github.com/esp8266/esp8266-wiki/raw/master/include.tgz |
| |
| cd /opt/Espressif/ |
| |
| tar -xvzf include.tgz |
| </code> |
| |
| 然后下载必要工具 |
| <code> |
| cd ~ |
| |
| wget https://github.com/esp8266/esp8266-wiki/raw/master/deb/src/esptool_0.0.2.orig.tar.gz |
| |
| tar -xvzf esptool_0.0.2.orig.tar.gz |
| |
| sudo cp esptool/esptool /usr/bin |
| |
| </code> |
| |
| 这样就完成了系统的搭建 |
| |
| ====编译代码==== |
| ------------------ |
| 来编译一个标准的at固件 |
| <code> |
| cd ~ |
| |
| mkdir esp_sources |
| |
| cd esp_sources |
| |
| cp -R /opt/Espressif/ESP8266_SDK/examples/at at |
| |
| cd at |
| |
| wget -O Makefile https://raw.githubusercontent.com/esp8266/source-code-examples/master/example.Makefile |
| |
| make |
| </code> |
| |
| 命令就不多做解释了。。反正就是复制代码过来编译出来。会linux的人都能看懂 |
| |
| 编译完成后就会有两个bin文件,按照文件名的地址位置下载到flash就可以了。 |
| <code> |
| FW firmware/0x00000.bin |
| FW firmware/0x40000.bin |
| </code> |
| ====上传固件==== |
| ------------------ |
| ===硬件准备==== |
| --------------------- |
| 按照下面的图示要求,链接好套件中的CP2102与wifi模块,需要注意的是,短接中间的两个引脚。这样设备会进入固件升级模式。 |
| |
| ===软件准备=== |
| ----------------- |
| 我们需要将硬件USB设备设置到虚拟机中,请看下图操作 |
| |
| {{:ocrobot:modules:vbox:system:2.png?700|}} |
| |
| 将usb组件载入到虚拟机 |
| |
| 我们将会用到一个python语言编写的工具,所以,需要安装Python2.7版本的系统环境(注意!不是python3 他们不一样) |
| |
| 如果您使用的和我一样是ubuntu比较新的版本的系统,这个是默认包含的,所以不用自己安装 |
| |
| 如果不是请前往https://www.python.org/downloads/下载 |
| |
| 还需要一个lib 让python支持串口通讯 pyserial-2.7 |
| |
| 下载地址:http://pyserial.sourceforge.net/pyserial.html |
| |
| 下载pyserial-2.7.tar.gz (md5)这个文件 |
| |
| 解压缩并安装这个包 |
| <code> |
| tar -xvzf pyserial-2.7.tar.gz |
| |
| cd pyserial-2.7 |
| |
| python setup.py install |
| </code> |
| |
| 理论上就能安装好. |
| |
| 然后我们继续 |
| |
| 请下载这个文件 |
| |
| {{:ocrobot:modules:esptool.zip|esptool.py}} |
| |
| 自行解压后放到bin文件的目录下(/home/miniking/esp_sources/at/firmware) |
| |
| 然后执行以下命令 |
| <code> |
| cd /home/miniking/esp_sources/at/firmware |
| |
| sudo esptool.py --port /dev/ttyUSB0 write_flash 0x00000 0x00000.bin |
| |
| sudo esptool.py --port /dev/ttyUSB0 write_flash 0x40000 0x40000.bin |
| </code> |
| |
| 请注意两条下载命令会有进度百分比的过程,就是正常的。 |
| |
| 特别注意,下载完成0x00000后,要拔掉3v3的IO口,让模块重启,因为模块会自动进入正常模式,这样就不能顺利的进行第二个固件的下载了。 |
| |
| 最后,下载都会提示"Failed to leave Flash mode"等错误信息,这个是没有关系的,实际上都是正常下载进去了。 |
| 请在本文章最后,下载芯片厂家的最新固件 SDK等,我们的固件源码也在最后,根据自己需求来选择使用 |
| =====IO介绍与接线图===== |
| ------------------------ |
| {{:ocrobot:modules:1.png?500|}} |
| **标准使用模式接线图** |
| |
| |
| {{:ocrobot:modules:2.png?500|}} |
| **固件升级模式接线图** |
| |
| 固件升级模式主要区别就是要短接中间两个IO口,芯片启动会自动进入固件升级模式 |
| |
| =====图片===== |
| ---------------------- |
| {{:ocrobot:modules:esp8266-photo-2.jpg?300|}} |
| |
| {{:ocrobot:modules:esp8266-photo-1.jpg?300|}} |
| =====参考资料===== |
| -------------------- |
| {{:ocrobot:modules:license.zip|}} |
| |
| {{:ocrobot:modules:esp_iot_sdk_v0.9.3.zip|原版0.9.3_SDK编译环境不含AT}} |
| |
| {{:ocrobot:modules:esp_iot_sdk_v0.9.2.zip|原版0.9.2_SDK环境与AT固件源码}} |
| |
| {{:ocrobot:modules:esp_iot_sdk.zip|OCROBOT AT版本SDK及源代码(0.9.1)}} |
| |
| [[ocrobot:modules:seed:AT|OCROBOT版本AT指令参考手册(老旧)]] |
| |
| {{:ocrobot:modules:4a-espressif_at指令集018.pdf|标准AT指令集手册}} |
| |
| {{:ocrobot:modules:4b-espressif_at指令使用示例_v0.2.pdf|AT指令集使用指南}} |
| |
| {{:ocrobot:modules:4a-at-espressif_at_instruction_set.pdf|AT Instruction set}} |
| {{:ocrobot:modules:4b-at-espressif_at_command_examples.pdf|AT command examples}} |
| =====Release Note===== |
| -------------------- |
| |
| esp_iot_sdk_v0.9.3_14_11_21 Release Note |
| |
| 1、Add license documentation of ESPRESSIF SDK |
| |
| 2、Add APIs to read and write RTC memory, and APIs to get RTC time. |
| |
| 3、Add APIs to swap UART0 |
| |
| 4、Add API to read ADC, delete adc.c. |
| |
| 5、Add API to read spi flash id |
| |
| 6、Revise struct station_config, add bssid parameters to distinguish different AP with same ssid ; |
| Note: if station_config.bssid_set == 1 , station_config.bssid has to be set, or connection will fail. So in general, station_config.bssid_set need to be 0. |
| |
| 7、Revise struct scan_config, add scan_config.show_hidden to set whether scan APs which ssid is hidden or not; not scan, set scan_config.show_hidden to be 0. |
| Add bss_info.is_hidden in struct bss_info to show if this AP’s ssid is hidden. |
| |
| 8、Revise struct softap_config, add softap_config.ssid_len. If softap_config.ssid_len == 0, check ssid till find a termination characters; otherwise it depends on softap_config.ssid_len. |
| |
| 9、Revise API “wifi_softap_set_config” to take effect immediately, needs not restart to make the configuration enable any more. |
| |
| 10、Add APIs to set and get physical layer mode(802.11b/g/n) |
| |
| 11、Add APIs to enable and disable DHCP server of ESP8266 softAP |
| |
| 12、Add APIs to enable and disable DHCP client of ESP8266 station |
| |
| 13、Add API to set range of ip address that get from DHCP server |
| |
| 14、Add APIs to set and get how many TCP connections allowed at max. |
| |
| 15、Add APIs to set and get how many TCP clients allowed at max to a TCP server. |
| |
| 16、Revise “wifi_set_ip_info” and “wifi_set_macaddr” to take effect immediately. |
| |
| 17、Fix some bugs to make the software more reliable. |
| |
| |
| |
| 1、增加乐鑫SDK license授权文件; |
| |
| 2、增加rtc memory读写接口,和 rtc校准及获取接口; |
| |
| 3、增加uart swap接口; |
| |
| 4、增加adc读取接口,原adc.c中接口不再使用; |
| |
| 5、增加获取spi flash id接口; |
| |
| 6、修改station连接参数结构,增加bssid项,支持连接ssid相同,bssid不同的路由; |
| |
| 注:请查看station_config结构,bssid_set为1时,需设置对应的bssid,否则会连接不上,通常请设为0。 |
| |
| 7、修改scan参数结构,可选择是否扫描隐藏ssid的路由,不使用请设为0,扫描结果结构体bss_info中对应增加 is_hidden 参数; |
| |
| 8、修改softap设置参数结构,增加ssid_len;当 ssid_len 设为0时,读取ssid 直至遇到结束符;否则使用ssid_len长度; |
| |
| 9、增强接口“wifi_softap_set_config”功能,设置softap参数后不用重启,立即生效; |
| |
| 10、增加设置、获取phy工作模式接口,可设置为b,bg,bgn; |
| |
| 11、增加dhcp server启动、停止接口; |
| |
| 12、增加dhcp client启动、停止接口; |
| |
| 13、增加dhcp server分配池管理接口; |
| |
| 14、增加获取、设置tcp连接数接口; |
| |
| 15、增加获取、设置tcp server允许连接数接口; |
| |
| 16、增强修改ip、mac接口(“wifi_set_ip_info” 和 “wifi_set_macaddr”),可在任何时候设置,无需重启; |
| |
| 17、修正一些软件问题,进一步提高软件稳定性。 |