Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] ESP8266 Weird Response to AT Commands

Status
Not open for further replies.

Praveen Kumar P S

Member level 4
Joined
Aug 21, 2014
Messages
79
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Location
India
Activity points
627
Hello guys..
I m new to this forum.

Recently I bought an esp8266ex from ebay. After setting up everything, i have a strange problem. The 8266 responds to AT commands, but responded with weired characters.

TERM.PNG

I am using arduino UNO.

Connected the Tx pin of the arduino to Rx pin of esp8266 through a voltage divider (POT). GPI02 and RST pins are floating.

GPI0 is connected to ground trough a 10k resistor.

I have tried both 3.3v arduino pin and zr78L033 regulator to power up the 8266.
But both ended up giving same output.

Also , I have tried all the baud rate, out of which 115200 baud between arduino and esp responded with less garbage ( above picture)

I need some help to figure it out. Please help me guys.

Thank You
 

are you sure your arduino serial port is turned off? you need to make sure the arduino's mega328 isn't using the UART or it can be a source of problems... (disable serial comunication in your arduino or make sure the flash is blank (0xff))

It's better if you can use an external UART to USB converter like a CH340 or a FT232 board...
 

are you sure your arduino serial port is turned off? you need to make sure the arduino's mega328 isn't using the UART or it can be a source of problems... (disable serial comunication in your arduino or make sure the flash is blank (0xff))

It's better if you can use an external UART to USB converter like a CH340 or a FT232 board...

Hello Kurenai_ryu ,

I am using sketch to communicate with esp. since UNO has only one serial channel, i have used softwareSerial to make pin 2 --->Rx and pin 3---->Tx

Here is my sketch::

Code:
#include <SoftwareSerial.h>
 
SoftwareSerial esp8266(2,3); //make RX Arduino line is pin 2, make TX Arduino line is pin 3.
                           
void setup()
{
  Serial.begin(19200);
  esp8266.begin(115200);
}
 
void loop()
{
  if(esp8266.available())
  {
    while(esp8266.available())
    {
     
      char c = esp8266.read(); 
      Serial.write(c);
   
    }  
  }
  
 
  
  if(Serial.available())
  {
    
    
     
    delay(2000); 
    String command="";
    
    while(Serial.available())
    {
        // read one character
      command+=(char)Serial.read();
       
    
    }
    esp8266.println(command);
    delay(10);
  }
 
}
 

Recently I bought an esp8266ex from ebay. After setting up everything, i have a strange problem. The 8266 responds to AT commands, but responded with weired characters.

I am using arduino UNO.

Connected the Tx pin of the arduino to Rx pin of esp8266 through a voltage divider (POT). GPI02 and RST pins are floating.

GPI0 is connected to ground trough a 10k resistor.

I have tried both 3.3v arduino pin and zr78L033 regulator to power up the 8266.
But both ended up giving same output.

Also , I have tried all the baud rate, out of which 115200 baud between arduino and esp responded with less garbage ( above picture)

While I've had success programming the 32-bit 80MHz ARM core directly using the Arduino IDE and the ESP8266 add on SDK and utilizing the device as a standalone system without any other microcontroller, however I've not had much experience with the AT Command set firmware. I do know there are several versions of the AT Command set firmware, which have successively improved the serial interface connectivity.

What version of the firmware is currently loaded into the device?

You may want to consider upgrading the current firmware to the latest revision:

ESP8266 AT-command firmware

If I remember correctly, both CH_PD and GPIO0 should be pulled high for the device to boot the firmware loaded in flash, of course VCC and GND need to be properly connected as well.

ESP8266 Wiki

If both CH_PD and GPIO0 are not pulled high, the device enters its bootloader or flash mode which utilizes an uncommon baud rate, which might explain all the spurious characters you've been seeing. Also, when using a softUART like that of the Software Serial library of the Arduino, you should typically keep the baud rates low, 9600 or lower. Try properly configuring CH_PD and GPIO0 and connecting at 9600 baud.

BigDog
 

While I've had success programming the 32-bit 80MHz ARM core directly using the Arduino IDE and the ESP8266 add on SDK and utilizing the device as a standalone system without any other microcontroller, however I've not had much experience with the AT Command set firmware. I do know there are several versions of the AT Command set firmware, which have successively improved the serial interface connectivity.

What version of the firmware is currently loaded into the device?

You may want to consider upgrading the current firmware to the latest revision:

ESP8266 AT-command firmware

If I remember correctly, both CH_PD and GPIO0 should be pull high for the device to boot the firmware loaded in flash, of course VCC and GND need to be properly connected as well.

ESP8266 Wiki

If both CH_PD and GPIO0 are not pull high, the device enters its bootloader or flash mode which utilizes an uncommon baud rate, which might explain all the spurious characters you've been seeing. Also, when using a softUART like that of the Software Serial library of the Arduino, you should typically keep the baud rates low, 9600 or lower. Try properly configuring CH_PD and GPIO0 and connecting at 9600 baud.

BigDog

Hello,

I changed the baud rate and tied the GPIO0 pin to Vcc , but the interesting thing is, the esp didnt responded to AT command. But when I connected the GPIO0 pin to Vcc through a 10K Resistor,
its responds to AT command , with those unwanted characters...:-?


24qsu42[1].png
 
Last edited by a moderator:

Is there any chance that the firmware in one you got is not English?
 

Some modules reply with a baudrate of 76800 in boot mode so you can try this as well.
 

I changed the baud rate and tied the GPIO0 pin to Vcc , but the interesting thing is, the esp didnt responded to AT command. But when I connected the GPIO0 pin to Vcc through a 10K Resistor,
its responds to AT command , with those unwanted characters...:-?


View attachment 121221

After experimenting around with the same or similar ESP8266 modules and consulting with Alex, it appears the GPIO0 pin has an internal pull up resistor, so it may be left unconnected. However, it must not be pull low on power up or reset or the module will enter it's bootloader mode. Also, the CH_PD (chip enable) must be pulled high with a pull up resistor attached to Vcc and remain so, for normal module function. The first step to update the flash firmware is to pull down the GPIO0 pin by attaching it GND (ground) with a pull down resistor and then resetting the module by momentarily pull the RST pin to GND, which put the module into its bootloader mode/state.

After examining the screen capture you've posted above, it appears the module is loaded with the AI-Thinker AT Firmware v0.9.5.0 or v0.9.5.2, their latest release of firmware. As there are valid text intermixed with spurious characters, the current baud rate appears to be correct. The spurious characters lead me to suspect, the main issue you face at the moment is attempting to communicate with the module through a softUART, Arduino's Software Serial Library. I recommend first configuring the module for a lower baud rate, 9600 or less, utilizing a FT232R or similar USB to Serial bridge chip BOB (Breakout Board) or cable. You should be able to lower the baud rate to 9600 or less using the AT+CIOBAUD=9600 command.

Attempting to properly configure the module for a lower baud rate using a softUART at higher speeds might prove to be unreliable and may unintentionally configure the module with improper settings, therefore I would suggest utilizing the aforementioned BOB or cable. Also, if future firmware releases lead you to update the flash AT Command firmware to a later version, use of such a USB to Serial bridge BOB or cable is mandatory as the baud rate of the bootloader is set at 230,400 and interruption of the flashing process may produce unintended results.


BigDog
 

Hello,

I changed the baud rate and tied the GPIO0 pin to Vcc , but the interesting thing is, the esp didnt responded to AT command. But when I connected the GPIO0 pin to Vcc through a 10K Resistor,
its responds to AT command , with those unwanted characters...:-?

Do not connect any GPIO pins directly to ground or Vcc because you can damage the chip IO if they become outputs. Use a resistor at least 1K
 

Hello guys,

From the above link it seems like I am having an esp-01. My device look similar to an esp-01.
I have to make a correction,

Capture.PNG

The above output was produced at 115200 baud, not at 9600 baud. Sorry for my careless mistake.
As bigdogguru said, I have tried all the baud rate, but none ring the bell.

So, I disabled the Atmega chip by connecting the reset pin to ground. Then connected the Tx and Rx pin of the arduino to Tx and Rx pin of esp respectively, and its working fine.

xxcds.PNG

It worked with Atmega chip disabled. But I dont know how to make it work Atmega chip enabled.
The esp responded successfully at 115200 baud (ATmega disabled).

Need help guys.

Thank You
 

I suppose your AVR is using 5v supply while ESP8266 is 3V, you need a level translator for that because the ESP8266 Rx line can be damaged with 5V input.
What worked for me is to use a 1K resistor between the AVR Tx line and ESP Rx line and a direct connection between ESP Tx and AVR Rx.
 
I suppose your AVR is using 5v supply while ESP8266 is 3V, you need a level translator for that because the ESP8266 Rx line can be damaged with 5V input.
What worked for me is to use a 1K resistor between the AVR Tx line and ESP Rx line and a direct connection between ESP Tx and AVR Rx.

HI Alex,

I have used a voltatge divider across Arduino Tx pin and ESP Rx pin , its working but those wired characters are still out there.

The interesting thing is that its working fine with Arduino's serial chip (with Atmega disabled).
I think, the culprit may be softwareserial. Dont know what to do next??:bang::bang:

Do I have to opt for firmware update as its work with serial chip??
 

I had a few problems of my own using the divider while direct serial worked fine, that is why I suggested a single 1K resistor in the AVR to ESP line, give it a shot and see if it helps.
It may also be firmware related but since it works with direct uart I don't think that the firmware is the cause of the problem.
 

So, I disabled the Atmega chip by connecting the reset pin to ground. Then connected the Tx and Rx pin of the arduino to Tx and Rx pin of esp respectively, and its working fine.

View attachment 121253

It worked with Atmega chip disabled. But I dont know how to make it work Atmega chip enabled.
The esp responded successfully at 115200 baud (ATmega disabled).

As I previously indicated, the primary issue you face, is the Arduino Software Serial Library cannot reliably function at 115,200 baud, as the number of tasks which the AVR (ATmega) microcontroller is performing increases, so to will the number of communication errors. Unfortunately, softUARTs are often relatively processor intensive tasks as the require oversampling of the RX line several times that of the baud rate. For example, hardware UARTs typically oversample the RX line x16 times the baud rate, therefore a baud rate of 115,200, requires an oversampling rate of 1,843,200, while softUARTs typically oversample at a rate of x4 times the baud rate at the very least.

The reason communications become reliable when the AVR is disabled is simply, the Arduino essentially becomes a hardware USB to Serial Bridge BOB.

The solution is also relatively simply, while the AVR is disabled on the Arduino board, the ESP-01 is attached as previously indicated and communications have been established, issue the following command:

AT+CIOBAUD=9600

Communications will be broken at 115,200 baud, however they should be able to be reestablished at 9600 baud.

Once this has been confirmed, power down both the Arduino and ESP-01, enable the AVR, reconnect the ESP-01 to the softUART port pins, modify the Software Serial routines to initial the soft serial port to 9600 baud, rather than 115,200, compile and download the revised application code and then test those modifications.


BigDog
 

As I previously indicated, the primary issue you face, is the Arduino Software Serial Library cannot reliably function at 115,200 baud, as the number of tasks which the AVR (ATmega) microcontroller is performing increases, so to will the number of communication errors. Unfortunately, softUARTs are often relatively processor intensive tasks as the require oversampling of the RX line several times that of the baud rate. For example, hardware UARTs typically oversample the RX line x16 times the baud rate, therefore a baud rate of 115,200, requires an oversampling rate of 1,843,200, while softUARTs typically oversample at a rate of x4 times the baud rate at the very least.

The reason communications become reliable when the AVR is disabled is simply, the Arduino essentially becomes a hardware USB to Serial Bridge BOB.

The solution is also relatively simply, while the AVR is disabled on the Arduino board, the ESP-01 is attached as previously indicated and communications have been established, issue the following command:

AT+CIOBAUD=9600

Communications will be broken at 115,200 baud, however they should be able to be reestablished at 9600 baud.

Once this has been confirmed, power down both the Arduino and ESP-01, enable the AVR, reconnect the ESP-01 to the softUART port pins, modify the Software Serial routines to initial the soft serial port to 9600 baud, rather than 115,200, compile and download the revised application code and then test those modifications.


BigDog

Hi,

I completely agree with you. I have changed the baud rate to 9600. The output seems to be fine.

HFHFJ.PNG

But for commands that returns lengthy string, its not okay .

jhgkjg.PNG

I am thinking of upgrading my firmware to latest version.
 

I completely agree with you. I have changed the baud rate to 9600. The output seems to be fine.

View attachment 121346

The response from the AT+GMR command indicates you have the latest version of AI-Thinker AT Firmware already installed, v0.9.5.0.


But for commands that returns lengthy string, its not okay .

View attachment 121347

I am thinking of upgrading my firmware to latest version.

The miscellaneous and apparently random characters displayed just before the line with "Ai-Thinker Technology Co. Ltd." after the module has been reset (AT+RST) is absolutely normal and nothing to be concerned about. However, it does appear the softUART, Software Serial Library, is still having issues with sustained communications with relatively long data transfers.

The response from an AT+RST command with the same firmware revision, v0.9.5.0:

AT+RST


OK

ets Jan 8 2013,rst cause:4, boot mode:(3,0)

wdt reset
load 0x40100000, len 816, room 16
tail 0
chksum 0x8d
load 0x3ffe8000, len 788, room 8
tail 12
chksum 0xcf
ho 0 tail 12 room 4
load 0x3ffe8314, len 288, room 12
tail 4
chksum 0xcf
csum 0xcf

2nd boot version : 1.2
SPI Speed : 40MHz
SPI Mode : DIO
SPI Flash Size : 32Mbit
jump to run user1

r[18][02]Ž[1B]Ñ
Ai-Thinker Technology Co. Ltd.

ready

v0.9.5.0 - Is the latest version so there is no need at this time to update the firmware and that ESP8266 does not appear to be the issue.

You might try reducing the baud rate of the ESP8266 module further, from 9600 baud down to 4800 baud and make the appropriate changes to your Arduino code.

Another option is to replace the Arduino Uno and its ATmega328P with an AVR with two hardware UARTs, you can download the Arduino bootloader to essentially any AVR and develop code for it using the same Arduino IDE and compiler.

Or do away with the Arduino Uno all together and program the ESP8266 directly, after all it has more horsepower and flash storage than the AVR, the only thing the ESP-01 lacks is I/O.

There are ESP-12E modules available for only a few dollars each with five times the available I/O pins.


BigDog
 
The response from the AT+GMR command indicates you have the latest version of AI-Thinker AT Firmware already installed, v0.9.5.0.




The miscellaneous and apparently random characters displayed just before the line with "Ai-Thinker Technology Co. Ltd." after the module has been reset (AT+RST) is absolutely normal and nothing to be concerned about. However, it does appear the softUART, Software Serial Library, is still having issues with sustained communications with relatively long data transfers.

The response from an AT+RST command with the same firmware revision, v0.9.5.0:



v0.9.5.0 - Is the latest version so there is no need at this time to update the firmware and that ESP8266 does not appear to be the issue.

You might try reducing the baud rate of the ESP8266 module further, from 9600 baud down to 4800 baud and make the appropriate changes to your Arduino code.

Another option is to replace the Arduino Uno and its ATmega328P with an AVR with two hardware UARTs, you can download the Arduino bootloader to essentially any AVR and develop code for it using the same Arduino IDE and compiler.

Or do away with the Arduino Uno all together and program the ESP8266 directly, after all it has more horsepower and flash storage than the AVR, the only thing the ESP-01 lacks is I/O.

There are ESP-12E modules available for only a few dollars each with five times the available I/O pins.


BigDog

Hi..

Now everything is clear for me. I m going to further reduce the baud rate and going to do some serious coding. Will be back with a new problem :grin::grin:

Thanks mate
 
  • Like
Reactions: TF3fan

    TF3fan

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top