Other Parts Discussed in Thread: UCD90120A
Tool/software:
Dear experts,
We have multiple USB-TO-GPIO (2006) adapters connected to Windows 11 PC with Fusion Power Designer and APIs installed.
It was noticed that sometimes the communication freezes between the PMBus devices and the PC, which can be solved by power cycle and re-connecting the devices for the affected adapter. However, it is not feasible to perform this action manually in production setup, so a script is needed which could remotely issue a reset command to the adapter (similar to related question).
TL;DR
According to the User's Guide (p.27), this adapter supports reset functionality. The FUSION_USB_ADAPTER_API (TIDP.SAA2.dll) contains getReset(..) and setReset(..) methods in the SMBusAdapter class members - can the following simple code trigger a software reset for this adapter?
using System; using TIDP.SAA; class Program { static void Main(string[] args) { SMBusAdapter.Exceptions_On_Error = true; try { // Discover the available USB adapters Console.WriteLine("Discovering USB adapters..."); int adapterCount = SMBusAdapter.Discover(); if (adapterCount == 0) { Console.WriteLine("No USB adapters found."); return; } Console.WriteLine($"{adapterCount} USB adapter(s) found."); // Get only the first adapter for now. var adapter = SMBusAdapter.Adapters[0]; // Extra check if the adapter is attached - possibly redundant if (!adapter.Is_Attached) { Console.WriteLine("Adapter is not attached or disconnected."); return; } Console.WriteLine("Adapter is attached and ready."); // What does getReset return before we actually use setReset? Console.WriteLine("Getting adapter reset value..."); LogicLevel resetLevel = LogicLevel.Low; adapter.getReset(ref resetLevel); // To check what is actually returned here - No documentation on this. Console.WriteLine("Adapter reset level : " + resetLevel.ToString()); // Set the reset level to LogicLevel.High Console.WriteLine("Initiating adapter reset to LogicLevel.High..."); SAAStatus resetStatus = adapter.setReset(LogicLevel.High); // Assuming this triggers a USB function reset? No documentation on this. if (resetStatus == SAAStatus.Success) Console.WriteLine("Adapter reset initiated successfully."); else Console.WriteLine("Adapter reset failed."); // Check the reset level after the reset Console.WriteLine("Getting adapter reset value..."); adapter.getReset(ref resetLevel); Console.WriteLine("Adapter reset level : " + resetLevel.ToString()); } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}"); } } }
Or is there an already existing way to reset/restart these adapters via a Fusion GUI that I may have missed, which could handle multiple adapters connected to host PC?