向ESP8266发送复位信号后,为什么需要更改波特率? [英] Why do I need to change the Baudrate after I send a Reset to the ESP8266?

查看:581
本文介绍了向ESP8266发送复位信号后,为什么需要更改波特率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我已经成功地将Esp8266连接到Arduino Due.如果我将波特率选择为74880,则可以通过串行监视器与之通信.然后所有命令都可以正确输入并可以正确读取.但是,当我发送命令AT+RST重新启动Esp8266时,我无法与它通信,需要以115200的波特率重新打开串行连接.每次我将新代码加载到Arduino或当我关闭Esp8266的电源时.

这种行为来自何处?

解决方案

在这里,您对这种行为的起因进行了解释:

74880 Bd的波特率是ESP的本机"波特率,用于发送在引导期间系统本身自动自动生成的调试消息,如果使用的是26 MHz而不是40 MHz的晶振-正如我们所看到的,大多数情况是 .

如果使用40 MHz晶体,则波特率应为预期值(115200),但是如果使用26 MHz晶体,则波特率应为115200 * 26/40 = 74880.

在引导加载程序结束之后,波特率会以其他方式进行控制,因此这就是为什么您要使用两种不同的波特率的原因-第一种是默认的波特率(74880),第二种是以后使用的波特率(可以设置的波特率)./p>

我通常将波特率设置为74880,这样既可以看到自动生成的消息,也可以看到从代码发送的消息.

So I have succesfully attached a Esp8266 to an Arduino Due. I can communicate with it via Serial Monitor if I choose the Baudrate to be 74880. Then all the commands come to it correctly and can be read back correctly. However, when I send the command AT+RST which restarts the Esp8266 I can no longer communicate with it and need to reopen the serial connection with a Baudrate of 115200. I have to repeat this every time I load the code new to the Arduino or when I power off the Esp8266.

Any ideas where this behaviour comes from?

解决方案

Here you are an explanation about where are the origins of such a behavior:

Baudrate of 74880 Bd is ESP's 'native' baud rate for sending debug messages generated automatically by the system itself during the boot in case there is 26 MHz instead of 40 MHz crystal used on board - and as we can see, mostly that is the case.

With 40 MHz crystal the baudrate would be as expected (115200) but with 26 MHz crystal instead, baudrate is 115200 * 26/40 = 74880.

Later after bootloader ends baudrate is controlled in other way so that's why you have two different baudrates - the first is the default one (74880) and the second is the one that is active later (the one you can set).

I usually set baudrate to 74880 so I can see both the messages generated automatically and the messages I send from the code.

这篇关于向ESP8266发送复位信号后,为什么需要更改波特率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆