1

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?

cagdas
  • 1,634
  • 2
  • 14
  • 27
Kev1n91
  • 3,553
  • 8
  • 46
  • 96

2 Answers2

4

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.

Chupo_cro
  • 698
  • 1
  • 7
  • 21
  • This does not explain why the AT firmware (Which runs after the bootloader) also seems to communicate at 74880 baud. – bluemind Dec 07 '16 at 08:38
  • Yes but then I would not need to change it something else and just could it run on 74880 the whole time, couldn't I ? However atm I need to open the inital connection with 74880, reset the ESP and then I need to connect with 115200 Baudrate – Kev1n91 Dec 07 '16 at 12:17
  • 1
    @cranphin - That is because all debug messages are controlled by the code contained in ROM so flashed firmware cannot change the hardcoded timings. – Chupo_cro Dec 13 '16 at 08:56
  • 74880 is standard baud rate? – Wang Liang Apr 17 '19 at 17:07
2

In order to set UART baudrate persistent after a reset you should use AT+UART_DEF.

From the AT instruction :

  1. AT+UART_DEF – default UART configuration This command sets the UART configuration and save it to flash. It is stored as the default parameter and will also be used as the default baudrate henceforth.
mpromonet
  • 11,326
  • 43
  • 62
  • 91
  • This might solve a problem, but it doesn't answer the actual question :) Which is **why** the ESP behaves as described? Which if I read it correctly is to run the AT firmware a 74880 baud after power on, then at 115200 baud after a reset. – bluemind Dec 07 '16 at 08:42
  • 1
    @cranphin: The post says he choose baudrate 74880, and communication was ok, reset and then communication using baudrate 74880 doesnot work, but works using baudrate 115200. This answer suggests to configure baudrate to 74880 in a persistent way in order to work after reset. why this doesnot answer to the question ? – mpromonet Dec 07 '16 at 19:41
  • 3
    He did not ask for a solution (although he might be glad with it), but why this behavior occurs :) – bluemind Dec 08 '16 at 07:58