ESP-2432S028 reboots when running the following code

Here we can discuss about the problem found
Post Reply
User avatar
karlkloss
Posts: 79
Joined: Fri Aug 18, 2023 12:21 pm
Has thanked: 12 times
Been thanked: 9 times

ESP-2432S028 reboots when running the following code

Post by karlkloss »

I have a ESP-2432S028, flashed with Annex32 CAN 1.70.2 LFS.
It is in AP mode, and an Android phone is connected, where I edit the following code:

Code: [Local Link Removed for Guests]

PIN(35)= 0
PIN.MODE 35, OUTPUT

gui.init 20, black
txt = GUI.Textline(10,50,190,20, "Electronic Load", 2)
but = GUI.Button(20, 200, 100, 20, "OFF",2 )

gui.setevent but, TOUCH, buttonclick
gui.autorefresh 30, 1 
wait

buttonclick:
IF PIN(35) = 0 THEN
    PIN(35) = 1
    gui.settext but,"ON"
ELSE
    PIN(35) = 0
    gui.settext but,"OFF"	
END IF
return
When I run the code, the ESP32 reboots.
Is this a bug, or am I doing something wrong?
User avatar
PeterN
Posts: 576
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 270 times
Been thanked: 312 times
Contact:

Re: ESP-2432S028 reboots when running the following code

Post by PeterN »

This should not be a reason for a reboot ... but GPIO 35 is an input-only pin, as far as I know
User avatar
karlkloss
Posts: 79
Joined: Fri Aug 18, 2023 12:21 pm
Has thanked: 12 times
Been thanked: 9 times

Re: ESP-2432S028 reboots when running the following code

Post by karlkloss »

It is indeed an input.
But this wasn't the problem.
I noticed that I forgot the second " after OFF in line 7.
So instead of but = GUI.Button(20, 200, 100, 20, "OFF",2 ), it was
but = GUI.Button(20, 200, 100, 20, "OFF,2 ), so the rest of the code was part of the string.

Well, this should throw a syntax error, not reboot the board.

Nevertheless, I fixed it, and changed the GPIO to 16 (green LED), and now it runs, but doesn't react to a touch input.
I ran a touch.calib before, and it worked like it should, but no luck here.
Is there something missing?
User avatar
karlkloss
Posts: 79
Joined: Fri Aug 18, 2023 12:21 pm
Has thanked: 12 times
Been thanked: 9 times

Re: ESP-2432S028 reboots when running the following code

Post by karlkloss »

Ok, I fixed it. Just some typos caused by my phone's autocorrection.
Post Reply