Skip to main content

Troubleshooting connections

To help you troubleshoot issues with your cellular connection, you can scan for available networks and cheeck the cellular network connection logs.

Scanning Cell networks

To connect using Cell, you can omit the operator code in cell.config.yaml and then the module will try to find an operator automatically. However, if you know the carrier code, you can ensure that you are connecting to the right network, connecting faster and more reliably. To find out the carrier code, you can use the Cell network scanner as in the following example:

using Meadow.Networking;
...

var cell = Device.NetworkAdapters.Primary<ICellNetworkAdapter>();

try
{
CellNetwork[] availableNetworks = cell.ScanForAvailableNetworks();

foreach (CellNetwork network in availableNetworks)
{
Console.WriteLine($"Network Status: {network.Status}, Operator Name: {network.Name}, Operator: {network.Operator}, Operator Code: {network.Code}, Mode: {network.Mode}");
}
}
catch (Exception ex)
{
Console.WriteLine("An error occurred: " + ex.Message);
}

Notes: Some modules, such as the BG95-M3, memorize the last network mode used and consider it during scanning. For example, if you previously connected to an NB-IoT network, the scanner may return only the available NB-IoT networks. If you want to view available CAT-M1 networks, begin by connecting to this network initially, allowing the module to set CAT-M1 as network mode. Afterward, follow the steps mentioned above to initiate the scanner successfully.

Getting Cellular network connection logs

The cellular network connection logs might be helpful for users' troubleshooting. This raw data often holds valuable clues to help pinpoint and fix errors or connectivity issues. The following example will show how to get the cellular module AT commands output:

using Meadow.Networking;
...

var cell = Device.NetworkAdapters.Primary<ICellNetworkAdapter>();

while (!cell.IsConnected)
{
await Task.Delay(10000);
Console.WriteLine($"Cell AT commands output: {cell.AtCmdsOutput}");
}