MOD pin is normally used to select the debug interface as explained in the Debugging tutorial. However, the MOD pin feature can be disabled and the debug interface can be forced to a specific interface.
The debug interface can be completely disabled for the managed application's IP Protection
The current debug interface can be determined as follows:
if (DeviceInformation.DebugInterface == DebugInterface.Usb) Debug.WriteLine("Debug is in USB mode");
The return results from
DeviceInformation.DebugInterface only states the current interface but it does not know if that is due to MOD pin being set in that mode or the interface was forced to that specific interface. The
DeviceInformation.IsModePinDisabled can be used to determine if MOD was used.
As an alternate option, users can change the debug interface using TinyCLR Config tool.
Once the debug interfaces changed or disabled, it may not be possible to communicate with the device anymore. However, changing or disabling the interface does not affect the bootloader. Users can always enter the bootloader, which will be in serial or USB depending on MOD pin. From there a
Erase All can be issues, manually or though the TinyCLR Config tool.
The Special Pin APP's feature can be disabled using:
DeviceInformation.AppPinDisable(); var appDisPin = DeviceInformation.IsAppPinDisabled();
TinyCLR Config tool can also be used to disable APP feature.
var deviceId = DeviceInformation.GetUniqueId();
Returns devices firmware
var major = (ushort)((DeviceInformation.Version >> 48) & 0xFFFF); var minor = (ushort)((DeviceInformation.Version >> 32) & 0xFFFF); var build = (ushort)((DeviceInformation.Version >> 16) & 0xFFFF); var revision = (ushort)((DeviceInformation.Version >> 0) & 0xFFFF); Debug.WriteLine(major +"."+ minor +"."+ build +"."+ revision);
Devices have a default name that they ship with. This can be read using
DeviceInformation.DeviceName. This name also shows on the USB debug interface. The name can changed only once through
DeviceInformation.SetPersistDeviceName("New Device Name"). Once set, a complete device erase is required before changing the name again.
Since Windows caches the name when loading the driver, Windows
Device Manager will still show the old name. Simply right-click on the device and uninstall the driver. The next time it installs the drivers it will update with the new name.