ESP32 w/HardwareSerial -- Couldn't find FONA [solved]

Adafruit cellular platform - SMS and IoT over celluar

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
hevnsnt
 
Posts: 7
Joined: Sat Jul 12, 2014 9:44 pm

ESP32 w/HardwareSerial -- Couldn't find FONA [solved]

Post by hevnsnt »

Hello, I am trying to connect my Sparkfun ESP23 Thing to my Adafruit FONA - Mini Cellular GSM Breakout uFL Version (PRODUCT ID: 1946) and I am having some difficulties, and I am hoping someone can help me figure it out.

I have connected my Fona to my ESP as follows:
VIO ---> 3V3
GND ---> GND
RST ---> Pin 4 (GPIO4)
TX ---> Pin 16 (U2_RXD)
RX ---> Pin 17 (U2_TXD)
Key ---> GND

Image

One of the difficulties is that the ESP32 doesnt fully support SoftwareSerial, but that is ok because there are Hardware Serial on the board (right?). I have made the necessary changes in the 'FONAtest' sketch, changing the pins to be correct and commenting out the software serial section and uncommenting the hardware serial.


THE SOLUTION:

FONA DEVS: I get compile errors with your hardware serial code:

Code: Select all

HardwareSerial *fonaSerial = &Serial1;
And found this fix (https://github.com/espressif/arduino-esp32/issues/426) when googling to see if I could find the solution.

Code: Select all

//HardwareSerial *fonaSerial = &Serial1;
HardwareSerial *fonaSerial = new HardwareSerial(2);
Here is the code that I am using:

Code: Select all

/*
THIS CODE IS STILL IN PROGRESS!

Open up the serial console on the Arduino at 115200 baud to interact with FONA

Note that if you need to set a GPRS APN, username, and password scroll down to
the commented section below at the end of the setup() function.
*/
#include "Adafruit_FONA.h"

#define FONA_RX 17
#define FONA_TX 16
#define FONA_RST 4

// this is a large buffer for replies
char replybuffer[255];

// We default to using software serial. If you want to use hardware serial
// (because softserial isnt supported) comment out the following three lines 
// and uncomment the HardwareSerial line
//#include <SoftwareSerial.h>
//SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
//SoftwareSerial *fonaSerial = &fonaSS;

// Hardware serial is also possible!
//  HardwareSerial *fonaSerial = &Serial1;
HardwareSerial *fonaSerial = new HardwareSerial(2);

// Use this for FONA 800 and 808s
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);
// Use this one for FONA 3G
//Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);
(No other changes to FONAtest, so I stopped the paste here, but I am uploading full code to ESP32)
Last edited by hevnsnt on Mon Jul 17, 2017 11:22 am, edited 3 times in total.

hevnsnt
 
Posts: 7
Joined: Sat Jul 12, 2014 9:44 pm

Re: ESP32 w/HardwareSerial -- Couldn't find FONA

Post by hevnsnt »

I have updated my post with the solution above

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

Return to “FONA”