Skip to content
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

ESP32 <-> ESP8266 softwarebitbang communication failure #407

Open
MArimont3 opened this issue Jan 31, 2022 · 5 comments
Open

ESP32 <-> ESP8266 softwarebitbang communication failure #407

MArimont3 opened this issue Jan 31, 2022 · 5 comments
Labels

Comments

@MArimont3
Copy link

Hi,
I did some first trials with this library with 2 Arduino Nano boards communicating to each other using the softwarebitbang strategy. the examples did run fine.

Then I moved to the environment I would like to use: an ESP32 (Espressif ESP32-WROOM) communicating to one or more ESP8266 (NodeMCU V3) boards. I did start with an ESP32 and a single ESP8266 board.
I used pin 12 on the ESP32 and pin 5 (D1) on the ESP8266, and pulled down the softwarebitbang data line with a 1M ohm resistor.

I tested with the NetworkAnalysis Transmitter and Receiver example sketches (under PJON/Arduino/local/SoftwareBitBang). Uncommented "SWBB_MODE 1" in both scripts. And adapted the pin numbers.
I made first the ESP32 the transmitter , and ESP8266 the receiver. Works fine. No fails nor busy's.
Then I switched both roles: made the ESP¨8266 the transmitter and the ESP32 the receiver (and of course adapted the pins in both scripts). Was not able to send a single packet: all return PJON_FAIL.

How to explain ? I understand that in the first configuration (ESP32 = transmitter , ESP8266 = receiver), "communication" goes in both directions as the ESP8266 has to "acknowledge" the reception of each package to the ESP32. Why is it then impossible to send something when switching the roles ?

I tried several other examples, and always was blocked at the same point. No issue to send something from the ESP32 to the ESP8266 (sent was acknowledged). But impossible to reply or send from the ESP8266 to the ESP32...

Any idea ?
Why is this protocol so device dependent ?
Why is it also so pin dependent (why does it only work on some very specific pins ? I can't find any special for these pins in the data sheets ?)

Thanks for any help (or experience)

@MArimont3
Copy link
Author

MArimont3 commented Jan 31, 2022

I also added the error_handling (see PJON doc) to both transmitter and receiver scripts. No errors are raised...
Both boards of course also share a common ground...
Also repeated all tests with pin 25 on ESP32, same results...

@SunboX
Copy link

SunboX commented Mar 18, 2022

Maybe the same issue I'm facing in issue #404 😕

@gioblu
Copy link
Owner

gioblu commented Mar 19, 2022

@SunboX @MArimont3 I think the problem was identified here #398 by @X-Ryl669

GPIO12 is a bit painful to use since if you have it pulled high (for whatever reason) while booting, the ESP32 will likely fail to boot (it's used to change the voltage of the flash chip from 3.3V to 1.8V).
It can be pulled high if the other side of the communication link is trying to communicate while the ESP32 is rebooting. In that case, the system will never resume in a working condition, unless manually reboot while GPIO12 is low.

When the ESP32 used as a receiver will likely fail to boot because the transmitter is pulling HIGH the GPIO12 while attempting to transmit a packet.

I think the solution is to use other pins to avoid this issue, this is probably easily solved with just testing.
Try other available pins (even if not in the list of compatible pins) and see if works.

If doesn't work I will need to recover my oscilloscope and my stuff (now more than 1k kilometers from where I am now) and make some tests :)

@gioblu gioblu added the bug label Mar 19, 2022
@SunboX
Copy link

SunboX commented Mar 24, 2022

@MArimont3 Can you please check if this timing config on the ESP32 (using pin 25) also works for you?

See timing config here: #404 (comment)

@alastaira
Copy link

It might be unrelated, but I came across this issue (and #404) while searching for solutions to a somewhat similar problem I'm facing with using PJON on ESP32, except I'm using the ESPNow strategy (after applying fix in #419). Using the "PingPongArduinoIDE" example, I can send from/to either of two ESP32 devices, but don't ever receive any packets from a reply sent in the receiver function.
Obviously ESPNow doesn't require a GPIO pin to be set high/low, but I'm wondering if there's some wider related timing/contention issue here affecting the ESP32 core?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants