modelXIAO_rp2040
Extends from Internal.Boards.PartialUsbBoard (Common base of the boards supplied through USB (RPi_Pico, MicroBit_v2): the USB supply parameters are written here once - each board keeps its own supply chain (pins, components, wiring), whose placement and topology are board-specific).
Information
Replica of the Seeed Studio XIAO RP2040 standard board (not the XIAO RP2040 Plus): 21 x 17.8 mm, USB-C and 14 edge pads. The board contains the shared RP2040 programmable core, a 3.3 V regulator, its power LED and the active-low RGB user LED. The BOOT and RESET buttons are drawn but not simulated.
Pinout
The schematic and icon show both the XIAO pad names (D0...D10) and the RP2040 GPIO numbers. In a script, keep using the real GPIO identifiers: D0 = machine.Pin(26), D1 = Pin(27), D2 = Pin(28), D3 = Pin(29), D4 = Pin(6), D5 = Pin(7), D6 = Pin(0), D7 = Pin(1), D8 = Pin(2), D9 = Pin(4), D10 = Pin(3). D0-D3 are the four ADC inputs (ADC(0)...ADC(3)).
UART and I2C use the RP2040 rp2 pin multiplexing. For example, the default UART(0) uses GPIO0/GPIO1 (D6/D7), and I2C(1) uses SCL GPIO7/SDA GPIO6 (D5/D4). GPIOs not exposed on the standard XIAO are rejected, even though they exist in the RP2040 silicon.
Power
usbConnected (true by default) powers the 5 V input from USB-C. With USB disconnected, an external 5 V supply can be connected to V5. The averaged regulator supplies the RP2040, the pins and the V3V3 output at 3.3 V. This is a simplified electrical model, not a component-level replica of the regulator. Do not connect an external 5 V supply while the USB source is enabled.
One on-board RGB LED package is driven by GPIO17 (red), GPIO16 (green) and GPIO25 (blue); all three channels are active low, as on the board. The power LED is connected to the 3.3 V rail and lights when the board is powered. The core starts on power-up and stops permanently below VPowerOff; a restart after power loss is not simulated.
Display0 is the educational logical display link also found on the other boards; it is not a physical XIAO connector. See requirements.md, decision "Seeed Studio XIAO RP2040".
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.Time | tickPeriod (from PartialMcuSettings) | 0.1 | Period of the minimal sync point (output freshness if the script never sleeps) |
| Python script | |||
| String | scriptPath (from PartialMcuSettings) | Modelica.Utilities.Files.loadResource("modelica://MicroPythonMCU/Resources/Scripts/MCU/demo.py") | Path of the user script (.py) - with an active file system, run after boot.py instead of main.py; empty = main.py from the flash |
| Boolean | addScriptDirToPath (from PartialMcuSettings) | true | Make the .py files next to the script importable (e.g. import my_module) - mimics the real Pico (flash root folder on sys.path) |
| String | libraryPath (from PartialMcuSettings) | "" | Optional: a .py file from a shared library folder to make importable (the folder containing this file is added to the module search path) - leave empty if unused |
| File system › Simulated flash | |||
| Boolean | fsEnabled (from PartialMcuSettings) | false | Enable the file system (simulated flash) - disabled: open() and os raise OSError |
| String | fsSource (from PartialMcuSettings) | "" | Initial image of the flash (folder: data, boot.py, main.py, lib/), copied at each simulation and never modified - any file of the folder, the folder path or a modelica:// URI; empty = blank flash, only the script runs |
| String | fsWorkspace (from PartialMcuSettings) | "." | Workspace: folder where each simulation creates its copy, named <instance>_<FS name>_<date>_<time> (created if missing) - "." or relative path = from the simulation folder; full path of the copy shown in the log |
| Boolean | fsOpenExplorer (from PartialMcuSettings) | true | Open Windows Explorer on the copy at the end of the simulation |
| Execution time | |||
| Modelica.Units.SI.Time | gpioOpTime (from PartialMcuSettings) | 5e-6 | Execution time of a pin access (Pin.value(), on(), off()): two writes without sleep() give a pulse of this width (bit-banging) - order of magnitude of MicroPython on RP2040; 0 = instantaneous accesses |
| Modelica.Units.SI.Time | hangWarningTime (from PartialMcuSettings) | 10 | Real (wall-clock) time after which a warning is logged if the script does not let the simulation advance (loop without sleep() nor pin access, or with gpioOpTime = 0) - the simulation keeps waiting; 0 = no warning |
| Debugging | |||
| Boolean | debugEnabled (from PartialMcuSettings) | false | Debug the program with VS Code: at the start of the simulation, the microcontroller waits until VS Code attaches (debugpy, Run and Debug > attach to localhost:debugPort); simulated time stays frozen while the program is paused - one microcontroller per model |
| Integer | debugPort (from PartialMcuSettings) | 5678 | Local TCP port on which the debugger (debugpy) listens - the port of the VS Code attach configuration |
| Electrical › Logic levels | |||
| Modelica.Units.SI.Voltage | VOL (from PartialMcuSettings) | Interfaces.VOL | Logic low voltage |
| Modelica.Units.SI.Voltage | VIH (from PartialMcuSettings) | Interfaces.VIH | Threshold above which an input reads high |
| Modelica.Units.SI.Voltage | VIL (from PartialMcuSettings) | Interfaces.VIL | Threshold below which an input reads low |
| Electrical › Output stages | |||
| Modelica.Units.SI.Resistance | ROut (from PartialMcuSettings) | Interfaces.ROut | Output series resistance (drive strength) |
| Electrical › Input stages | |||
| Modelica.Units.SI.Resistance | RPullUp (from PartialMcuSettings) | Interfaces.RPull | Internal pull-up resistor to the supply, switched on by Pin(n, mode, Pin.PULL_UP) and by I2C() on SCL/SDA |
| Modelica.Units.SI.Resistance | RPullDown (from PartialMcuSettings) | Interfaces.RPull | Internal pull-down resistor to GND, switched on by Pin(n, mode, Pin.PULL_DOWN) |
| Modelica.Units.SI.Conductance | GOff (from PartialMcuSettings) | Interfaces.GOff | Leakage of a pin that does not drive its line (input, released I2C line), towards GND: 1e-9 S = 1 GOhm |
| Power supply › Consumption | |||
| Modelica.Units.SI.Current | ICore (from PartialBoard) | 0.02 | Current drawn from the supply rail by the core and its memory while supplied (program running, pins excluded) |
| Power supply › Power-on | |||
| Modelica.Units.SI.Voltage | VPowerOn (from PartialBoard) | 1.8 | Supply rail voltage above which the core starts (power-on reset) |
| Modelica.Units.SI.Voltage | VPowerOff (from PartialBoard) | 1.6 | Supply rail voltage below which a running core stops for good (brown-out) |
| Power supply › USB | |||
| Boolean | usbConnected (from PartialUsbBoard) | true | USB cable plugged in: 5 V through the USB connector (the board runs without any wiring) - false to supply the board through its supply pin |
| Modelica.Units.SI.Voltage | VUsb (from PartialUsbBoard) | 5 | Voltage of the USB supply |
| Modelica.Units.SI.Resistance | RUsb (from PartialUsbBoard) | 0.2 | Resistance of the USB cable and connector |
| Power supply › Regulator | |||
| Real | eta (from PartialUsbBoard) | 0.9 | Efficiency of the regulator |
| Power supply › Temperature sensor | |||
| Modelica.Units.NonSI.Temperature_degC | dieTemperature | 27 | RP2040 die temperature, read by machine.ADC(4) |
| Electrical › On-board LEDs | |||
| Modelica.Units.SI.Resistance | ledSeriesR | 330 | Series resistance of each active-low RGB LED channel |
| Modelica.Units.SI.Resistance | powerLedSeriesR | 1000 | Series resistance of the green power LED |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Electrical.Analog.Interfaces.PositivePin | D0 | XIAO D0, RP2040 GPIO26 (machine.Pin(26), ADC(0)) | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | D1 | XIAO D1, RP2040 GPIO27 (machine.Pin(27), ADC(1)) | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | D2 | XIAO D2, RP2040 GPIO28 (machine.Pin(28), ADC(2)) | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | D3 | XIAO D3, RP2040 GPIO29 (machine.Pin(29), ADC(3)) | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | D4 | XIAO D4, RP2040 GPIO6 (machine.Pin(6)) | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | D5 | XIAO D5, RP2040 GPIO7 (machine.Pin(7)) | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | D6 | XIAO D6, RP2040 GPIO0 (machine.Pin(0)) | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | V5 | 5 V USB-C input/output (do not drive externally while usbConnected is true) | |
| Modelica.Electrical.Analog.Interfaces.NegativePin | GND | Ground | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | V3V3 | 3.3 V regulated output for external circuits | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | D10 | XIAO D10, RP2040 GPIO3 (machine.Pin(3)) | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | D9 | XIAO D9, RP2040 GPIO4 (machine.Pin(4)) | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | D8 | XIAO D8, RP2040 GPIO2 (machine.Pin(2)) | |
| Modelica.Electrical.Analog.Interfaces.PositivePin | D7 | XIAO D7, RP2040 GPIO1 (machine.Pin(1)) | |
| Interfaces.DisplayLinkOutput | Display0 | Educational logical display link, not on the real board |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Internal.Boards.PartialMcuCore | core (from PartialBoard) | Programmable core, public like in the boards so that its plotted variables (powerGood, supplyOk...) stay in the simulation results - partial: every board redeclares it (McuCore); pin table (nPins, pinIds, pinCaps), board profile and on-board devices are set by the board in the modifier of its extends, pins in the order of pinIds | |
| Internal.Boards.Rt6150 | regulator | Averaged 5 V to 3.3 V buck-boost regulator | |
| Modelica.Electrical.Analog.Sources.ConstantVoltage | usbSupply | USB-C 5 V supply | |
| Modelica.Electrical.Analog.Basic.Resistor | usbCable | USB cable and connector resistance | |
| Modelica.Electrical.Analog.Basic.Resistor | powerLedResistor | Power LED current limiter | |
| MicroPythonMCU.Peripherals.LED | powerLed | On-board green power LED | |
| Internal.Boards.XiaoRgbLed | rgbLed | Single on-board RGB LED package | |
| Modelica.Units.SI.Voltage | vRail | V3V3.v - core.gnd.v | Regulated 3.3 V rail |
| Modelica.Units.SI.Voltage | vInput | V5.v - core.gnd.v | 5 V input rail |
| Modelica.Units.SI.Current | iInput | regulator.iIn | Current drawn by the regulator from the 5 V input |