Device Information
The DeviceInformation class exposes runtime details about the SITCore device and the firmware running on it — useful for diagnostics, telemetry, conditional firmware behavior, and locking down a production device's debug surface.
NuGet package: GHIElectronics.TinyCLR.Native (lives in the GHIElectronics.TinyCLR.Native namespace).
CPU usage
Returns CPU utilization as a percentage between 0 and 100. Sample at a steady interval so you can spot trends:
using GHIElectronics.TinyCLR.Native;
using System;
using System.Diagnostics;
using System.Threading;
var last = DateTime.Now;
while (true) {
Thread.Sleep(100);
if ((DateTime.Now - last).TotalMilliseconds >= 1000) {
var cpuUsage = DeviceInformation.GetCpuUsageStatistic();
Debug.WriteLine("CPU usage: " + cpuUsage + "%");
last = DateTime.Now;
}
}
Debug interface
By default, the MOD pin picks between USB and serial debug at startup (see Debugging). You can override the MOD pin and force a specific interface, or disable debug entirely.
DeviceInformation.SetDebugInterface(DebugInterface.Usb);
DeviceInformation.SetDebugInterface(DebugInterface.Serial);
DeviceInformation.SetDebugInterface(DebugInterface.Disable); // Used as part of IP Protection.
Read the active interface back:
if (DeviceInformation.DebugInterface == DebugInterface.Usb)
Debug.WriteLine("Debugging over USB");
DeviceInformation.DebugInterface tells you the active interface but not how it was selected. If you need to know whether the MOD pin or an explicit override is in effect, check DeviceInformation.IsModePinDisabled.
The same override is available in TinyCLR Config as a GUI alternative.
Once the debug interface is changed or disabled, you may not be able to communicate with the device anymore from Visual Studio. The Bootloader is unaffected — boot into it (MOD-pin-selected USB or serial) and issue Erase All to recover, or use TinyCLR Config to do the same.
See IP Protection for the full secure-deployment pattern that uses Disable to lock down production devices.
APP pin
The APP special pin is honored by default. Disable it (typically as part of an IP-protected deployment) with:
DeviceInformation.AppPinDisable();
var disabled = DeviceInformation.IsAppPinDisabled();
The same setting is available in TinyCLR Config.
Unique device ID
A factory-set ID unique to each chip — useful for identifying a specific device in telemetry, fleets, or licensing.
var deviceId = DeviceInformation.GetUniqueId();
Firmware version
Returns the firmware version encoded as a 64-bit integer (major / minor / build / revision, 16 bits each):
var v = DeviceInformation.Version;
var major = (ushort)((v >> 48) & 0xFFFF);
var minor = (ushort)((v >> 32) & 0xFFFF);
var build = (ushort)((v >> 16) & 0xFFFF);
var revision = (ushort)((v >> 0) & 0xFFFF);
Debug.WriteLine(major + "." + minor + "." + build + "." + revision);
Manufacturer name
Debug.WriteLine(DeviceInformation.ManufacturerName);
Device name
Each device ships with a default name (also shown over USB as the device name). It can be changed once with SetDeviceName(...); after that, a full device erase is required before changing it again.
DeviceInformation.SetDeviceName("MyCustomDevice");
Debug.WriteLine(DeviceInformation.DeviceName);
Windows caches the USB device name from the first time the driver loaded. To force Windows to pick up a renamed device, open Device Manager, right-click the device, and choose Uninstall device. The next plug-in reinstalls the driver with the new name.
API reference
| Namespace | Description |
|---|---|
| GHIElectronics.TinyCLR.Native | Device info, power, and low-level native access |