-
Notifications
You must be signed in to change notification settings - Fork 13
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
Unstable response from ESP #5
Comments
Hi, |
Hi! I have finally been able to hook my ESP up to a serial to see what is happening. This is the debug messages that is responded to me:
How can I figure out what is causing this? :-) Thank you, |
Hi, |
This is the result from the decode :-)
This seems to be cause by this code:
|
When reducing my sketch (SPI Master) to the bare minimum the debug sometimes yields this:
|
I am using the latest version 2.4.0 of ESP8266 Arduino using Board manager in Arduino if that is relevant. |
I must say I am confused. I hoped the trace would help us. |
I need to reproduce the error. I assume you loaded the sketch to the ESP8266 exactly as it was. |
Yes, this is the sketch i am using to test with. I had originally made everything ready in my complete application, but due to this errors I tried your example-sketch and just made some minor changes to it to test my functionality. I am using a generic STM32, STM32F103C8, and the ESP is an ESP-201. Morten
|
It is also wired so that the STM32 controls the CH_PD pin to reset the board. PB12 on my board. |
Thanks, I will try it soon on my "blue pill". I can test the ESP library only on ESP-12F but it should make no difference. Meanwhile, you could test the ESP side on freshly downloaded stuff from ESP8266-Arduino github project. I had an issue recently, although not related to our problems, and using the newest library solved it. |
Thank you, I will try that! Thought about it but my board manager said it was up to date! But I did not think about the git repo of course :-) |
My testing stops with the exception, too. I am using the newest ESP library now. |
Should I try a older version of the Arduino ESP lib? Its good to see that you have issues too as I was really looking forward to use your library as the ESP AT commands version is no good. |
Hi Morten, |
Fixed crash when comes an invalid message Removed some unnecessary debug printing from non-debug build
The problem was in another repo. |
Hi! That sounds promising! I hope you figure this out! Really looking forward to use your library! Tell me if there is anything i can do to help! Morten |
For STM32F1 I had to slow down the SPI. The default frequency was too fast and I got communication errors. The speed 1000000 is ok. The additional parameter for SPI speed setting added: fd38121 |
@m0rt3nlund In your code I'd rather first reset the ESP and then setup the communication (although your code runs fine). And finally, in commented out server part of your code you should copy the first string to the buffer instead of concatenating it.
Also note that reading the data from the ESP byte-by-byte is rather slow as there is a couple of roundtrips on SPI bus needed. I am going to tune the protocol in future but there are serious limitations on the ESP side. J. |
And thanks for testing on STM32 and finding a bug. |
i wrote spi code that runs at 30 and 60mhz spi bus between two cortexes, jiribilek, perhaps youll like the implementation i did, it uses circular buffer sending for slave responses to master, fire & forget, and callbacks at both master/slave for 2 way communication similar to uart behaviour |
@tonton81 , I think it is not a matter of discarding data but rather distorting. The protocol I use on top of SPI is master-slave (I know what you think about it :) ). |
Very nice work! Will test this first thing tomorrow! Thank you for your great effort! |
I used your sketch for testing and found another problem with the strings. The server part of the sketch should be
or you have to add +1 to strlen in order to copy the trailing '\0'. It's funny, yesterday it somehow worked :) |
Hi! I have finally been able to test this again! :) But I keep getting an exception like this one:
|
I am using this as my init now: WiFiSpi.init(PA4,1000000); |
Also, this:
|
Also, this: |
This is with the development branch of WifiSpi. |
Hm.. This may have been a wiring/noise problem.. I have now forced the reset-pin HIGH and IO01 HIGH and the board is much more stable.. Wiring is now as following: CHIP_EN - PB12 on STM Now I can request the webpage again and again with correct response.. However the response is very slow. Morten |
After running for a while I got this exception:
|
Hi, thanks for testing. |
I have the ESP powered by its own voltage regulator connected to USB power (Same USB as the STM) but can try to power it totally seperatly. I have edited the exceptions above with the full stack trace. |
|
Thanks, |
I have decoded the stack traces now, hope they help! :) |
This seems to be the most recurring one:
|
Meanwhile, I have good news for you. I hope to be seeing light at the end of the tunnel, at least. I slightly modified your sketch:
|
Looking forward to test! :) Great work! |
I assume the code above should be used with your next uncomitted version 0.1.3? :) |
Yes, check out the development branch for both projects. My recent changes are in espspi_proxy.h only. You can try it: ... Edit 10.3.18, 21:49 GMT+1: source file deleted, see next post for a updated one ... This runs fine. But it needs more testing. |
Posting espspi_proxy.h that passed my stress test (2000 http requests).
|
I have tested this now and it is much more stable. I am using this sketch now to time each step of the communication with the client since it takes from 100ms to 10seconds to get a response.
Sketch:
|
I also had to add a couple of lines at the start to keep the SS pin low during the beginning as my ESP was not behaving without it.. :-) |
I removed it during testing, in the post it is back. Edit: sorry, bad understanding. GPIO15 should have resistor to GND and uninitialized port should be in high impedance state. But it's good practice to set the pin explicitly to low state. |
I removed the "client.stop()" line from the code and now I have response-time < 200ms. Without the line it works very well! :) |
Been working great so far! :) Only issue is the delays between client request and getting a response, but this may be due to ESP-Arduino library maby? :) And maybe due to the "One-byte-at-a-time" transfer approach? :) |
Refer #9 (comment) |
Implemented new more robust protocol (48ea9f3). If you are interested, please try the new version. If the problems still persist, please open a new issue. |
Hi!
I have an ESP connected to my STM32 and I have two issues.
1: My ESP does not allways appear in my routers list of clients. The ESP reports back that has successfully connected to the AP but it is not reachable by its IP or in the routers clientlist.
Disconnect/Reconnect power to ESP usually makes it work again for some time/reconnects
2: This problem may be related to the above, but the server function «avaliable» does not return a client for most of the time when i try to Connect to the esp.
Also the few times i do get a connection the client data gets read very slow concidering this is a very fast spi connection? Couple of seconds for 100-200bytes.
Any ideas on where or how i can debug this?
Thank you,
Mortem
The text was updated successfully, but these errors were encountered: