ed_DialupConnectionStart problem


#1

Hi all
I begin to developp an FTP Appli and i have seen on other question that the basic steps are :

  1. register on the GPRS network (AT+CGATT=1)
  2. ed_DialupSetConfig
  3. ed_DialupConnectionStart
    4- set parameters of FTP and FTP get Filename
    5- Get fileme

But my pb is in “ed_DialupConnectionStart” that returns ED_ERR_NETWORK_KO although AT+CGATT=1 return OK

And with AT# Commands : AT#ConnectionStart return good result and The IP delivered by service provider

So have u idea about this, thanks


#2

Hi Malek,

the OK after AT+CGATT=1 doesn’t mean too much…

Did you also wait for +CGREG: 1 or +CGREG: 5? These are similar to the +CREG indications but used for GPRS. That means that you are registered on the network… When you do the ed_DialupConnectionStart() then, it should work without a problem…

Also, I don’t think ed_DialupSetConfig() is the right setup function for GPRS - you should use ed_GPRSSetConfig() instead.

Best Regards,
Jan


#3

Hi jan thanks
The best is to wait +CGREG as you said because i’ve tried to wait few seconds before "ed_DialupConnectionStart " and it work


#4

Hi, the steps you described work for me every time. You should wait for “OK” response from at+cgatt=1 before calling ed_DialupSetConfig(). Besides that, it should work…


#5

Hi sergiofernando,

interesting… Are you using GPRS or dialup?

If you are using GPRS I am curious: you don’t actually wait for the modem to be registered on the GPRS network (+CGREG…) and it does work to setup a connection? (It still could be that your network is so good that it registers very quickly…)

I think setting up the GPRS session should fail when you are not registered - just as setting up a call will fail when the modem is not (yet) registered in the GSM network (+CREG: 1 or 5).

Best Regards,
Jan


#6

Hi Malek,
I have had the same problem. I call “at+cgatt=1” using adl_atCmdCreate()
and then wait for the command to complete by waiting for the ADL_GPRS_EVENT_ME_ATTACH event (in a handler subscribed from adl_gprsSubscribe()). I then call ip_Connect() and get a -14 error.
Of course this works fine if I manually enter the “at+cgatt=1” command and then manually enter the “at+ipconnect=1,1” command.
I have found that if I have a 10s delay after receiving the ADL_GPRS_EVENT_ME_ATTACH event then the ip_Connect() works fine.

Jan, how do you wait for +CGREG: 1 or +CGREG: 5?

regards,
Charles


#7

Hi Charles,

you could do a

adl_atUnSoSubscribe( "+CGREG:", UnSo_CGREG_Handler );

at the beginning of the program, then you do other initialization including AT+CGATT=1 and your handler will be called with all +CGREG unsolicited messages.

In the handler function

bool UnSo_CGREG_Handler( adl_atUnsolicited_t *paras ) {
  ascii *rsp;

  rsp = (ascii *)adl_memGet( paras->StrLength );
  wm_strRemoveCRLF( rsp, paras->StrData, paras->StrLength );

  ...

  switch ( rsp[8] ) {
     case '1':
     case '5':
        ...
  }
}

you can start the gprs connection. You might also want to handle the cases ‘0’ and/or ‘2’…

Also, you should consider that your handler will also be called when the currently used cell changes. So you should make sure that if you already have an active connection, that you do not start the session again…

An other command that I found very helpful is AT+WGPRS=0,0. If you use this and reset the modem, it will automatically attach to the GPRS network after each reset, so you do not need to use the AT+CGATT=1 command at all. Very nice if you don’t mind to be attached at all times (if network coverage is there).

Best Regards,
Jan


#8

Thanks, Jan, I’ll give that a try.
regards,
Charles


#9

hi jan,

I´m opening a GPRS connection. Sice waiting for “OK” from at+cgatt=1 command worked for me every time i never worried about it. My guess was that registring on the network was encapsulated in the ed_GprsSetConfig() or ed_DialupConnectionStart() funtions. Here are the steps I follow to activate a GPRS connection:

  1. AT+CGATT
    2)wait for OK
    3)ed_GprsSetConfig()
    4)ed_DialupConnectionStart()

of course, since there is a delay between each of theese steps, there may be enough time for the modem to register on the net.

Best Regards,
Sérgio Chevtchenko


#10

How you can wait for the OK?


#11

Hi ybdragon,

I think you may have figured it out already… Anyway, here is the answer: Your handler function is called with “OK” - so you would put code that should be executed after the OK into the handler function…

Best Regards,
Jan