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