Power-Off Reset: How to Unbrick the CH32V003 in a SOP-8 Package
I continue to explore CH32V microcontrollers. Today, I have the tiny CH32V003J4M6 in a SOP-8 package on my desk. This is the smallest package with a bare minimum of pins — 2 are for power, leaving 6 available for use. It doesn’t even have a hardware reset pin (NRST). Like other microcontrollers in the CH32V00x series, it is programmed via a single SWIO wire ( pin 8 ). And here lies an interesting problem: if you initialize this pin in your firmware for other tasks, it stops working as SWIO. After that, programming the chip using the standard method becomes impossible. For example, the following code prints “Hello world” to the UART: #include <ch32v00x.h> #include <debug.h> void NMI_Handler ( void ) __attribute__ (( interrupt ( "WCH-Interrupt-fast" ))); void HardFault_Handler ( void ) __attribute__ (( interrupt ( "WCH-Interrupt-fast" ))); int main ( void ) { SystemCoreClockUpdate (); Delay_Init (); USART_Printf_Init ( 96...