FONA3G breaks if I use it with another library/shield

Adafruit cellular platform - SMS and IoT over celluar

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
elaghouh
 
Posts: 4
Joined: Fri Jun 29, 2018 3:51 pm

FONA3G breaks if I use it with another library/shield

Post by elaghouh »

Hello,

I'm trying to use the SIM5320 to send sensor data to a database. I have been successful in connecting my SIM to the network and sending some random data to my database. Now I'm trying to froward sensor data.

When I follow the exact same code I did before to establish the connection using the Adafruit FONA library in the new sketch, the AT command does not return a response for some reason (No OK, no ERROR... just nothing). This is the function I'm using to send the data:

Code: Select all

void fonaSendHTTP() {
    int i=0;
    GETStr.toCharArray(GETStrArr,sizeof(GETStrArr));
    
    for(i=0;i<3 && !fona.sendCheckReply(F("AT+CHTTPSSTART"), F("OK"), 10000);i++);
    for(i=0;i<3 && !fona.sendCheckReply(F("AT+CHTTPSOPSE=\"api.thingspeak.com\",443,2"), F("OK") ,10000);i++);
    for(i=0;i<3 && !fona.sendCheckReply(F("AT+CHTTPSSEND=87"),F(">"), 10000);i++);
    for(i=0;i<3 && !fona.sendCheckReply(GETStrArr, F("OK"), 10000);i++);
    for(i=0;i<3 && !fona.sendCheckReply(F("AT+CHTTPSCLSE"),F("OK"),10000);i++);
}
The GETStr contains my GET request to the database with the value in it. The weird thing is that if I call this method in my setup(), it works. But if I call it in loop() it does not (even on the first run through). I ran into the same problem with the 3G shield using a different library with a LoRa shield stacked on top

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: FONA3G breaks if I use it with another library/shield

Post by adafruit_support_mike »

Try throwing some diagnostic Serial.print() statements into the function to make sure execution is happening the way you expect it to.

User avatar
elaghouh
 
Posts: 4
Joined: Fri Jun 29, 2018 3:51 pm

Re: FONA3G breaks if I use it with another library/shield

Post by elaghouh »

I did put some debugging lines in the code and in the library functions, and figured out that for some reason the command is being transmitted to the chip from the serial port but the acknowledgment is not being transmitted back to the serial port

User avatar
elaghouh
 
Posts: 4
Joined: Fri Jun 29, 2018 3:51 pm

Re: FONA3G breaks if I use it with another library/shield

Post by elaghouh »

Mike,

So I figured out that the problem was with the pin assignments. Now I am using different software serial pins and it is fine. However, it seems that when I'm using my LoRa shield to work with the SIM, initializing my FONA connection breaks the LoRa communication establish by the RadioHead library. Are there conflicts in the Adafruit_FONA library and the RadioHead library that might cause this to happen? It seems they are conflicting somewhere but I can't figure out where exactly.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: FONA3G breaks if I use it with another library/shield

Post by adafruit_support_mike »

It sounds like you have a pin conflict somewhere.

Post a photo showing your hardware and connections and we'll take a look. 800x600 images usually work best.

User avatar
elnahual
 
Posts: 6
Joined: Wed Nov 14, 2018 12:03 am

Re: FONA3G breaks if I use it with another library/shield

Post by elnahual »

Hello elaghouh,

I would appreciate if you can help.
It seems that you're several steps ahead and I really need help.

I need to connect FONA 3G to MySQL database and as far as I know, the connection has to be in two steps, one to make the connection and the second step to send user and password to authenticate.
I'm using the command
AT+CIPOPEN=0,\"TCP\",\"xxx.xxx.xxx.xxx\",3306
and with it I'm getting a "Connect OK" response but still need to send user and password but I'm stuck here.
I have tried several options but no one has succeeded.

I would appreciate your help.
Best regards.
JC

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

Return to “FONA”