Hasty Briefsbeta

Bilingual

Hosting a WebSite on a Disposable Vape

a day ago
  • The author collects disposable vapes and discovered they contain a PUYA PY32 microcontroller (ARM Cortex-M0+).
  • The chip is a PY32F002B with 24 MHz Cortex M0+, 24 KiB flash, and 3 KiB RAM.
  • They used semihosting (debugger syscalls) and SLIP to emulate a modem over serial, enabling IP networking.
  • The setup involves pyOCD, socat, slattach, and a virtual TTY to create a network interface.
  • They ported the uIP TCP/IP stack and fixed memory alignment issues.
  • Initial performance was poor (20s page load), but after adding ring buffers, page load improved to ~160ms.
  • The web server uses about 20% of flash and 45% of RAM, leaving room for other tasks.
  • The server can run dynamic C code and includes a JSON API for request count and chip ID.