After connect - unable to detect usable serial port

Running a Raspberry pi 4, I’ll get an " [unable to detect usable serial port]" error AFTER I get notification of modem connecting to network.
This will happen after running the program successfully many times.
Then, after numerous restarts, everything starts working fine again.
Any clues what might be the problem?

Which type of Nova is this?

Model: SARA-R410M

Ah so the R410 only mounts a single serial port (unlike the U201 2G/3G which has multiple) so if you do hologram modem connect you can’t run any other serial commands until you disconnect.

But then why would it run the program perfectly fine for hours and then start throwing an error?

Here’s the program in question:

#!usr/bin/python3

import sys
import os
import datetime, requests
import random
import threading
import json
import time
import shutil
import piplates.THERMOplate as THERMO
import piplates.DAQC2plate as DAQC2
import DeviceClient

from Hologram.HologramCloud import HologramCloud
from Hologram.CustomCloud import CustomCloud

#Create Test message
data = {}
data[‘testdata’] = []
data[‘testdata’].append({
‘UnitName’: ‘Unit001’,
‘tc1’: 100,
‘tc2’: 110,
‘tc3’: 120
})

time.sleep(15)

#Configure Modem
credentials = {‘devicekey’: }
hologram = HologramCloud(credentials, network=‘cellular’)
result = hologram.network.connect(timeout=10)
if result == False:
print(‘Failed to connect to cell network’)
else:
print(‘Connected to Cell Network’)

START: Azure IoT Hub settings

KEY =
HUB = “SpiralXIoTHub”;
DEVICE_NAME = “testUnit01”;

END: Azure IoT Hub settings

device = DeviceClient.DeviceClient(HUB, DEVICE_NAME, KEY)
device.create_sas(600)

encode_weatherdata = json.dumps(data, indent=1).encode(‘utf-8’)

print(encode_weatherdata)

Device to Cloud

print(device.send(encode_weatherdata))

hologram.network.disconnect()

sys.exit()

Hey we just edited your post because you pasted your credentials in there. We’ll take a look in a minute.

So to illuminate what that error actually means, when trying to find if the modem is accessible we send a simple AT command to see if the serial port is listening.

if no serial ports return an OK then it considers no serial ports available. I can’t say why the serial port is busy due to your application but that is what is happening when you see that. I would make sure the modem isn’t being tied up by any other serial function, like a stray ppp session or anything else

How often do you send data? Is it possible that when that error is happening it’s because another script is running that hasn’t finished yet? If you get a failure, you might want to look for other python or ppp processes that are up and kill them.

I’m currently testing some stuff out so I’m only running the program periodically manually.
I’ve stripped a program down to bare minimum to test and still getting the error.
I have no program running on boot, and nothing in the background. I’ve even done a:
sudo hologram network disconnect before running the program.

Here’s what I’m testing with now:

#!usr/bin/python3

import sys
import os
import datetime
import random
import threading
import json
import time
import shutil

from Hologram.HologramCloud import HologramCloud
from Hologram.CustomCloud import CustomCloud

#Configure Modem
credentials = {‘devicekey’: ‘XXXXXXXXX’}
hologram = HologramCloud(credentials, network=‘cellular’)
result = hologram.network.connect(timeout=10)
if result == False:
print(‘Failed to connect to cell network’)
else:
print(‘Connected to Cell Network’)

#Create TestU message
messageU = ‘Test Message’

#Send to Cloud
if len(messageU) > 1:
sent = hologram.sendMessage(messageU,topics=[“Test”])
print('messageU Sent status: ’ + str(sent))
if sent == 48:
messageU = “”
print(‘Test sent to cloud’)

hologram.network.disconnect()
sys.exit()

Update…
I tried switching to a model SARA-U201 modem and after connecting to the network get an “Existing PPP sessions are established by pids” error.
Using the same program as above and running disconnect beforehand.

I think this related to an issue that is slated to be fixed in the next release of the SDK

Any hint as to when that might be going live?

Personally I would be fine releasing it now but we do have to do some QA on it. Part of it is we’d also like to update the documentation along with this release since we noticed some issue with inconsistencies in the documentation that needs to be fixed as well. The work around now is to install from the github repo which I’ve posted about in a few other threads but should be something like

sudo pip3 install -e git+https://github.com/hologram-io/hologram-python.git@develop#egg=hologram-python

Darn it.
Installed that update and still getting the error.

Its still complaining about existing PPP sessions? so you run sudo hologram network disconnect and then try to run the above script it says there are ppp sessions running?

That should be very unlikely since the disconnect function scans for all pppd processes and tells them to shutdown, even ones not started by the hologram sdk.

Yep, that’s what I do and still get the error.
At this point I’m thinking I got a weird glitch happening somewhere so I’m going to format a new SD card and get fresh installs and see what happens.
I’ll report back once I get that up and running.
In the meantime I really want to thank you guys for all the help in trying to work through this.
Much appreciated!

Update…
Starting off with a fresh barebones install modem appears to be working nominally again.
Now I start slowly installing the rest of the utilities I need and see when/if it breaks again.
If I come across anything noteworthy I will pass it on.
Thanks again for all the help. Great support!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.