Skip to main content

How a Single `while(1)` Bricked My ESP32-S3 — and What I Learned Fixing It

    This is a custom ESP32S3 prototyping board i built to troubleshoot the issues.  It Started With a Simple Problem I was testing the EvilCrow Cable Wind — a USB HID device built around the ESP32-S3 that executes keystroke injection payloads over WiFi. Everything seemed fine: the keyboard HID was typing correctly, the web interface loaded, basic commands like RunWin worked. But ServerConnect and ShellWin did absolutely nothing. No error. No feedback. Just silence. Digging Into the Code The first thing I found was this pattern — repeated across four commands: ORIGINAL — DANGEROUS if (!clientServer.connect(serverIP, serverPort)) { while(1); // hangs forever if TCP fails } ⚠ Critical Bug If TCP connection failed for any reason, the device entered an infinite loop with no timeout, no error output, and no recovery path. Ever. But there was more. The bugs were stacking: critical   TCP failures were environmental: listener ...

SIM900A TCP connection test - 1

I have been working on some real time data acquisition and control application designing. Specially micro-controller based hardware designing and prototyping.
For testing purposes i am using SIM900A GSM/GPRS module and FTDI UART converter. 

SIM900A module is connected to PC via FTDI converter. I use putty as a terminal program to communicate with the module. With required baud rates i am able to communicate with the module by sending a simple AT command (AT command set will vary with different modules) just sending AT the module replies with OK. This means module responded to the command sent from PC. Lets go ahead with TCP AT commands to establish a TCP connection to remote server via GPRS connection.


I have run socket test software on remote PC and opened port 7777. You have to check your firewall or router settings to allow your preferred port. While the software start listening to port 7777, lets continue with the sending AT commands to module from the PC connected to module.

After power up the module please wait for a while to give time to connect to GSM network from module and after few seconds lets proceed with TCP.

I have send these few commands manually from the PC which the module is connected.

AT+CIPMUX=0
AT+CIPMODE=0
AT+CGATT?
AT+CSTT="APN of pixelatedpic"
AT+CIICR
AT+CIFSR
AT+CIPSTART="TCP","remote pc/server IP ","your preferred port"
AT+CIPSEND=20 
your data to send and hit ENTER


Here is the data sent between module and sever via GPRS internet. The data transmission of both directions is successful. Next is try to send the AT commands from Arduino instead of doing manually.

I love to see more comments from the viewers.
stay tune for part 2.

Comments