About GPRS packets!


#1

Now,i am designing a module that receives the GPRS packets from Control Center.I touch OpenAT just now ,so i am not familiar with it and i don’t have concept how to do it and how to receive packets.I need help!


#2

:frowning: Now ,i am so puzzled !
I am looking forward to your help.


#3

Hi,
To be able to receive GPRS packets, you have to use the FCM APIs. In Open-AT, the source of data (either from network or from V24 UART) is called a flow. FCM allows you to subscribe to a particular flow.
So, if you subscribe to FCM for GPRS, you will be able to receive data from GPRS.
However, before doing so, you need to connect your module to the GPRS network.
This can be done using the following steps:

  1. Attach to the GPRS network using adl_atCmdCreate () API and give AT+CGATT=1 command using this API.
  2. Activate the PDP context on which you will be receiving the data. You have to subscribe to GPRS services for it. Use adl_gprsSubscribe () API to do this (Please refer to ADL user guide). After subscribing to GPRS, set the PDP context parameters and activate the PDP context.
  3. When the PDP context is activated, you will receive a notification in the GPRS control handler. From here you subscribe to the FCM flow for GPRS.
  4. Now, whatever data is recevied from the GPRS flow will be received in your data handler for FCM. (i.e the callback function for FCM).
  5. Here you can manipulate the data.

Please refer to the ADL user guide for more information on how to use these APIs. You can refer to GPRS APIs, FCM APIs, AT command APIs to create your Open-AT application.

Best Regards,
Open AT Fan.


#4

hi,OpenAT_Fan
Firstly,thanks for your reply. After reading your reply,i refered to the API and have had a general idea about receiving GPRS packets.
But when i run the Ping_GPRS sample, the “ADL_GPRS_EVENT_ME_UNREG” returns in Target Monitoring Tool.According to the Documentation,the description about this Event is “the ME is not registered”,but i have subscribed to the GPRS Data services.So i have to turn to you again .
I want to know :before connecting to the GPRS networks,is it necessary to setup the IP address ,Gateway and Port?If it is necessary ,is it implemented with software by meself?

Best Regards


#5

Hi lijihao1983,
To execute the PING sample application, you need to first execute AT+CGATT=1 command. This command attaches your module to the GPRS network. Please note that attaching the module to the GPRS network is not the same as receiving an IP address.
AT+CGATT=1 command simply attaches you to GPRS. After GPRS attachment, you need to specify the Acess point name, username and password. The access point name specify a GGSN node in the GPRS network which will provide you the IP address.

In the PING sample, you need to give AT+GSET command to set the APN username and password.

When you execute this command, you will receive an IP.

Now you can give AT+PING command and send the ping requests.

Please note that in case, you are receiving +CME ERROR: 148 as a result of giving AT+CGATT=1 command, then contact your SIM provider and ask him to enable the GPRS services on your SIM. Also ask him/her to enable the internet access on your SIM Card.

Best Regards,
Open AT Fan.


#6

hi,again
I execute AT+CGATT=1 command,the response is OK.This shows that i have simply attached the GPRS network.Then i execute the Ping_GPRS,the same “ADL_GPRS_EVENT_ME_UNREG” still returns.
You tell me to give AT+GSET command,but when i execute this command ,“Error” always appears.I don’t make sense of AT+GSET command,which is the standard command or defined command by myself.It seems as if the module can not get APN automatically from the SIM card. The APN need to be setted?


#7

Hello lijihao,
Are you giving AT+CGATT=1 command and then starting your Open-AT application (either in debug mode or in target mode)?
If so, please note that when you start your Open-AT application, the module resets. Hence, if you give AT+CGATT=1 command before starting the Open-AT application, the previous attachment which is performed using AT+CGATT=1 command is lost and the module is not attached to the network.

Hence, the proper way to start this application is:

  1. Start the Ping_GPRS sample application (either in debug or target mode).
  2. Give AT+CGATT=1 command after your module registers to the PLMN. You can find this by giving AT+CREG=1 command and waiting for +CREG: 1 indication.
  3. Now, refer to the HTML help which is provided to you for the Ping_GPRS sample application. This help is available in samples/adl/ping_gprs directory (and has the name ping_gprs.html).
  4. Refering to this help file, you can see that AT+GSET is a custom command which is subscribed by this sample application and is not standard AT command. If you refer to help, you can see that AT+GSET is has the following format:
    AT+GSET = ,,
    For , and please contact the SIM provider.
  5. So, set the GPRS parameters using the above command.
  6. Also refer to the AT+PING command in the same help file (ping_gprs.html). This will tell you how to issue the ping requests.

"Please note that the Acess Point name (also called APN) specifies the GGSN to which your module contacts when it wants to activate a GPRS session and get an IP address. Your service provider gives you an APN and a corresponding “username” and “password”.
These values are to be given using AT+GSET command. Please note that the APN, username and password is not stored in the SIM card. The module uses this information to contact the correct GGSN and then receive the IP address.

If you have used AT+CGDCONT command then, please note that the access point name (APN) is the same that you specify in this command in the third parameter."

Hope this solves the problem.

Best Regards,
Open AT Fan.


#8

hi,OpenAT
I have made progress about this question. Thank you very much for your help!


#9

hi,OpenAT!
After attaching to the GPRS network,the Flow data that received from the GPRS are packets.I want to parse these packets and get the data from Remote Control Center.How can i do ?There are APIs about parsing packet in Open_AT library?

Best regards!

lijihao1983


#10

Hi,
Open-AT provides you a mechanism call FCM (Flow control manager) using which you send/receive data on a particular flow. This flow can be GSM/GPRS or V24 serial link flow. To use this service, you subscribe to FCM flow for a particular layer. For instance, if you subscribe for FCM flow for GPRS, then you can send/receive data on that flow.
Now, the GPRS flow can be used only when you activate your GPRS context over which you can send your data. For this you first need to attach to the GPRS network. This attachment is done by AT+CGATT=1 command.

After you attach, you need to set the APN parameters. These parameters specify an entity in the network (called GGSN) which will provide you access to the external networks (like internet). So, you need to set the APN parameters.
Open-AT provides you API called adl_gprsSetConfig () using which you can set the GPRS parameters. The Ping_GPRS sample uses AT+GSET command and internally uses adl_gprsSetConfig () API to set the APN and then activate the GPRS connection.

After the connection is up, you subscribe to FCM flow for GPRS. Now, you give a control handler and a data handler. THe control handler receives events pertaining to that flow and the data handler receives all the data that is received over that flow.

In the PING_GPRS sample, the data handler function is FCM_DataHandler. In the PING sample application, you can put traces in this function (FCM_DataHandler) to check what all packets are being received.

I hope, from here you can decipher that the data that is sent/received over the GPRS network is in the form of IP datagrams.

Best Regards,
Open AT Fan.


#11

I am doing the same thing but using WIP functions, so I think I cannot control the flow. The information comes to my buffer in several packets but the thing is that I cannot concatenate all these in just one final buffer, because wm_strcat(buffer, temp_buff) puts in my buffer the information of temp_buff AND all its garbage that exist from my malloc() function…

I searched in internet but all the trim functions I found are just for spaces, not for garbage…Any syggestions please?

Thanks in advance!