#FONA Library Issues

1 messages · Page 1 of 1 (latest)

split badge
#

Heyho!

#

I bought a SIM5320E module (aka. the FONA3G) from adafruit and wanted to start using it. However, when trying to test the fona with the sketch from here: https://learn.adafruit.com/cellular-data-for-circuitpython-with-fona I was unable to get it started. I kept getting this error: RuntimeError: Unable to find FONA. Please check connections. So I did. Twice or Thrice. Still got the error. Then I tried this: ```python
import board
import busio
uart_passthrough = busio.UART(board.TX, board.RX, baudrate=115200, timeout=0.1)

uart_passthrough.write(b'AT+CSQ\r')

while True:
if uart_passthrough.in_waiting:
print(uart_passthrough.read())``` Which reports a 8.99 back to me. For me it's unclear what is causing the issue with the library provided by adafruit...

Adafruit Learning System

Add Cellular Connectivity to your CircuitPython Project

#

Anybody any ideas what's causing the issue?

split badge
#

To be exact I am using ```python

SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries

SPDX-License-Identifier: MIT

pylint: disable=unused-import

import time
import board
import busio
import digitalio
import adafruit_requests as requests
from adafruit_fona.adafruit_fona import FONA
from adafruit_fona.fona_3g import FONA3G
import adafruit_fona.adafruit_fona_network as network
import adafruit_fona.adafruit_fona_socket as cellular_socket

print("FONA Webclient Test")

TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
JSON_URL = "http://api.coindesk.com/v1/bpi/currentprice/USD.json"

Get GPRS details and more from a secrets.py file

try:
from secrets import secrets
except ImportError:
print("GPRS secrets are kept in secrets.py, please add them there!")
raise

Create a serial connection for the FONA connection

uart = busio.UART(board.TX, board.RX)
rst = digitalio.DigitalInOut(board.D2)

fona = FONA3G(uart, rst)

Initialize cellular data network

network = network.CELLULAR(
fona, (secrets["apn"], secrets["apn_username"], secrets["apn_password"])
)

while not network.is_attached:
print("Attaching to network...")
time.sleep(0.5)
print("Attached!")

while not network.is_connected:
print("Connecting to network...")
network.connect()
time.sleep(0.5)
print("Network Connected!")

print("My IP address is:", fona.local_ip)
print("IP lookup adafruit.com: %s" % fona.get_host_by_name("adafruit.com"))

Initialize a requests object with a socket and cellular interface

requests.set_socket(cellular_socket, fona)

fona._debug = True

print("Fetching text from", TEXT_URL)
r = requests.get(TEXT_URL)
print("-" * 40)
print(r.text)
print("-" * 40)
r.close()

print()
print("Fetching json from", JSON_URL)
r = requests.get(JSON_URL)
print("-" * 40)
print(r.json())
print("-" * 40)
r.close()

print("Done!")```

#

this script

#

and it outputs main.py output: FONA Webclient Test Traceback (most recent call last): File "main.py", line 32, in <module> File "adafruit_fona/fona_3g.py", line 61, in __init__ File "adafruit_fona/adafruit_fona.py", line 100, in __init__ RuntimeError: Unable to find FONA. Please check connections.

#

The FONAS green LED is lit up and the RED one is blinking slowly with about a second of on and of time i'd say

split badge
#

I additionally tested using the FONA class instead of FONA3G which gives me something along the lines of FONA 808 v1 not implemented

#

and if enabling the debug param in the FONA3G class, the sketch crashes with a Unicode Error instead of the unable to find FONA error