B4R Question ESP32 strange behaviour? [solved]

KMatle

Expert
Licensed User
Longtime User
My new ESP32 dev. board with USB arrived today. It behaves strange:

- to connect to it, I have to press the "Boot" button (the ESP8266 just connected without pressing anything)
- only every 2nd start (power off -> power on OR EN-Key pressed) the app starts. Any ideas why that happens? Very strange.
 

thetahsk

Active Member
Licensed User
Longtime User
My new ESP32 dev. board with USB arrived today. It behaves strange:

- to connect to it, I have to press the "Boot" button (the ESP8266 just connected without pressing anything)
- only every 2nd start (power off -> power on OR EN-Key pressed) the app starts. Any ideas why that happens? Very strange.

What ESP Board did you bought ?
 
Last edited:
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Here's a thread about the issue: https://github.com/espressif/arduino-esp32/issues/1274

PIC:
esp32.JPG


As it seems 20-30% of all modules have this issue.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Forget about the "does not start at reboot". It starts but every 2nd time WiFi doesn't connect at the first try which caused my code to exit.

Logs:

B4X:
Hard resetting via RTS pin...
********************* Programm startet ****************
ets Jun  8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:10312
load:0x40080400,len:6460
entry 0x400806a4
*** B4R AppStart ***
Connecting to WiFi...
1
Failed to connect. -> First try
Connecting to WiFi... -> 2nd
2
Connected to wireless network.
My ip: 192.168.178.73

So I did a loop (max. 10 retries to connect) which works fine now (2nd try will work).

Code

B4X:
Private Sub AppStart
    
    Serial1.Initialize(115200)
    
    Log("*** B4R AppStart ***")
    
    For i=1 To 10
        Log("Connecting to WiFi...")
        Log(i)
        If wifi.Connect2("SSID","PW") Then 'change to your network SSID (use Connect2 if a password is required).
            Log("Connected to wireless network.")
            Log("My ip: ", wifi.LocalIp)
            pin16.Initialize(16, pin16.MODE_OUTPUT)
            pin16.DigitalWrite(True)
            pin2.Initialize(2, pin16.MODE_OUTPUT)
            pin2.DigitalWrite(True)
            Exit 'leave the FOR loop
        Else
            Log("Failed to connect.") 'try again after
        End If
    Next
   
    server.Initialize(51042, "server_NewConnection")
    server.Listen
    
    
End Sub
 
Upvote 0
Top