PPP connection fails

Discussion to talk about software related topics only.
Post Reply
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

PPP connection fails

Post by v8dave »

I just came across this code snippet when searchng for PPP. It is also similar to what is in my examples.

http://forum.embeddedethernet.com/viewt ... =ppp#p1077

I am using someting similar and having issues getting the modem to connect. The SIM has been tested and is working and can make GPRS connections in a phone.

The DialPPP call seems to take forever to timeout. I am using a SIM300 modem and I can see the status LED flashing during the negotiation phase and then it stops and the function just hangs until it returns with PPP_FAIL after about 1-2 minutes.

This is the code I am using.

PPP_BAUDRATE_TO_USE = 115200;
PPP_SW_RX_FLOW = FALSE;
PPP_SW_TX_FLOW = FALSE;
MODEM_AUTOBAUD = "AT\r";
MODEM_RESET = "ATZ\r";
MODEM_ANSWER = "ATA\r";
MODEM_HANGSTRING = "ATH0\r";
// MODEM_INITSTRING = "AT&K0&C0&D0\r"; // Set below before dialing
MODEM_ENDCMDMODE = "ATO0\r";
MODEM_POSTDIAL = "\r";
MODEM_ATTNSTRING = "+++";
strcpy(DIAL_STRING, "ATD*99***1#"); // GPRS dialup

/* A reasonable set of PPP limits and negotiation settings */
pppo.Restart_Interval = 3; /* The restart interval for PPP Negotiations */
pppo.Max_Terminate = 2;
pppo.Max_Configure = 10;
pppo.Max_Failure = 10;
//pppo.TX_DESIRED_ACCM = 0xFFFFFFFF;
//pppo.RX_DESIRED_ACCM = 0xFFFFFFFF;
//pppo.TX_DESIRED_ACCM = 0x000A0000;
//pppo.RX_DESIRED_ACCM = 0x000A0000;
pppo.TX_DESIRED_ACCM = 0x00000000;
pppo.RX_DESIRED_ACCM = 0x00000000;
pppo.Chat_Login_disable = TRUE;
pppo.CHAPenable = FALSE;

pppo.SetThisInterfaceAddress = 0; /* We expect the other side to provide an address so we set ours to 0 */
pppo.SetThatInterfaceAddress = 0;
pppo.authenticate_func = NULL; /* We don't require the ISP to provide us with Username/password, we dialed him */

sprintf(InitString, "AT+CGDCONT=1,\"IP\",\"%s\",\"0.0.0.0\"\r", ConfigData.GPRS_APN);

MODEM_INITSTRING = InitString;
pppo.pUserName = ConfigData.GPRS_Username;
pppo.pPassword = ConfigData.GPRS_Password;

rv = DialPPP(SERIALPORT_TO_USE, &pppo, DIAL_STRING);

All the password and init strings are correct prior to the DialPPP call.

Dave...
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: PPP connection fails

Post by v8dave »

I found something interesting. At the end of the void PPPDialTask( void* p ) function in ppp.cpp, I found that the OSSemPost was commented out.

}
while ( ( abort_ppp ) == 0 );
cur_State = eClosed;
// OSSemPost( &state_semaphore );
OSTaskDelete();
}// Dial PPP

I uncommented this and now when the dialing fails, it returns immediatily without the long wait I was getting before. No information as to why it was commented out but putting it back in sure makes it return much faster. It just required a rebuild of the change OS files.!

Dave...
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: PPP connection fails

Post by v8dave »

Still no joy with PPP over GPRS. It just does not connect and authenticate.

This is the debug output during a connection.

Setting RX ACCM:FFFFFFFF
Setting TX ACCM:FFFFFFFF
Setting RX ACCM:FFFFFFFF
Setting TX ACCM:FFFFFFFF
Wait time out
Auto baud done
Modem Reset Done
Setup String Done
connected
Starting PPP
LCP -State:STARTING
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[00][ 07020802020600000000
LCP -State:REQ_SENT
IPCP-State:STARTING
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
We are sending a config request with: LCP_OPT_PFC, FLAGS_RX_ACFC, LCP_OPT_ACCM =
0x0,
PPP TxLCP -CONF_REQid[01][ 07020802020600000000
LCP -0000C021TO+
Link failed to negotiate
aborted!
PPP Session ends(Hanging up)
Hung Up

What I have noticed is that there appears to be no received data although I can see this on the SCOPE when looking at the RXD line into the MOD5234. All the init seems to work. I don't have any TX or RX software flow control but hardware is enabled and both RTS and CTS remain low (active state)

The DO loop below in PPP.CPP line 672, never gets reached.

do
{
OSSemPend( &read_semaphore, TICKS_PER_SECOND );
if ( !dr->m_FifoRead.Empty() )
{
do
{
if ( ( rv = dr->m_FifoRead.ReadData( buffer, 80 ) ) > 0 )
{
ahdlc_receive( ( char* )buffer, rv );
}
}
while ( rv > 0 );
}//If not empty....

Has anyone managed to get PPP to work over GPRS? I saw the code in the Apps forum and that is what I have here. I am using a Telkomsel SIM on the Indonesian Telkomsel network. My Rabbit based design works fine with this same SIM so I know that it is not a network or SIM issue.
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: PPP connection fails

Post by v8dave »

Doing a little more digging into why I am not receiving any data and I am finding that if I break point into the processppp function and then check the variables for the UartData, they don't match up.

See attached images of the 2 screen grabs of the variables. This code below gets the UartData for the serial port in use, in my case, 2.

UartDataRec* dr = UartData + ( fd - SERIAL_SOCKET_OFFSET );


Looking at the m_pGetCharFunction highlighted and the m_Head and m_Tail for the fifi read! m_pPutCharFunc is correct.

I don't think this is corruption as dr is just a pointer and the Expressions view is OK.

I am wondering if there is a bug in the code for use with UART2??? Still working my way through it all to find it.

If I open the serial port I can send and receive data to the modem. The PPP init also works but only fails when in the processppp section.!
ppp_1.jpg
ppp_1.jpg (52.48 KiB) Viewed 3521 times
ppp_1.jpg
ppp_1.jpg (52.48 KiB) Viewed 3521 times
Dave...
Attachments
ppp_2.jpg
ppp_2.jpg (43.98 KiB) Viewed 3519 times
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: PPP connection fails

Post by v8dave »

And there's more!!!

I decided to create the simplest application only to dial out and used the PPP sample with the additonal changes to change the pins on my MOD5234 and use the GPRS dial string. This I did to rule out any possible memory corruption issues with the rest of my code.

This gives exactly the same error. This sure is taking up so much of my time this week and I am sure this is a bug!! Guess it's time I renewed my support fee and lodge this as a possible bug!!

I have no way to test this with UART1 as those pins are allocated to CAN bus and I am using a custom PCB with the module.

Dave...
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: PPP connection fails

Post by v8dave »

Hi All,

I am going to post this as a ticket as there is definatily an issue in the PPP.CPP code. The following line does not point to the correct location on entry to processppp.

UartDataRec* dr = UartData + ( fd - SERIAL_SOCKET_OFFSET );

If I break point here and input the correct location, it runs but goes into a loop with the following error.

Unknown option 0x0 read and it not supported.

I have to reset after this happens.

Dave...
Post Reply