Skip to content

242 USB-Powered MCU Board ​

242-usb-powered-mcu-board.mc describes a power-only USB-powered MCU board. The USB connector is used for VBUS and ground; the example does not connect USB data pins and does not describe USB enumeration.

Functional blocks:

  • J_USB is a USB Micro-B connector used as a 5 V input.
  • F_USB is a resettable PTC fuse in series with VBUS.
  • D_VBUS clamps the protected 5 V rail to ground with its cathode on VBUS_5V and anode on GND.
  • U_LDO converts the protected 5 V rail to V3V3.
  • C_VBUS, C_LDO_IN, and C_LDO_OUT are input and regulator capacitors.
  • GENERIC_MCU, C_MCU, and R_RESET form the same small MCU core pattern as the minimal board.

The power path is:

text
J_USB.1 -> USB_VBUS_IN
USB_VBUS_IN -> F_USB -> VBUS_5V
VBUS_5V -> U_LDO.INPUT
U_LDO.OUTPUT -> V3V3
V3V3 -> U_MCU.VCC

J_USB.5, U_LDO.GND, the capacitors, the TVS anode, and U_MCU.GND all share the same GND net. RESET_N is pulled up to V3V3 and then connected to the MCU reset pin.

This recipe combines the USB power-input pattern from 20-power-recipes/202-usb-5v-input.mc, the LDO pattern from 20-power-recipes/203-ldo-5v-to-3v3.mc, and the MCU support pattern from 241-minimal-mcu-board.mc. The polarity-sensitive TVS connection follows the same orientation used in 02-circuits-with-branches/022-tvs-input-protection.mc.

Important omissions: USB data, USB-C configuration resistors, inrush-current limits, connector shield handling, regulator enable pins, thermal limits, exact capacitor ESR requirements, MCU boot pins, and real programming/debug signals are outside this example. The LDO instance records rated values and pins; MCode does not simulate regulation behavior.

Parse 242-usb-powered-mcu-board.mc:

bash
eval "$(../mcc/scripts/mcc-slot.sh)"
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 24-board-level-recipes/242-usb-powered-mcu-board.mc --lib mcode --pass1 --pass2

Generate HTML for 242-usb-powered-mcu-board.mc:

bash
eval "$(../mcc/scripts/mcc-slot.sh)"
MCC_SYSTEM_ROOT="$(cd .. && pwd)" "$MCC_BIN" --local parse 24-board-level-recipes/242-usb-powered-mcu-board.mc --lib mcode --viz -o 24-board-level-recipes/242-usb-powered-mcu-board.html

Source ​

text
// Example: USB-Powered MCU Board
// Goal: Build a power-only USB input, 3.3 V regulator, and generic MCU rail.
// Library focus: USB.SOCK_MICROB, FUSE.PTC, DIO.TVS, REG.LDO, CAP.MLCC.

component GENERIC_MCU
{
    name = "Generic MCU"
    pins = [
        psnk [1,2] = [VCC, GND]
        io 3 = RESET_N
    ]
}

use mcfam.power/reg.mc

module main
{
    io GND
    io RESET_N
    io USB_VBUS_IN
    io V3V3
    io VBUS_5V

    USB.SOCK_MICROB J_USB
    FUSE.PTC F_USB(0.5A, 6V, 1A)
    DIO.TVS D_VBUS(6V, 12V, 600W)
    REG.LDO U_LDO(3.3V, 0.3A, 5V, 0.3V)
    CAP.MLCC C_VBUS(10uF, 10V)
    CAP.MLCC C_LDO_IN(1uF, 10V)
    CAP.MLCC C_LDO_OUT(1uF, 6.3V)
    CAP.MLCC C_MCU(100nF, 10V)
    RES R_RESET(10000R, 50V)
    GENERIC_MCU U_MCU

    J_USB.1 -> USB_VBUS_IN
    USB_VBUS_IN -> F_USB -> VBUS_5V
    J_USB.5 -> GND

    VBUS_5V -> D_VBUS.K
    D_VBUS.A -> GND
    VBUS_5V -> C_VBUS -> GND

    VBUS_5V -> U_LDO.Vin
    U_LDO.GND -> GND
    U_LDO.Vout -> V3V3
    VBUS_5V -> C_LDO_IN -> GND
    V3V3 -> C_LDO_OUT -> GND

    V3V3 -> U_MCU.VCC
    U_MCU.GND -> GND
    V3V3 -> C_MCU -> GND

    V3V3 -> R_RESET -> RESET_N
    RESET_N -> U_MCU.RESET_N
}

MCode Bench is the public face of the MCode stack. Closed capabilities are served through the MCode gateway.