I have a USB modem connected to a windows 10 PC that has Node-RED installed along with the NCD package used to receive data.
I have noticed that whenever the PC power cycled, the USB modem will not connect in Node-RED. I used digi’s XCTU application to see if I could connect to the digi module directly, and it too has problem connecting in this situation. It goes through the typical “Reset in progress” for 20 seconds and then prompts to reset the device manually. Opening the front cover and pressing the red reset button does fix the issue and I can connect to the module via Node-RED and XTCU at that point, but this isn’t a long term solution for our deployment as we need this modem to work on PC power restoring as we rely on the data being collected at all times.
I have also tried reinstalling FTDI drivers and trying these settings as well: Optimizing USB to serial port settings | Digi International
Hi @duelingcats Do you get an error message in the Node-RED debug window when your PC is power cycled? If so, could you share a screenshot?
Thank you,
Eduardo M
It’s a little difficult at the moment to grab a screenshot since the PC is on another network, but I can tell you the gateway node shows Failed to Connect
underneath its node and the debug log has the following json:
{
"code": 1,
"description": "Wireless module did not respond"
}
As I mentioned earlier XTCU also is unable to connect which makes me think this is not a Node-RED issue, but rather something lower level like a driver/FTDI reset or something else.
Is the USB modem relying on the PC’s USB port for power? It has a 2.1mm Barrel connector where you can connect 12VDC. Could you try powering it from the 2.1mm barrel and see if this resolves the problem? It sounds like it could be power related so I just wanted to eliminate that as a possibility.
Also could you let us know after reboot and the Modem is not functional is the USB LED inside the Modem on solid? This indicates the modem is properly connected to the USB to Serial Driver on the PC.
@TravisE_NCD_Technica
I checked on the modem and it was connected to both the DC power barrel connector and the USB connection. The red LED is on solid.
Also could you let us know after reboot and the Modem is not functional is the USB LED inside the Modem on solid?
This was checked after a PC reboot and it is on solid.
Hi @duelingcats How do you restart Node-RED after a PC power cycled? Do you use a script or do you restart it manually by command prompt window?
I have a script that starts it. But I stopped the script and restarted Node-RED via command prompt as well as a test. Same result.
Got it, please, could you try to restart the Node-RED flows once your PC power cycled, to do this, once Node-RED started go to deploy button, click on down arrow icon and click on ‘Restart Flows’.
After doing this, you should see a warning message inside the debug window, and should restart the connection to the Wireless Gateway node.
Thank you,
Eduardo M
I have tried restarting the flow before as well as node-red. The problem still persists. Just to make sure I restarted the PC again and tried to start node-red and the flow again. Still the same problem.
Couple of additional things I have checked:
- Correct COM port selected
- COM port not in use
- Different baud rate
@Bhaskar in this case would it be better for the USB modem to be powered from the PC over USB rather than externally?
@duelingcats can you confirm in the device manager after reboot on the PC that the modem is still mounted as a virtual USB to Serial device? Should list a COM port number.
Yes usb will power the modem. No need for external power.
Does the modem show up in device manger.
@Bhaskar The modem does show up as a COM port in device manager as you can see in the following screenshot.

I have been experimenting with programmatic ways to reset the device using the FTDI api. I am using a C# library wrapper around their C library as I am far more skilled in C# than C. Unfortunately even when using some of their reset functions I still have not been able to get any sort of communication with the modem in Node-RED or XCTU.
Would it have anything to do with having both the USB and additional power supply connected? I’m just wondering if the device can enter some sort of strange state if it is powered before USB connection is established, but you would have a better idea on that than me.
Is there another programmatic way I can send a reset command from the FTDI chip to the Xbee via some sort of api/function call?
If it is any of help, here is the C# code I wrote to reset the device along with console output. I used FtdiSharp as the library to interface with that chip.
using System;
using System.Collections.Generic;
using System.Linq;
using FtdiSharp.FTD2XX;
namespace dotnetFTDIResetter
{
internal class Program
{
static void Main(string[] args)
{
FT_DEVICE_INFO_NODE[] possibleDevices = new FT_DEVICE_INFO_NODE[64]; //64 should be enough
FTDI ftdiDevice = new FTDI();
Console.WriteLine("Searching for FTDI devices...");
ftdiDevice.GetDeviceList(possibleDevices);
List<FT_DEVICE_INFO_NODE> devices = possibleDevices.Where(x => x != null).ToList();
Console.WriteLine($"{devices.Count()} devices found:");
Console.WriteLine("List in format of Device # - ID, Description, Serial");
if (devices.Any())
{
for (int i = 0; i < devices.Count; i++)
{
var device = devices[i];
Console.WriteLine($"Device # {i} - ID {device.ID}, {device.Description}, {device.SerialNumber}");
}
}
Console.Write("\nEnter device # to reset: ");
string stringOfDesiredDeviceNum = Console.ReadLine();
var deviceNum = Convert.ToInt32(stringOfDesiredDeviceNum);
string serialOfDevice = devices[deviceNum].SerialNumber;
ftdiDevice.OpenBySerialNumber(serialOfDevice);
Console.WriteLine($"Resetting device and port with serial {devices[deviceNum].SerialNumber}");
var deviceResetResult = ftdiDevice.ResetDevice();
Console.WriteLine($"Reset device result: {deviceResetResult.ToString()}");
var portResetResult = ftdiDevice.ResetPort();
Console.WriteLine($"Reset port result: {portResetResult.ToString()}");
Console.WriteLine($"Cycling port with with serial {devices[deviceNum].SerialNumber}");
var cycleResult = ftdiDevice.CyclePort();
Console.WriteLine($"Cycle port result: {cycleResult.ToString()}");
Console.WriteLine("Reset and cycle done.");
}
}
}
I would give powering the modem only over the USB connection a try. This would mean the modem would only be powered when the computer is running. There may be a strange issue with the USB driver on that particular computer and that may resolve it.
I have disconnected the modem from both power and USB and then reconnected by USB only. Currently Node-RED sees the gateway again as expected. I’ll keep monitoring it on occasion to see if it happens again.
1 Like
Sounds good. Keep us posted.