Obtain IP Address

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
KramDratta
 
Posts: 16
Joined: Wed Jan 17, 2018 2:17 pm

Obtain IP Address

Post by KramDratta »

Hi,

I have a FONA 3G (European) with a Vodafone SIM. I manage to connect to GPRS using the Fonatest sketch, as shown below, but I don't know how to open the connection and acquire an IP address.

Network is connected:
n
---> AT+CREG?
<--- +CREG: 0,1
Network status 1: Registered (home)

GPRS is enabled:
FONA> G
---> AT+CGATT=1
<--- OK
---> AT+CGSOCKCONT=1,"IP","connect"
<--- OK
---> AT+CGAUTH=1,1,"",""
<--- OK
---> AT+CIPMODE=1
<--- OK
---> AT+NETOPEN=,,1
<--- Network opened

Reading a website fails:
FONA> w
NOTE: in beta! Use small webpages to read!
URL to read (e.g. www.adafruit.com/testwifi/index.html):
http://www.adafruit.com/testwifi/index.html
****
---> AT+HTTPTERM
<--- ERROR
---> AT+HTTPINIT
<--- ERROR
Failed!

I noticed in another postthat after enabling GPRS an IP was requested and assigned:
---> AT+CGSOCKCONT=1,"IP","gprs.base.be"
<--- OK
---> AT+CGAUTH=1,1,"base","base"
<--- OK
---> AT+CIPMODE=1
<--- OK
---> AT+NETOPEN=,,1
<--- Network opened
---> AT+IPADDR
<--- +IPADDR: 10.26.29.248

What am I missing?

Thanks

User avatar
KramDratta
 
Posts: 16
Joined: Wed Jan 17, 2018 2:17 pm

Re: Obtain IP Address

Post by KramDratta »

Progress:

Located Adafruit_FONA.cpp and inserted the following line into the enable GPRS section @ line 1270:

sendCheckReply(F("AT+IPADDR"), ok_reply); //return the ip-address

Output now reads:
G
---> AT+CGATT=1
<--- OK
---> AT+CGSOCKCONT=1,"IP","connect"
<--- OK
---> AT+CIPMODE=1
<--- OK
---> AT+NETOPEN=,,1
<--- Network opened
---> AT+IPADDR
<--- +IPADDR: 10.32.25.130

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

Return to “FONA”