B4R Question ESP32 disconnecting in LOG window after : wifi.Connect(....

petr4ppc

Active Member
Licensed User
Dear friends,

please do you have some experience with this:

1) ESP32 is automatically diconnected from LOG window if I use code:
B4X:
If wifi.Connect("Mywifi") Then Log("Connected")
the same is happen with classic bluetooth
If I not use this code, then connecting to LOG (window B4R) is OK - stabile.

2) ESP32 is functioned only if is connected to USB port of my PC where I am doing tests in B4R

----this happen after my playing with SERIAL2 hardware serial port of ESP32---
before this playing the connection to LOG window was OK.

Is it possible to do some factory reset of my ESP32?
Best regards
p4ppc
 

petr4ppc

Active Member
Licensed User
Kmatle

I did few tests with connected atmega8 to esp32 And i had connected atmega8 via USB port And ESP 32(with uploaded code) was powered from same usb port via Pins: Vín And GND - i have used resistors between TX And RX of both procesors because of 3,3V ESP serial.

Now I am using ESP32 only with USB power via standard USB cable, 15cm long. I am trying only alone ESP32 connected to USB (b4R ide).

But I see disconnecting if comes the code:
B4X:
wifi.Connect("Mywifi")
After this I see that wifi of ESP32 is normaly functioned .... but I can not see LOGs because ESP32 is disconnected automaticaly from LOG tab

P4ppc
 
Last edited:

thetahsk

Active Member
Licensed User
Kmatle
...
P4ppc
The second hardware serial port is a bit tricky.
check your I/O Pins. You have to choose others than [16,17] and [9,10]

Serial2 defaults 16,17 used by PSDRAM
Serial1 default 9,10 used by FLASH

you can try e.g. Serial2.begin(9600,SERIAL_8N1,12,13), the serial pins are mappable.
 
Last edited:

petr4ppc

Active Member
Licensed User
Thetahsk

I am trying 16,17 and I am trying 1,3 - but nothing changed (this pins are on board with RX and TX sign described)
( I not see pins 9,10 as possible to use with in wroom board because i not see them in pinout - esp32 wroom 32 board)

I have tried change baud rate to 9600 - nothing changed

I think that something is changed inside ESP32 because the board is automaticaly disconnecting from LOG window -
it is possible that this serial port which is used for communication b4r is now enabled somewhere via pins and disabled for usb?
It is possible that this was happen programmaticaly?

Best regards
p4ppc
 

thetahsk

Active Member
Licensed User
Thetahsk

I am trying 16,17 and I am trying 1,3 - but nothing changed (this pins are on board with RX and TX sign described)
( I not see pins 9,10 as possible to use with in wroom board because i not see them in pinout - esp32 wroom 32 board)

I have tried change baud rate to 9600 - nothing changed

I think that something is changed inside ESP32 because the board is automaticaly disconnecting from LOG window -
it is possible that this serial port which is used for communication b4r is now enabled somewhere via pins and disabled for usb?
It is possible that this was happen programmaticaly?

Best regards
p4ppc
What sort of esp32 board do you have ?
 

petr4ppc

Active Member
Licensed User
I am looking for some other informations,
now I only know that I have the same lloking board as I sent on the image

 

petr4ppc

Active Member
Licensed User
Thetahsk,

thank you for sending this overview -
I am trying ports GPIO17,16 and GPIO1,3
 

janderkan

Active Member
Licensed User
I use this board.
Connected RX2/TX2 to a ultrasonic sensor.
Open access point to let users connect to server.
Use spi to communicate with Lora radio.
Logging when connected to usb.

Never seen your problems.
 

petr4ppc

Active Member
Licensed User
JANDERKAN,

1)
you are using which baudrate please?

2)
Do you have code with
B4X:
HardwareSerial Serial2(2); // Second Hardware Port
or without?

This is my fight:
B4X:
#if C
//HardwareSerial Serial2(2); // Second Hardware Port
void SerialNative2(B4R::Object* unused)
{
::Serial2.begin(9600); //115200
//::Serial2.begin(115200,SERIAL_8N1,16,17);
//::Serial2.begin(9600,SERIAL_8N1,16,17);
b4r_main::_serialnative2->wrappedStream = &::Serial2;
}
#End If
3)
I must use voltage shifter or I can connect atmega(5V) to this ESP32 board without resistors on Rx and Tx pins?


EDIT: Watch this tread if you want see an answer:
https://www.b4x.com/android/forum/threads/hardware-serial-on-esp32.97318/
 
Last edited:
Top