modelPartialMcuSettings
User parameters of a microcontroller (program, file system, execution time, debugging, electrical stages of the pins) - declared once, shared by the boards (MCU, RPi_Pico, MicroBit_v2) and their core Internal.Boards.McuCore
Information
Parameters set by the user on the boards (MCU, RPi_Pico, MicroBit_v2), with their dialog tabs. The boards and their core (Internal.Boards.McuCore, which extends this class too) share these declarations, so that the parameters are written only once.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Units.SI.Time | tickPeriod | 0.1 | Period of the minimal sync point (output freshness if the script never sleeps) |
| Python script | |||
| String | scriptPath | 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 | 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 | "" | 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 | false | Enable the file system (simulated flash) - disabled: open() and os raise OSError |
| String | fsSource | "" | 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 | "." | 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 | true | Open Windows Explorer on the copy at the end of the simulation |
| Execution time | |||
| Modelica.Units.SI.Time | gpioOpTime | 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 | 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 | 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 | 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 | Interfaces.VOL | Logic low voltage |
| Modelica.Units.SI.Voltage | VIH | Interfaces.VIH | Threshold above which an input reads high |
| Modelica.Units.SI.Voltage | VIL | Interfaces.VIL | Threshold below which an input reads low |
| Electrical › Output stages | |||
| Modelica.Units.SI.Resistance | ROut | Interfaces.ROut | Output series resistance (drive strength) |
| Electrical › Input stages | |||
| Modelica.Units.SI.Resistance | RPullUp | 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 | Interfaces.RPull | Internal pull-down resistor to GND, switched on by Pin(n, mode, Pin.PULL_DOWN) |
| Modelica.Units.SI.Conductance | GOff | Interfaces.GOff | Leakage of a pin that does not drive its line (input, released I2C line), towards GND: 1e-9 S = 1 GOhm |