9 years, 10 months ago.

To Mihail Stoyanov

Hi Sir,

I am a student from Ngee Ann Polytechnic, Singapore. I am now currently doing my final year project. I have tried out the main.cpp that you wrote for Seeed_GPRS_Shield.

But I could not connect to network.

I printed the results out in the putty terminal and it printed as follow:

Could not connect to network. Retrying!

May I ask you a few things?

1. Is my connection right or wrong?

Mbed GPRS Shield

-VU to VIN

-GND to GND

-p9 to D0

-p10 to D1

2. May I kindly ask you that : Could I have a picture or a diagram of how you connect Mbed to Seeed GPRS Shield V2.0?

3. I put jumper caps to right since we use hardware serial port. Is it correct?(I inserted the images)

4. I do not insert the battery at the battery holder.

5.I used Starhub MaxMobile Prepaid Card. (https://www.starhub.com/business/support/internet-ip-solutions/faqs/prepaid-mobile-broadband.html)

I used main.cpp program the one that you wrote.

  1. include "mbed.h"
  1. include "GPRSInterface.h"

/ On many platforms USBTX/USBRX overlap with serial on D1/D0 pins and enabling the below will interrupt the communication.

  • You can use an LCD display to print the values or store them on an SD card etc.
  • /

Serial pc(USBTX, USBRX);

/**

  • D1 - TX pin (RX on the WiFi side)
  • D0 - RX pin (TX on the WiFi side)
  • 115200 - Baud rate
  • "apn" - APN name
  • "username" - APN username
  • "password" - APN passowrd
  • /

GPRSInterface eth(D1, D0, 115200, "shppd", "NULL", "NULL");

int main()

{

wait(3);

Initialize the interface.

If no param is passed to init() then DHCP will be used on connect()

int s = eth.init();

if (s != NULL) {

printf(">>> Could not initialise. Halting!\n");

exit(0);

}

printf(">>> Get IP address...\n");

while (1) {

s = eth.connect(); Connect to network

if (s == false || s < 0) {

printf(">>> Could not connect to network. Retrying!\n");

wait(3);

} else {

break;

}

}

printf(">>> Got IP address: %s\n", eth.getIPAddress());

Prepare the http request to mbed.org

char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n";

TCPSocketConnection sock;

sock.connect("mbed.org", 80);

sock.send_all(http_cmd, sizeof(http_cmd)-1);

printf(">>> Sent request to mbed.org\n");

Read the response

char buffer[300];

int ret;

while (true) {

ret = sock.receive(buffer, sizeof(buffer)-1);

if (ret <= 0)

break;

buffer[ret] = '\0';

printf(">>> Received %d chars from mbed.org:\n%s\n", ret, buffer);

}

sock.close();

Disconnect from network

eth.disconnect();

return 0;

}

May I kindly ask your help Sir?

I have sent you 4 pictures of the way i connect Mbed(NXP LPC1768) to Seeed Studio GPRS Shield v2.0 , the SIM Card that I use and the way I connect the jumper caps.

I am really looking forward to your reply Sir.

Thank you so much.

I really need your help.

Regards

Dorothy /media/uploads/DorothyLuai/1.jpg /media/uploads/DorothyLuai/2.jpg /media/uploads/DorothyLuai/3.jpg /media/uploads/DorothyLuai/4.jpg

1 Answer

-deleted-
9 years, 10 months ago.

Hi Dorothy,

To make a working example please do the following:

1. Connect the mbed as follows

  • VU to VIN
  • GND to GND
  • p9 to D1 (this is TX)
  • p10 to D0 (this is RX)

You should get a setup like this:

/media/uploads/screamer/20140614_005654_resize.jpg

2. Import the following program - http://mbed.org/teams/shields/code/Seeed_GPRS_Shield_GSM/. This example program will simply dial a phone number of your choice, thus you will have an actual feedback whether the whole setup works.

3. Once the program is imported make sure you change this in main.cpp:

main.cpp

GSM gsm(D1, D0, 19200, PHONE_NUMBER);

with

main.cpp

GSM gsm(p9, p10, 19200, PHONE_NUMBER);

Also don't forget to specify a phone number at the PHONE_NUMBER define. The number should be prefixed with 2 zeroes, then the country code and then the number. E.g. my UK number looks like "00447811xxxxxx".

Once the program has compiled successfully, save the binary onto the mbed flash drive, but don't reset it yet. First you need to turn on the GRPS shield radio by holding the button on the shield as I'm showing on this photo:

/media/uploads/screamer/20140614_005738_resize.jpg

After you hold it for 2-3 seconds a second LED will turn on on the shield.

4. Reset the mbed board and wait for 10-15 seconds. You should have an incoming call on the number you specified:

/media/uploads/screamer/20140614_010047_resize.jpg

5. Now that you have a working setup (considering you got the incoming call from the shield), you can use the same initialization params with p9/p10 pins as the code I quoted above for the GRPS data example - http://mbed.org/teams/shields/code/Seeed_GPRS_Shield/

Hope this helps :)

Cheers,
Mihail

Accepted Answer

Hi Sir,

Thank you so much for your superfast reply.

I really appreciate it Sir.

I will show you if I could get the result Sir.

Thank you so much for your big help Sir:D

Regards

Dorothy

posted by Dorothy Luai 16 Jun 2014

Hi Dorothy,

I've re-published the GSM library. Please re-import the program.

Cheers,
Mihail

posted by -deleted- 16 Jun 2014

Hi Sir,

Thank you so much for your big help:D

I really appreciate it.

Regards,

Dorothy

posted by Dorothy Luai 17 Jun 2014