Skip to content

in Adafruit_CircuitPython_ESP_ATcontrol AT+CWLAP Does not return OK #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mperino opened this issue Nov 17, 2021 · 1 comment
Closed

Comments

@mperino
Copy link
Contributor

mperino commented Nov 17, 2021

It looks like Adafruit_CircuitPython_ESP_ATcontrol expects that AT+CWLAP (aka esp.scan_APs() ) to return OK.

On Challenger 2040 (and I expect other ESP) it returns the string of AP's, but no OK. Because there is no "Special Case" for AT+CWLAP, it raises (raise OKError("No OK response to " + at_cmd)).

Here's the AT Debug (MAC and AP obscured with XX:
---> AT
<--- b'\r\nOK\r\n'
---> AT+GMR
<--- b'AT version:2.1.0.0-rc1(32ea726 - Jul 16 2020 02:34:17)\r\nSDK version:v3.3-2-gb6e861a7\r\ncompile time(0993e9e):Jul 16 2020 09:03:46\r\nBin versn.0kn\nO'
---> AT+GMR
<--- b'AT version:2.1.0.0-rc1(32ea726 - Jul 16 2020 02:34:17)\r\nSDK version:v3.3-2-gb6e861a7\r\ncompile time(0993e9e):Jul 16 2020 09:03:46\r\nBin versn.(kw\nK'
---> AT+GMR
<--- b'AT version:2.1.0.0-rc1(32ea726 - Jul 16 2020 02:34:17)\r\nSDK version:v3.3-2-gb6e861a7\r\ncompile time(0993e9e):Jul 16 2020 09:03:46\r\nBin verso.0kw\nO'
---> AT+CWMODE?
<--- b'+CWMODE:1\r\n\r\nOK\r\n'
---> AT+CWLAP
<--- b'+CWLAP:(3,"NSXX",-35,"XX:f4:c6:10:XX:XX",5)\r\n+CWLAP:(3,"DTV",-65,"02:6b:XX:ae:XX:XX",11)\r\n+CWLAP:(3,"uXX",-70,8a0::,)CP3"0ea::e,\r\n\n'
---> AT+CWLAP
<--- b'+CWLAP:(3,"NSXX",-34,"XX:f4:c6:10:XX:XX",5)\r\n+CWLAP:(3,"DTV",-64,"02:6b:XX:ae:XX:XX",11)\r\n+CWLAP:(3,"uXX",-70,"82cb"1+A("7780c:,)\n\r'
---> AT+CWLAP
<--- b'+CWLAP:(3,"NSXX",-34,"XX:f4:c6:10:XX:XX",5)\r\n+CWLAP:(3,"DTV",-64,"02:6b:XX:ae:XX:XX",11)\r\n+CWa1\rWP3,,ea:::")\r\r'
Failed to get data, retrying
No OK response to AT+CWLAP

@mperino
Copy link
Contributor Author

mperino commented Nov 29, 2021

Worked with Pontus and they found:

The default receive buffer (64 bytes) is not big enough to hold all the data coming from the onboard ESP. When large amounts of data are being sent, especially at high baud rates such as 115200 or higher, the circuitpython interpreter simply can't keep up with the data channel, and data gets overwritten/lost causing the python at-library to lose sync with the device.
The short term fix for this is to increase the default buffer receive buffer size to something that can hold a complete data packet in the buffer before your program can interpret the data.
This is done by revising the UART creation statement to include this. For instance: uart = busio.UART(TX, RX, baudrate=115200, receiver_buffer_size=2048) will increase the buffer size to 2048 bytes allowing receiving up to 2048 bytes of data before the buffer becoming overwritten.

I will add fixes to the examples with the workaround.

@mperino mperino closed this as completed Nov 29, 2021
mperino added a commit to mperino/Adafruit_CircuitPython_ESP_ATcontrol that referenced this issue Nov 29, 2021
mperino added a commit to mperino/Adafruit_CircuitPython_ESP_ATcontrol that referenced this issue Nov 29, 2021
Fixes for adafruit#48, added support for Challenger RP2040 Wifi
mperino added a commit to mperino/Adafruit_CircuitPython_ESP_ATcontrol that referenced this issue Nov 29, 2021
Fix for adafruit#48, added support for defining RGBW vs. RGB NEOPixels as a VAR, added flag for wether a display is attached, better output formatting.
ladyada added a commit that referenced this issue Nov 29, 2021
Fixes for "in Adafruit_CircuitPython_ESP_ATcontrol AT+CWLAP Does not return OK #48"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant