Moving from Oasis 2.02/WIP 4 to 2.12/WIP 5

Hi All,

I’ve run into an odd (and annoying!) issue when moving my GPRS code from Oasis 2.02 to Oasis 2.12, and was wondering if anyone else has seen the same issue.

Code (see below), is based on the sample app provided in the WIP sample directory. Basically, I do the following:

Wait for SIM to become ready
Wait for network connection (AT+CREG?)
Establish the GPRS connection as follows:
wip_netInit()
wip_bearerOpen(…)
wip_bearerSetOpts(…)
wip_bearerStart(…)
adl_gprsSubscribe(…)

At this point using Oasis 2.02 & WIP 4, all is well, and I can start HTTP and other socket transfers as desired.
This same code using Oasis 2.12 & WIP 5 fails with bearerStart returning -26 - which indicates invalid parameters.

I’ve been through the WIP 5 API doco and the new samples and can’t see what has changed between Wip 4 & WIP 5 for this sequence.
When changing versions, I’ve made a new copy of my project into a clean directory so that old libraries & header files weren’t hanging around.
This occurs for me on both a Q2686H & Q2686G, running R72a firmware.

Has anybody else seen this?

My Code:

wip_bearer_t myGprsBearer;          // GPRS Bearer variable

void gprs_establishConnection( void )
{
    s16 result;
    
    wip_debugSetPort(WIP_NET_DEBUG_PORT_UART1);
    
    // Initialize TCP/IP stack
    if ((result = wip_netInit()) != 0)
    {
        TRACE (( MAIN_TRACE_GPRS, "(gprs_establishConnection) wip_netInit failed with result %d", result ));
        wip_debug( "(gprs_establishConnection) wip_netInit failed with result %d\r\n", result );
        while(1);                      // eternal loop to force watchdog timeout
    }

    TRACE (( MAIN_TRACE_GPRS, "(gprs_establishConnection) wip_netInit OK" ));
    wip_debug( "(gprs_establishConnection) wip_netInit OK\r\n" );

 //   result = wip_netInitOpts(WIP_NET_OPT_DEBUG_PORT, WIP_NET_DEBUG_PORT_UART1, WIP_NET_OPT_END )) != 0)

    
    // open GPRS bearer & set event handler
    if ((result = wip_bearerOpen( &myGprsBearer, "GPRS", gprs_bearerHandler, NULL)))
    {
        TRACE (( MAIN_TRACE_GPRS, "(gprs_establishConnection) Bearer open failed, returns %d", result ));
        wip_debug( "(gprs_establishConnection) Bearer open failed, returns %d\r\n", result );
        while (1);
    }
    TRACE (( MAIN_TRACE_GPRS, "(gprs_establishConnection) Bearer open OK. Handle = %d", myGprsBearer ));
    wip_debug( "(gprs_establishConnection) Bearer open OK.\r\n" );
    
    // configure GPRS bearer options
    // TODO: APN etc has to come out of configuration data
    
    result = wip_bearerSetOpts( myGprsBearer,
                                WIP_BOPT_GPRS_APN, "telstra.internet",
                                WIP_BOPT_LOGIN, "fred",    // telstra don't require username/password but will accept dummy
                                WIP_BOPT_PASSWORD, "nurk",
                                WIP_BOPT_END
                              );
    if (result)
    {
        TRACE (( MAIN_TRACE_GPRS, "(gprs_establishConnection) Bearer set options failed, returns %d", result ));
        wip_debug( "(gprs_establishConnection) Bearer set options failed, returns %d\r\n", result );
        wip_bearerClose( myGprsBearer );
        while (1);
    }

    TRACE (( MAIN_TRACE_GPRS, "(gprs_establishConnection) Bearer set options OK. Handle = %d", myGprsBearer ));
    wip_debug( "(gprs_establishConnection) Bearer set options OK.\r\n" );
    
    // start bearer
    result = wip_bearerStart( myGprsBearer );
    if ((result != WIP_BERR_OK_INPROGRESS) && (result != 0 ))
    {
        TRACE (( MAIN_TRACE_GPRS, "(gprs_establishConnection) Bearer start failed, returns %d", result ));
        wip_debug( "(gprs_establishConnection) Bearer start failed, returns %d\r\n", result );
        wip_bearerClose( myGprsBearer );
        while (1);
    }

    TRACE (( MAIN_TRACE_GPRS, "(gprs_establishConnection) Bearer start OK. Handle = %d", myGprsBearer ));
    wip_debug( "(gprs_establishConnection) Bearer start OK.\r\n" );

    // subscribe to event handler to handle auto connect/disconnect events
    adl_gprsSubscribe( gprs_gprsEventHandler );

    return; 
}

This returns the following (after SIM & CREG events are completed):

(gprs_establishConnection) wip_netInit OK
[GPRS]: open: -> DISCONNECTED
(gprs_establishConnection) Bearer open OK.
(gprs_establishConnection) Bearer set options OK.
[GPRS]: start: GPRS setup failed: -3
(gprs_establishConnection) Bearer start failed, returns -26
[GPRS]: close: -> CLOSED

Thanks, Dave

Hi All,

A quick update on my issue.

I built a new project based on the WIP ‘http_get’ sample. Only changes to the sample code was to set up the APN/logon/password and url appropriately. I compiled the application in Target mode and downloaded it to the Q2686G module that I couldn’t run my previous software on.

First time I ran the application, I got the same error -26 that I was seeing with my code. However, when I reset the Q2686 and re-ran the code, it worked correcly.

Not only did the sample code now run correctly every time, my code now runs correctly on the Q2686 module as well. No recompile, no changes to the code or binary download. Only thing different is that I had run the WIP sample application twice…

What the ???

I’m confused.

ciao, Dave

That’s WIP_BERR_PARAM, “Invalid option value”

IMO, another fine example of a really unhelpful error code from Wavecom - no indication of which option it considers to be invalid, nor in what way it is considered invalid! :angry:

See: viewtopic.php?f=16&t=2733&p=10154&hilit=worthless#p10154

Hiya,

I worked out that it was WIP_BERR_PARAM - but as you say, why? There’s absolutely no indication of which parameter is invalid. Not only that, the wip_bearerSetOpts() call returns sucessfully, and the only parameter the wip_bearerStart() function takes is the pointer to the wip_bearer_t handle - which WAS OK for the call to wip_bearerSetOpts().

What’s more, the wip_debug() (also undocumented in the API, but widely used in the WIP samples) call gives a different error number (-3) - but dredging through the header files indicates that this also means invalid parameter. Why use a different return code for the same error?

By the way, I can repeat this on ALL my Q2686G & Q2686H modules. Every time I flash the firmware to R72a, I have to run the Wavecom ‘http_get’ sample TWICE before I can get the module to create a GPRS connection…

awneil, if you have a few minutes, could you please try this on one of your modules and see if it happens to you - or if it’s just me :frowning: (wouldn’t be the first time, either…)

ciao, Dave

Hello,

I have dealt (and am still dealing) with this problem for a long time. It doesn’t seem to be specific for WIP V5.00. I already saw it already with FW 6.63. Here are some more information about it: http://www.wavecom.com/modules/movie/scenes/forums/viewtopic.php?f=16&t=1946

Best regards,

wismo_coder

In our project we fire wip_netInit first and then wait for ATTACH. Only after it we start all this bearer stuff. And by the way on some OS versions we have seen abnormal behaviour for some operators - socket opened and closed after few seconds. The problem was solved with differen OS version.
And also we always delete WIP soft. It interferes with some weird way with our applications.

Hiya All.

I’m glad that it’s not just me having this issue.

What’s really got me hosed is the fact that after I’ve run the sample application twice, all is well - for both the sample app and my own code. And I can reliably reproduce the problem on each module that I own.

That’s interesting - it looks as though there is something deep within the WIP stack that’s causing the issue. I just hadn’t seen it before on R71a. Lucky, I guess.

After setting up the SIM card and waiting for +CREG indicate network connectivity, I’ve been calling wip_netInit() and waiting for the OK return code before going straight onto wip_bearerOpen() calls.
Are you waiting for the ADL_GPRS_EVENT_ME_ATTACH event from the adl_gprsSubscribe() event handler before starting the wip_bearerOpen() calls? I’m using this event (and the ME_UNREG event) after things have been started to watch for network disconnection/reconnection.
It’s sad that these network attach/unatach events aren’t propagated into the high level WIP library.

I don’t have the WIPSoft application installed - but I do have the WIP library linked into my application. If you are not using the WIP library, are you using another third party library or have you written your own to to HTTP/FTP transfers?

ciao, Dave

Yes

Well it is ADL event, not WIP.

I tell that we delete WIP soft, but we are using WIP lib for our needs.

Hiya,

Yeah, but the WIP library encapsulates the bearerAttach and bearerOpen events that can also be done from within ADL.

The only way I’ve found to test if the GPRS network goes away (i.e. in a mobile installation) is to use the ADL events. The WIP open/read/write/close events attempt to operate even if the GPRS network is no longer there - and only fail after you’ve tried to use them.

I hoped that the WIP library would have provided high(er) level access to all the network functionality, without having to drop back to the lower level for one or two functions.

ciao, Dave

I think it’s OK to use both ADL and WIP. So we do :slight_smile: