0

Couldn't find FONA with Fonatest, SOLUTION and other solutio
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Couldn't find FONA with Fonatest, SOLUTION and other solutio

by bernard4_juggling on Fri Feb 12, 2021 1:08 pm

Hello,
I have an Arduino shield based on an SIM5320, and it works well.

Just a few technical remarks to improve the shield based on the SIM5320 using the FONA library.

1) When downloading the library FONA and the examples at :
https://www.tinyosshop.com/3g-gprs-gsm- ... o-sim5320e
In the examples, the values of :
#define FONA_RX 2
#define FONA_TX 3
are not correct, they should be :
#define FONA_RX 3
#define FONA_TX 2
for the module to work. The values are inverted.

2) It is not documented how to run the library without displaying Debug information in the Arduino monitor. If the value : ADAFRUIT_FONA_LIBRARY_SRC_INCLUDES_FONACONFIG_H_ is defined, then no debugging information is displayed, but it can not be defined in the user program. So I defined it in the library, which is not very convenient. Is there a better way to do ?

3) It is not documented how to start the SIM5320 automatically.
Add theses definitions :
#define FONA_POWER 8
#define FONA_POWER_ON_TIME 180 /* 180ms*/
#define FONA_POWER_OFF_TIME 1000 /* 1000ms*/

Put the following lines at the very beginning of the "setup()" function :
pinMode(FONA_POWER, OUTPUT);
digitalWrite(FONA_POWER, HIGH);
delay(FONA_POWER_ON_TIME);
digitalWrite(FONA_POWER, LOW);
delay(3000);
The SIM5320 will start automatically.

4) It should be documented that the pin 9 of the Arduino is used by the Shield to do a reset.
So it cannot be used in a project.

5) There is a tiny bug in the way the module is used in the examples.
The baud rate is defined at 4800 baud by default, which is very slow and causes tiny errors in the time returned by the function micros(), and also by millis().
The reason is that the Arduino generate though the timer counter TCNT0 an interrupt every millisecond (about 256 * 64 / ( 16 MHz) see :”Arduino/hardware/arduino/cores/arduino/wiring.c”).
In the library "SoftwareSerial.cpp, ligne 630, the function “write()” stop the interrupts while sending 8 bits, by calling the instruction cli().
Since communicating 8 bits at 4800 baud takes, 8 / 4800 = 1,67 milliseconds, one interrupt is lost when calling the function “write()”.
The solution is to increase the baud rate at 9600 or more by calling “fona.setBaudrate(9600);”.
It should be noticed that this baud rate will remain, even after a reset of power down.
I use a baud rate of 19200 and the “GSM shield documentation” recommends using a baud rate of 115200.

6) When deleting the SMS message number 0, the messages are not shifted. So the last message number is no more equal to the number of messages minus one, but is equal the number of messages. If deleting one more message, lets say the number 1, then the last message is equal the number of messages plus one.
And when a new SMS message comes, it is stored in the message number 0. It becomes complicate.
I don’t know how to deal with it. I either delete no message or all messages.

I hope this information can help to improve the shield based on the SIM5320. For me it works well and is very useful.

bernard4_juggling
 
Posts: 2
Joined: Fri Feb 12, 2021 12:47 pm

Please be positive and constructive with your questions and comments.


cron