博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
esp freertos_如何开始使用FreeRTOS和ESP8266
阅读量:2526 次
发布时间:2019-05-11

本文共 8504 字,大约阅读时间需要 28 分钟。

esp freertos

by Denis Nuțiu

丹尼斯·努尤(Denis Nuțiu)

如何开始使用FreeRTOS和ESP8266 (How to get started with FreeRTOS and ESP8266)

Recently, I purchased a NodeMCU from AliExpress for about $4. The reason I did this was to find out what all the fuss is about with ESP8266.

最近,我以4美元左右的价格从速卖通购买了一个NodeMCU。 我这样做的原因是要弄清楚ESP8266有什么大惊小怪的。

NodeMCU is an open source IoT platform. It includes firmware which runs on the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on the ESP-12 module.

NodeMCU是一个开源物联网平台。 它包括运行在Espressif Systems的ESP8266 Wi-Fi SoC上的固件以及基于ESP-12模块的硬件。

Compared to the Arduino UNO, my ESP8266 totally knocks it out of the park when it comes to CPU power and price.

与Arduino UNO相比,我的ESP8266在CPU功耗和价格上完全无法使用。

The ESP8266 is 500% faster and 82% cheaper than the Arduino. The ESP8266 also has WiFi connectivity.

ESP8266比Arduino快500%,便宜82%。 ESP8266还具有WiFi连接。

I was very surprised when I visited the for the ESP8266. There’s lots of documentation and resources that you can use. For example, there’s an Android application which tells your ESP8266 to connect to your WiFi. The app sends the SSID and password as packets, the ESP8266 sniffs them, and then it connects to your WiFi. This is called SmartConfig, and was invented by Texas Instruments.

当我访问上的ESP8266时,我感到非常惊讶。 您可以使用很多文档和资源。 例如,有一个Android应用程序告诉您ESP8266连接到您的WiFi。 该应用程序将SSID和密码作为数据包发送,ESP8266嗅探它们,然后连接到您的WiFi。 这称为SmartConfig,由Texas Instruments发明。

In this article, I will guide you to setup and run the Smart Config example from the Espressif RTOS SDK.

在本文中,我将指导您从Espressif RTOS SDK设置和运行Smart Config示例。

这是您需要的东西: (Here’s the things you’ll need:)

  • A modern computer.

    一台现代计算机。
  • A NodeMCU board with ESP12-E

    带有ESP12-E的NodeMCU板
  • VirtualBox ()

    VirtualBox( )

  • Ubuntu Server LTS ()

    Ubuntu Server LTS( )

配置VirtualBox进行开发 (Configuring VirtualBox for development)

  1. Download VirtualBox and install Ubuntu Server. This should be easy to do, but if you don’t know how, Google it or have a look at this graphic . Installing an OS is a nice skill to have. (Tip: When VirtualBox prompts you to select the disk, make it dynamically allocated and at least 50GB in size. This will save you some headaches further down the line.)

    下载VirtualBox并安装Ubuntu Server。 这应该很容易做到,但是如果您不知道如何操作,请通过Google或查看此图形 。 安装操作系统是一项不错的技能。 (提示:当VirtualBox提示您选择磁盘时,请对其进行动态分配,并使其至少具有50GB的大小。这将使您省去一些麻烦。)

  2. Make sure that you can access the internet from within the virtual machine and configure the DNS server:

    确保可以从虚拟机内部访问Internet并配置DNS服务器:

To configure the DNS server, have a look at this .

要配置DNS服务器,请看以下 。

Example: dns-nameservers 8.8.8.8 8.8.4.4 If you can ping Google, then you’re good to go!

示例: dns-nameservers 8.8.8.8 8.8.4.4如果您可以ping通Google,那么您就可以了!

3. (Optional) Install and server. This will make your life much easier.

3.(可选)安装和服务器。 这将使您的生活更加轻松。

4. (Optional) Enable port forwarding. In order to SSH directly into your virtual machine, you need to enable port forwarding. For example, to map the port 2222 on your host machine to the port 22 of your virtual machine.

4. (可选)启用端口转发。 为了直接通过SSH进入您的虚拟机,您需要启用端口转发。 例如,要将主机上的端口2222映射到虚拟机端口22

If you have enabled port forwarding, you can now SSH into your virtual machine from your Host machine as in the figure below.

如果启用了端口转发,则现在可以从主机计算机SSH到虚拟机中,如下图所示。

Note: If you’re on Windows, you need Putty in order to SSH into the virtual machine.

注意:如果您使用的是Windows,则需要Putty才能通过SSH进入虚拟机。

5. Plug in your NodeMCU and execute the following command:

5.插入您的NodeMCU并执行以下命令:

tail -f /var/log/kern.log

tail -f /var/log/kern.log

This should reveal to you that the device has been identified as /dev/ttyUSB0. If nothing happens, then you need to add the USB to the virtual machine. After adding the USB, unplug and plug your device in again.

这应该向您显示该设备已被标识为/ dev / ttyUSB0。 如果没有任何React,则需要将USB添加到虚拟机。 添加USB后,拔出插头并再次插入设备。

If you’ve reached this point and every thing is working, congratulations! You’re now ready to compile the SDK and run the SmartConfig example. You can even shoot me a tweet at

如果您到了这一步并且一切正常,那么恭喜 ! 现在,您可以编译SDK并运行SmartConfig示例。 您甚至可以在给我发一条推文

编译SDK并刷新开发板 (Compiling the SDK and flashing the board)

  1. Install the required packages (as below). This info is also available on the SDK’s readme.md.

    安装所需的软件包(如下所示)。 此信息也可在SDK的readme.md中获得。
sudo apt-get install make unrar-free autoconf automake libtool gcc g++ gperf flex bison texinfo gawk ncurses-dev libexpat-dev python-dev python python-serial sed git unzip bash help2man wget bzip2 libtool-bin

2. Create a new folder and navigate into it: mkdir Development && cd Development

2.创建一个新文件夹并浏览到其中: mkdir Development && cd Development

3. Clone the Open SDK:

3.克隆Open SDK: :

git clone --recursive https://github.com/pfalcon/esp-open-sdk.git

git clone --recursive https://github.com/pfalcon/esp-open-sdk.git

3. Run make: make

3.运行make: make

Warning: This step will take a while to finish so please be patient. On my virtual machine it completed after 50 minutes. On yours it might take more or less, but before you run, make make sure that you’re connected to the internet and DNS is properly configured. The best way to check this is to execute a ping to Google or some other site if Google is blocked in your region.

警告:此步骤需要一段时间才能完成,因此请耐心等待。 在我的虚拟机上,它在50分钟后完成。 在您的计算机上,可能需要或多或少的时间,但是在运行之前,请确保已连接到Internet正确配置了DNS 。 最好的检查方法是对您所在地区的Google或其他网站执行ping操作。

If your ping is successful, you can minimize the windows and watch an episode of your favorite TV show. Come back after about 40 minutes (but make sure your computer doesn’t go to sleep).

如果ping成功,则可以最小化窗口并观看自己喜欢的电视节目的一集。 大约40分钟后再回来(但请确保您的计算机不会进入睡眠状态)。

After the SDK has been built successfully, you’ll see a message telling you to put something in your path. To do so, execute the following:

成功构建SDK之后,您会看到一条消息,提示您将某些内容放入路径中。 为此,请执行以下操作:

echo 'export PATH=/home/denis/Development/esp-open-sdk/xtensa-lx106-elf/bin:$PATH' >> ~/.profile

The command will append the string to the ~/.profile file. Now please run the following command:

该命令会将字符串追加到〜/ .profile文件。 现在,请运行以下命令:

xtensa-lx106-elf-gcc --version

xtensa-lx106-elf-gcc --version

If the command executes successfully, then you’re good to go!

如果命令成功执行,那么一切就好了!

4. Test your board

4.测试您的板子

Plug your NodeMCU and run lsusb to verify that your device is connected. After that, run esptool.py chip_id. You should now see the board’s chip id.

插入NodeMCU并运行lsusb,以验证您的设备已连接。 之后,运行esptool.py chip_id 。 现在,您应该看到主板的芯片ID。

5. Clone

5.克隆

git clone https://github.com/espressif/ESP8266_RTOS_SDK.git

6. Export the SDK path and SDK/BIN path using the commands below.

6.使用以下命令导出SDK路径和SDK / BIN路径。

echo 'export SDK_PATH=/home/denis/Development/ESP8266_RTOS_SDK' >> ~/.profile
echo 'export BIN_PATH=/home/denis/Development/ESP8266_RTOS_SDK/bin' >> ~/.profile

7. Compile the SmartConfig example

7.编译SmartConfig示例

cd /home/denis/Development/ESP8266_RTOS_SDK/examples/smart_config/
chmod +x ./gen_misc.sh
./gen_misc.sh

Now accept the default values until you’re asked for SPI_SIZE_MAP. This is where you select 4 because the NodeMCU has a flash size of 32Mbit and this translates to 4MB. You can also select SPI_SPEED 3=80Mhz

现在接受默认值,直到要求您提供SPI_SIZE_MAP。 在此处选择4,因为NodeMCU的闪存大小为32Mbit,并且转换为4MB。 您也可以选择SPI_SPEED 3 = 80Mhz

You’ll see something like this:

您会看到以下内容:

!!!SDK_PATH: /home/denis/Development/ESP8266_RTOS_SDKBIN_PATH: /home/denis/Development/ESP8266_RTOS_SDK/bin
No boot needed.Generate eagle.flash.bin and eagle.irom0text.bin successully in BIN_PATHeagle.flash.bin — — — →0x00000eagle.irom0text.bin — →0x20000!!!

8. Flash the board

8.刷板

cd $BIN_PATH
esptool.py erase_flash
esptool.py write_flash 0x00000 $BIN_PATH/eagle.flash.bin 0x20000 $BIN_PATH/eagle.irom0text.bin 0x3FC000 $BIN_PATH/esp_init_data_default.bin

Now, if you reset the board, you should see no LED blinking.

现在,如果您重置电路板,则应该看不到LED闪烁。

9. Use the Phone Application

9.使用电话应用程序

Open the Application, make sure that you’re connected to a WiFi AP, enter your password, and press confirm. After a few seconds the ESP8266 should connect to your AP. That’s it. Congratulations for reaching the end!

打开应用程序,确保您已连接到WiFi AP,输入密码,然后按确认。 几秒钟后,ESP8266应该连接到您的AP。 而已。 恭喜您成功!

If you want to develop more using the ESP8266-RTOS-SDK, please visit the official websites. You’ll find a lot of resources and documentation there. Also, please take a look at the other examples found in the SDK folder.

如果您想使用ESP8266-RTOS-SDK进行更多开发,请访问官方网站。 您会在那里找到很多资源和文档。 另外,请查看SDK文件夹中的其他示例。

Thank you very much for your time reading this. If you want to reach out to me, you can do so on Twitter:

非常感谢您阅读本文。 如果您想与我联系,可以在Twitter上进行:

资源资源 (Resources)

翻译自:

esp freertos

转载地址:http://wzyzd.baihongyu.com/

你可能感兴趣的文章
Centos安装Python3
查看>>
PHP批量插入
查看>>
laravel连接sql server 2008
查看>>
Laravel框架学习笔记之任务调度(定时任务)
查看>>
Laravel 的生命周期
查看>>
Nginx配置文件nginx.conf中文详解(总结)
查看>>
.net MVC 404错误解决方法
查看>>
linux系统目录结构
查看>>
学习进度
查看>>
最短路径(SP)问题相关算法与模板
查看>>
Python——交互式图形编程
查看>>
英特尔公司将停止910GL、915GL和915PL芯片组的生产
查看>>
Maven配置
查看>>
从远程库克隆库
查看>>
hdu4348 - To the moon 可持久化线段树 区间修改 离线处理
查看>>
地鼠的困境SSL1333 最大匹配
查看>>
flume+elasticsearch+kibana遇到的坑
查看>>
C#——winform
查看>>
CSS3 transform制作的漂亮的滚动式导航
查看>>
《小强升职记——时间管理故事书》读书笔记
查看>>