0

since I started working with my modules esp8266 F-12, I have found some strange behaviors. When I started programming the module using the serial monitor I had no problem, but when I do it automatically like ``````

wifi.println("AT+CWMODE=3");
delay(1000);
while(wifi.available()){
    char car=wifi.read();
    String info+=car
}
Serial.println(info);

Then, the module runs without printing nothing, but sometimes it does what I want him to d'o, but some other times is not doing anything until I send the command via serial. Has someone some Idea? Thanks

19Miquel
  • 21
  • 5
  • did you wire RX to TX? – Juraj Jul 29 '20 at 16:42
  • @Juraj yes, the thing is that I'm doing this using ```wifi.println("the AT command")``` and then, sometimes, it doesn't respond. But when I try it using the serial monitor, it responses always (other problem is that sometimes it gives me `ERROR` because the RX TX transmission giver wrong characters to the module). Thanks – 19Miquel Jul 29 '20 at 18:39
  • you use SoftwareSerial at 115200 baud? it can't reliably receive at this speed. use 9600 baud. set it at both sides – Juraj Jul 29 '20 at 19:01
  • @Juraj so I put the ESP8266 and the Arduino to communicate at 9600 bauds. Do I need to change the transmission of the ESP8266 as well? Which AT command I should use to do that? – 19Miquel Jul 30 '20 at 13:40
  • AT+UART. see the AT commands reference – Juraj Jul 30 '20 at 16:47
  • @Juraj, if I change the baud rate, the module almost always changes his baud rate to 74880 bauds and stops responding to my commands. I will flash it again, but it's necessary to change the baud rate? – 19Miquel Jul 31 '20 at 08:03
  • 74880 is only the bootloader startup log baud rate. after AT firmware starts the baud rate is set by AT firmware – Juraj Jul 31 '20 at 08:23
  • @Juraj apparently it works fine, but I will do more tests to check if the problem is solved. Thanks – 19Miquel Jul 31 '20 at 13:56
  • @Juraj it's working perfectly. But one question, I'm using the Uart wifi pasought mode, and I can't get out of it. I have tryed usind ```wifi.print("+++");```, ```wifi.println("+++");```, ```wifi.write("+");wifi.write("+");wifi.write("+");``` but I don't know how to get out of this mode. Do you know something about it? – 19Miquel Jul 31 '20 at 17:05
  • reference for transparent mode says: " Enter transparent transmission, with a 20-ms interval between each packet, and a maximum of 2048 bytes per packet. When a single packet containing +++ is received, ESP8266 returns to normal command mode." so to detect +++ as a pseodo packet a 20 ms delay must be before it. – Juraj Aug 07 '20 at 13:55

1 Answers1

0

The AT-Command Set doc says "AT commands end with a new line (CR LF)".

Have you tried sending CR LF explicitly? wifi.write("+++\r\n");

Murray
  • 63
  • 7
  • I have just tried it and it literally sends to my other esp8266 +++, ```+IPD,0,5:+++``` – 19Miquel Aug 01 '20 at 10:32
  • my code had omething wrong and for this reason it didn't work fine. Now, after testing some days it worked using ```wifi.write("+++");```. Thanks a lot – 19Miquel Aug 02 '20 at 11:26