ESP8266 AT+CWLAP gives generic ERROR message with no details - esp8266

I have been having trouble all day learning how to enable "AT" commands for the ESP8266 module. I'm using my Arduino Uno as a bridge to my ESP8266. So my pin connections are:
ESP8266 | Arduino
-----------------------
TX | TX
RX | RX
CH_PD | 3.3V (separate battery that has common ground with arduino)
VCC | 3.3V (separate battery that has common ground with arduino)
GND | GND
GPIO0 | GND
I initially had some success with an ESP8266 Flasher that someone shared here and he provides instructions here. Essentially I use an esp8266_flasher.exe to load a ESP8266_BIN0.92.bin into my ESP module. This worked so far as in when I load up my Arduino IDE Serial Monitor, I can type the command AT and get OK response, and I can type AT+GMR and get the firmware version number. But typing AT+CWLAP after any of AT+CWMODE=1,2,3,etc.. gave a generic ERROR response, with no other details.
Has anyone else had this issue and know how to resolve it?
EDIT
I also tried a second way to resolve my AT command issues as described here: ESP8266 No response in serial monitor from official AT firmware

I know this thread ist super old but I dealt with the same question.
That AT+CWLAP returns an error without any prior connection is desired behaviour. The doc states that AT+CWLAP "[c]onnect[s] an ESP station to a targeted AP with [the] last Wi-Fi configuration." Since there is no last Wi-Fi configuration an error is returned.
Moreover if you have characters like ,, " or \ in your SSID and/or password you do have to escape them (see here). The documentation has an example.
AT+CWMODE=1 is the correct mode if you want your esp to be a client only.

Related

UART communication in ESP-12E

I am using micro python in same board to start a serial communication
from machine import UART
uart = UART(1, 9600)
uart.init(9600, bits=8, parity=None, stop=1)
uart.write('abc')
and reading serial data using usb to serial converter which i plugged on pin 21 and 22. But that is not printing anything i checked with the help of termite.
and also uart.write('abc') prints 3 in python REPL.
Please point out my mistake.is it possible to read serial data using serial converter or not?
PS:I have read many forums but not found anything useful.
TIA
Unfortunately, I've never used esp-12E yet but referring to its document here I can see that UART1 has only TX, unlike UART0 (which has both TX and RX).
After some search, I found out that RX of UART1 is used to connect the flash chip, that's why UART1 is TX only, unlike UART0.
So editing your code to
UART(0,9600)
Should fix the error, hopefully.

ESP8266 flush program after power lost

I program my ESP8266 with a Arduino Uno and this guidance: Programming the ESP8266 With the Arduino IDE in 3 Simple Steps
Wifi connect, Mqtt connect (subscribe, publish, callback) everything works fine and totally like expected.
But after I disconnect the power from the Arduino Board and reconnect to a another V3.3 power source, the ESP8266 behavior is like a complete clean flushed device and nothing happens.
For programming I use this settings (Arduino IDE 1.8.12):
What I am doing wrong here?
EDIT
1.) I try two different ESP8266, and 3 different scretches (1. proved working in the past, 2. simple blink sketch, 3. sketch with my code I need)
2.) the program stops immediately after disconnecting CH_PD from 3.3V
3.) I update the esp8266 board package to the newest version 2.6.3
The main issue here is my bad documentation. After a long time, I found the solution again here: Easiest ESP8266 Tutorial (Using arduino). Like the first time two years ago. In conclusion, I forgot to disconnect GPIO0 from GND after programming.
The correct way after programming is:
disconnect arduino
disconnect gpio0 from gnd
connect power to esp8266
Thanks to LiveSparks creating and uploading this great video.

Why is Quectel BG96 stuck at trying to register the CS service?

I'm trying to get a BG96 up on to the Verizon network to do some MQTT communication.
The Quectel docs say to follow the TCP/IP AT command state machine before doing the MQTT commands. Makes sense to me.
I have an activated SIM card with an M2M data plan for this device, but it never seems to get past the second step, registering for CS service. It gives status of 2, "Not registered, but MT is currently trying to attach or searching an operator to register to." I checked the antenna and moved to a location closer to windows, but no luck.
at
OK
at+cpin?
+CPIN: READY
OK
at+creg?
+CREG: 0,2
OK
The same status is returned for the PS services, FWIW, but that's not surprising I think because the Quectel BG96 AT docs say you must register CS service first.
Any idea why a BG96 would be stuck at status 2 for at+creg??

I can not send program to ESP8266 module

Yesterday I got ESP8266, NodeMCU v2.0. I have a problem with module. I Use Esplorer IDE. I have simple code in LUA language.
gpio.mode(4,gpio.OUTPUT)
gpio.write(4,gpio.LOW)
wifi.setmode(wifi.STATION)
wifi.sta.config("Livebox-C408","7255E6262488CC90482CE6F264")
print(wifi.sta.getip())
When I send program to ESP8266, Esplorer shows below error.
stdin:2: '=' expected near 'a'
stdin:2: ')' expected (to close '(' at line 1) near 'TATION'
Sometimes(~10%) I can send above program to ESP8266 without problem. In my opinion, ESP8266 is damaged. What do you think about my problem?
Anticipating your questions, login and password to my home wi-fi are correct.
A few things:
There's no such thing as NodeMCU v2.0. What you probably mean is v2 or 1.0. v1 was revision 0.9. See my comparison for details.
Your code is doomed to "fail" because it doesn't consider the fact that wifi.sta.config() is asynchronous i.e. it won't block until an IP address was assigned. print(wifi.sta.getip()) will eventually print nil. We have an example for a better boot sequence in the docs.
Your device most likely is not damaged.
In the ESPlorer settings tinker with the turbo and dumb modes. I have "Turbo Mode" on and "Dumb Mode" off. Futhermore, set your baud rate to 115'200.
In case you haven't done so already I strongly suggest to upgrade your firmware to a recent version. See here how to build it.

Need help using Arduino R3 as serial-to-usb converter (to program something)

I have researched (and learnt quite a bit), but I have little experience in programming and only really understand basic sketches so far. I would like to use the Arduino R3 (more specifically, the usb to serial converter chip) to program a full-size hobby radio.
I have connected my radio to the Arduino appropriately (5V, Rx, Tx, Gnd) and put the Arduino into Tristate mode (apparently you have to do this..), but I seem to be lacking appropriate drivers. I basically want my Arduino R3 to function exactly like this: CP2102 . Please note that I am not being super cheap. To get something like that where I live would take at the very least a month. Some people also say that I should remove the Atmega chip. The ultimate goal is that I have a device, with drivers, on a com port and not just an "unknown device".
So, my questions are: leave the Atmega on, or remove it? and which drivers do I need?
Thanks!
EDIT: I found almost exactly what I need just after I posted. For some reason I couldn't get it to work, but maybe you could help me understand? Here's the link LINK If anyone is keen to help me out!
Just to make it clear: it has been done before, but I get the feeling people leave out things which they think are obvious, but to the not-yet-professional tinkerer like me aren't :/
Thanks so much!
It seems like the links you reference are for older Arduinos with an FTDI chip. The Arduino Uno doesn't use that. Here's a link for using the Uno
So! All of the older Arduinos (NG, Diecimila and Duemilanove) have
used an FTDI chip (the FT232RL) to convert the TTL serial from the
Arduino chip (Atmel ATmega). This allows for printable debugging,
connecting to software like PureData/Max, Processing, Python, etc.
etc. It also allows updating the firmware via the serial bootloader.
The good news about the FT232RL has royalty-free drivers and pretty
much just works. The bad news is that it can -only- act as a
USB/Serial port. It can't act like a keyboard, mouse, disk drive, MIDI
device, etc.
and
The Arduino Uno has a number of facilities for communicating with a
computer, another Arduino, or other microcontrollers. The ATmega328
provides UART TTL (5V) serial communication, which is available on
digital pins 0 (RX) and 1 (TX). An ATmega16U2 on the board channels
this serial communication over USB and appears as a virtual com port
to software on the computer. The '16U2 firmware uses the standard USB
COM drivers, and no external driver is needed. However, on Windows, a
.inf file is required. The Arduino software includes a serial monitor
which allows simple textual data to be sent to and from the Arduino
board. The RX and TX LEDs on the board will flash when data is being
transmitted via the USB-to-serial chip and USB connection to the
computer (but not for serial communication on pins 0 and 1).
Basically the LINK you provided, shows the user HACKING the Arduino. Using the USB/Serial(TTL) converter(what ever chip that is on your Arduino) to link to the Radio's Mini Din connector, in place of connecting to the Arduino's CPU.
As stated in other answer the Arduino uses a CHIP (of some flavor) to bridge the USB(Virtual Serial Port) to the Serial Port of the ATmega328 micro. These pins are available on the Shields connector 0(RX) and 1(TX). Hence you see the picture wiring those pins to the Radio's DIN connector.
Where I would expect in addition the RESET of the Arduino's CPU would be held to GND, this would force the pins into Hi. Simply with an extra wire jump the RESET pin to a GND.
It's working! Somewhere along the line the drivers for my arduino seem to have been deleted, so I reinstalled them, did what you said, and learnt something.
So to clarify for others: pretty much plug and play (as the link I posted suggests), but make sure to install the arduino drivers properly.
Thanks a lot for the help!

Resources