Adafruit feather RP2040 fails to communicate with fona 3g

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ada01
 
Posts: 2
Joined: Fri Dec 17, 2021 12:24 pm

Adafruit feather RP2040 fails to communicate with fona 3g

Post by ada01 »

Hello,

I am trying to communicate with a fona 3g from a feather RP2040 using UART in circuit python. I am using this page as a reference:
https://learn.adafruit.com/cellular-dat ... fona/usage

I have made the following connections similar to what is suggested:
Feather 3.3V to Fona3G Vio
Feather GND to FONA3G GND
Feather GND to FONA3G Key
Feather RX to FONA3G TX
Feather TX to FONA3G RX
Feather Digital 6 Pin to Fona3G RST

I have tried to use the same code in the link, changing the following line

Code: Select all

rst = digitalio.DigitalInOut(board.D4)
to

Code: Select all

rst = digitalio.DigitalInOut(board.D6)
The code seems to be dying at this line

Code: Select all

fona = FONA3G(uart, rst)
The following message is showing
RuntimeError: Unable to find FONA. Please check connections.
I have tried unsuccessfully to set a baud rate for UART by changing

Code: Select all

uart = busio.UART(board.TX, board.RX) 
to

Code: Select all

uart = busio.UART(board.TX, board.RX, baudrate=115200) #also tried 4800 and 9600
I have a fully charged battery and GSM antenna attached and a sim card inserted.

I have checked the connections multiple times. I verified that the feather pins being used are soldered properly by using them to light a led with a button as in the example in this link
https://learn.adafruit.com/adafruit-fea ... ital-input
The solder on the fona looks clean.

I am wondering if the failure to establish communication is due to a limitation in the feather RP2040 capabilities or whether I am doing something wrong.

Thanks for the help!

User avatar
ada01
 
Posts: 2
Joined: Fri Dec 17, 2021 12:24 pm

Re: Adafruit feather RP2040 fails to communicate with fona 3

Post by ada01 »

I was able to resolve the issue by modifying fona_3g.py. The __init__ function was forcing the baud rate to 4800, overriding the value of 115200 that I was setting in my code. I just commented out that line.

Code: Select all

    def __init__(self, uart, rst, ri=None, debug=False):
        # uart.baudrate = 4800
        super().__init__(uart, rst, ri, debug)
I also had to modify adafruit_fona_network.py to be compatible with fona_3g. I modified the function is_attached() as fona_3g returns status of gps and ue_system_info as bool not int.

Code: Select all

    @property
    def is_attached(self):
        """Returns if the modem is attached to the network."""
        if self._network_type == NET_GSM:
            # if self._iface.gps == 3 and self._iface.network_status == 1:
            if self._iface.gps and self._iface.network_status == 1:
                return True
        else:  # Attach CDMA network
            # if self._iface.ue_system_info == 1 and self._iface.network_status == 1:
            if self._iface.ue_system_info and self._iface.network_status == 1:
                return True
        return False
I know this might not be the best way to fix it but it works for my purposes.

The rest of the code worked well; however, it took a lot of time to load the information from the websites. It took 25 seconds to load the adafruit wifitest page and 46 seconds to load the coindesk BANNED price.

How can I identify the source of this delay? Is the fona_3g slow in getting this information or is the feather RP2040 slowing things down and needs an upgrade?

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”