PPP over UART2 with WIP


#1

Hi everyone,

I’m trying to have a ppp server on the uart2 of a q2686.
I use this code to initialize the server and some handler after (not shown here)

sReturn = wip_bearerOpen( &pppWipBearer, "UART2", ppp_BearerHandler, NULL); // return 0 ok

wip_inet_aton( "10.0.0.1", &pppLocalIP);
wip_inet_aton( "10.0.0.2", &pppDestIP);
		
sReturn = wip_bearerSetOpts( pppWipBearer, 
WIP_BOPT_IP_ADDR,      pppLocalIP,		/* Local PPP server IP*/
WIP_BOPT_IP_DST_ADDR,  pppDestIP,		/* Dest PPP client IP */
WIP_BOPT_IP_SETDNS,	FALSE,			/* Don't set dns parameters after connection */				
WIP_BOPT_IP_SETGW,		FALSE,			/* Don't set PPP as default gateway */
WIP_BOPT_RESTART,		TRUE,			/* Restart server after connection closed */
	                         WIP_BOPT_END);

// returns 0 ok

sReturn = wip_bearerStartServer( pppWipBearer, ppp_bearerServerHandler, NULL); // returns 0 ok

I put breakpoints in the different handler but nothing occur when I’m trying to connect using windows.

Here is the log :

05-30-2007 10:43:21.296 - File: C:\WINDOWS\system32\tapisrv.dll, Version 5.1.2600   
05-30-2007 10:43:21.296 - File: C:\WINDOWS\system32\unimdm.tsp, Version 5.1.2600   
05-30-2007 10:43:21.296 - File: C:\WINDOWS\system32\unimdmat.dll, Version 5.1.2600   
05-30-2007 10:43:21.296 - File: C:\WINDOWS\system32\uniplat.dll, Version 5.1.2600   
05-30-2007 10:43:21.296 - File: C:\WINDOWS\system32\drivers\modem.sys, Version 5.1.2600   
05-30-2007 10:43:21.296 - File: C:\WINDOWS\system32\modemui.dll, Version 5.1.2600   
05-30-2007 10:43:21.296 - File: C:\WINDOWS\system32\mdminst.dll, Version 5.1.2600   
05-30-2007 10:43:21.296 - Modem type: Standard 56000 bps Modem
05-30-2007 10:43:21.296 - Modem inf path: mdmgen.inf
05-30-2007 10:43:21.296 - Modem inf section: Gen556F
05-30-2007 10:43:21.296 - Matching hardware ID: moto1_gen
05-30-2007 10:43:21.984 - 115200,8,N,1, ctsfl=1, rtsctl=2
05-30-2007 10:43:21.984 - Initializing modem.
05-30-2007 10:43:21.984 - DSR is low while initializing the modem. Verify modem is turned on.
05-30-2007 10:43:21.984 - CTS is low while initializing modem.
05-30-2007 10:43:22.000 - Send: AT<cr>
05-30-2007 10:43:24.000 - Timed out waiting for response from modem
05-30-2007 10:43:24.000 - The modem failed to respond to the initialization command, Retrying one more time
05-30-2007 10:43:24.000 - 115200,8,N,1, ctsfl=0, rtsctl=1
05-30-2007 10:43:24.000 - CD is high while initializing modem.
05-30-2007 10:43:24.015 - Send: AT<cr>
05-30-2007 10:43:26.015 - Timed out waiting for response from modem
05-30-2007 10:43:26.015 - The modem failed to respond to the initialization command, Retrying one more time
05-30-2007 10:43:26.015 - 115200,8,N,1, ctsfl=0, rtsctl=1
05-30-2007 10:43:26.015 - CD is high while initializing modem.
05-30-2007 10:43:26.031 - Send: AT<cr>
05-30-2007 10:43:28.031 - Timed out waiting for response from modem
05-30-2007 10:43:28.031 - Session Statistics:
05-30-2007 10:43:28.031 -                Reads : 0 bytes
05-30-2007 10:43:28.031 -                Writes: 0 bytes

When the code is not running, I can send at commands on uart 2 with this paramaters : 115200 bps 8n1.

I’m using OpenAT 4.12. Someone have an idea ?

Thanks in advance

Best regards,

gdt
[/code]


#2

Not sure what you’re trying to do, but you could start by making sure that UART2 is actually opened and configured for the right speed (in your application).

Also check that the computer serial port actually is at the speed you’re telling it to be at. On my current computer, the builtin serial port is actually running at half the speed I’m telling it to run at.


#3

I have a uart to bluetooth chipset on my board. I want to exchange data between the Q2686 and the PDA in bluetooth. I need PPP to have a reliable connection, error handling, etc…

When the PPP server is running, I would be able to type AT and have OK response, no? I have tried many speed but none worked…4800,9600,19200,38400,57600, 115200.

How can I check that the uart2 is opened and verify the speed when the ppp server is running?

I tried to make an at+wmfm :
at+wmfm?

+WMFM: 0,2,1,1
+WMFM: 0,2,2,1 // The uart2 seems to be active.
+WMFM: 0,2,3,0
+WMFM: 1,2,4,0
+WMFM: 1,2,5,1

OK

Thanks for your quick response

Best regards,

gdt


#4

Hi gdt !

Well, i dont know the wip librairy and i’m not even sure about what you do before sending the AT command.

But maybe the reason is that, when you open PPP connection, UART2 turns to DATA mode… and then wont interpret/execute AT commands…


#5

Hi Colin,

In this case, I suppose I will receive a event in some handler? I never receive an event in my case…
In the ppp protocol, I think there is some initialisation before connection with password etc…isn"t it?

Thanks for replies,

Best regards,

gdt


#6

for PPP protocol, the link will be opened before exchanging user, password and all other stuff… but as this is managed by the wip librairy, i’m not sure about if the UART2 is already in DATA mode.

what function do you do before trying to send “AT” ?? (for ex. what functions do you call)

if UART2 is in data mode, sending AT on it will be interpreted as data… there wont be any event (well, thats what happen with ADL librairy at least)…
but you should receive data (“AT”) in associated UART2 call back function. Add traces in the UART2 “receiveDataHandler” call back function.
that will help to sort out if UART2 is in data mode or at mode…


#7

I have seen that there is already a sample project (tcp_udp) for PPP server over UART. My code is very similar to the sample code. When I run the tcp_udp sample with PPP server, the behavior is the same as my code.

I think my error is located in the way I connect to the PPP server…

Someone knows how to connect to a PPP server over a COM port with a computer?

Thanks in advance

Best regards,

gdt


#8

You have to setup a dialup connection ! Like for old serial modems !

Under Windows XP, network connection panel, choose create a new connection. Then choose “internet connection”, “configure connection”, “using remote access modem”… you’ll be asked for dialup number, user and password…

that’s it


#9

I tried already that (cfr the first post for the log). The problem is that windows sends AT and have no answer from the ‘modem’.
The modem is the uart2 directly connected to the pc via serial cable on a com port.

When I try AT from an hyperterminal, I have no answer from the modem…

Somebody achieve to use the wip sample with PPP server over UART (tcp_udp -> 4.12, WipTcp Server -> 4.20 beta 6)?

Thanks in advance

BEst regards,

gdt


#10

Are you trying to set a dialup connection with Windows AND running an application in modem which handle PPP connection ??? i dont think it is possible if you do that…

Either you use Windows dialup connection and the modem as a simple dumb modem, either you want to handle the PPP connection yourself and make an application for this (but then dont use a Windows dialup connection)…

But maybe i dont understand at all what you’ve done or what you’re trying to do…


#11

You right. I cannot use dialup because I don’t need to dial anything. I just need to initiate PPP connection over a com port.

I will try “connect directly to another computer” this afternoon instead of dialup.

I suppose it’s possible otherwise why create a ppp server over uart in the wip library and in the samples…

Thanks for your replies

If someone have better idea than mine :wink:)

Best regards,

gdt


#12

Hi everyone,

The solution was to use Communication cable between two computers on the uart com port. It’s working quite well. My pc receive an IP address and I can use sockets to send and receive data using PPP.

Thanks for your comments. It helps me to find the solution. If someone have problems. You can contact me.

Best regards

gdt


#13

A couple of other things to take care of when setting up a PPP link with the PC:

  • letting windows assume the PPP server part is not a good idea: it’s tricky and it tends to mess up the login/password of the whole computer.

  • UART2 on q26 isn’t completely wired, and there are some serial ports (esp. some cheap USB/serial converters) which can’t stand that. If your connection fails after dialing occured, try on UART1.

OTOH, working on serial link is really convenient for development stages, you just go to GPRS for the final tests. It’s a real time and money saver.


#14

When I try and run the example “udp_client” and change the startup"adl_main" so it calls “cfg_uart_ppp_client” then the setting up of the ppp client fails within this routine. Here is teh code causing the problem.

appli_entry_point = entry_point;

r = wip_bearerOpen( &b, PPP_BEARER, evh_bearer, NULL);
ASSERT_OK( r);

r = wip_bearerSetOpts( b,
WIP_BOPT_LOGIN, PPP_USER,
WIP_BOPT_PASSWORD, PPP_PASSWORD,
WIP_BOPT_END);
ASSERT_OK( r);
r = wip_bearerStart( b);
ASSERT( 0 == r || WIP_BERR_OK_INPROGRESS == r);

Bothe the functions “wip_bearerOpen” and “wip_bearerSetOpts” return OK but the function “wip_bearerStart” returns an error code of (-29) which is WIP_BERR_DEV - Error from Link Layer initialisation. What does this mean?

How can I actually test a PPP connection. I was planning to have the Wavecomm board connected to the PC, using the PC as a ppp host I guess.

What am I doing wrong


#15

Hi dvorreiter,

I think you have not initialized the tcp stack using the wip_netInit fonction before calling the wip_bearerOpen.

Good luck :wink:

Best regards,

gdt


#16

Thanks for the response but I believe I am setting initialising the port correctly. The adl_main function calls the net init function as follows

r = wip_netInitOpts(
WIP_NET_OPT_DEBUG_PORT, WIP_NET_DEBUG_PORT_UART1, /* WIP traces on UART1 */
//WIP_NET_OPT_DEBUG_PORT, WIP_NET_DEBUG_PORT_UART2,
//WIP_NET_OPT_DEBUG_PORT, WIP_NET_DEBUG_PORT_TRACE,
WIP_NET_OPT_END);

Is this correct?

Also how do you specify the baud rate , data bits stops bits etc of the serial port (UART2) I am using when creating a PPP connection???

In order to test the PPP connection I will need to set up a PPP analyser on a PC so I will need to know communication parameters of UART 2.


#17

Did you check the return value from wip_netInitOpts?
You use UART1 to debug the wip communications, are you sure you use the uart2 for your ppp server? If you use the uart1 to debug the wip and to test the ppp server, it will not work.
You can also try to put a delay between the stack initialisation and you bearerStart.

Good luck

Best regards,

gdt


#18

Hi, I am facing issue with opening UART2 bearer(SL8082BTA device).

/* Initialize the stack /
ret = wip_netInitOpts ( WIP_NET_OPT_DEBUG_PORT, WIP_NET_DEBUG_PORT_UART2,
WIP_NET_OPT_END );
This function wip_netInitOpts is returning OK(Success).
/
Open the UART bearer */
bearerRet = wip_bearerOpen ( &br, PPP_BEARER, cbEvhBearer, NULL );

It is returning -44. I dont know -44 does mean.

Please suggest me how to resolve this issue.


#19

Hi, I am facing issue with opening UART2 bearer(SL8082BTA device).

appli_entry_point = entry_point;
/* Initialize the stack /
ret = wip_netInitOpts ( WIP_NET_OPT_DEBUG_PORT, WIP_NET_DEBUG_PORT_UART2,
WIP_NET_OPT_END );
This function wip_netInitOpts is returning OK(Success).
/
Open the UART bearer */
bearerRet = wip_bearerOpen ( &br, PPP_BEARER, cbEvhBearer, NULL );

It is returning -44. I dont know -44 does mean.

Please suggest me how to resolve this issue.


#20

Hi,
As per my understanding it’s PPP echo…

-Alex