Hello,
I have a problem. PPP connection from MCB2130 evaluation board to PC or to another board can not be established (the connection has been made through the serial interface).
I have tried to establish PPP connection by calling function 'ppp_connect' from RLT-ARM.
I have used MCB2130 board which has been connected to PC via COM1 port by serial cable.
Source code
/*---------------------------------------------------------------------------- * R T L P P P C O N N E C T E x a m p l e *---------------------------------------------------------------------------- * Name: SimplePPP.C *----------------------------------------------------------------------------*/ #include <RTL.h> #include <LPC213x.H> /* LPC213x definitions */ /*--------------------------- init ------------------------------------------*/ void init () { IODIR1 = 0x00FF0000; /* P1.16..23 defined as Outputs */ /* Enable RxD1 and TxD1 pins. */ PINSEL0 &= ~0x000F0000; PINSEL0 |= 0x00050000; U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit*/ U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */ U0LCR = 0x03; /* DLAB = 0 */ } /*--------------------------- sendchar --------------------------------------*/ int sendchar (int ch) { /* Debug output to serial port. */ if (ch == '\n') { while (!(U0LSR & 0x20)); U0THR = '\r'; /* output CR */ } while (!(U0LSR & 0x20)); return (U0THR = ch); } /*---------------------------------------------------------------------------*/ void tick_timer (void) __task { os_itv_set (10); while (1) { os_itv_wait (); /* Timer tick every 100 ms */ timer_tick (); } } /*---------------------------------------------------------------------------*/ void tcp_poll_task (void) __task { while (1) { main_TcpNet(); os_tsk_pass(); } } void test_task (void) __task { init(); init_TcpNet (); //ppp_listen ("Keil", "test"); ppp_connect (NULL, "Keil", "test"); //slip_connect(NULL); os_tsk_create (tick_timer, 2); os_tsk_create (tcp_poll_task, 1); /* Init done, terminate this task. */ os_tsk_delete_self(); } int main (void) { os_sys_init (test_task); } /*--------------------------- init_serial -----------------------------------*/ void init_serial (void) { /* Initialize the serial interface */ rbuf.in = 0; rbuf.out = 0; tbuf.in = 0; tbuf.out = 0; tx_active = __FALSE; /* Enable RxD1 and TxD1 pins. */ PINSEL0 &= ~0x000F0000; PINSEL0 |= 0x00050000; /* 8-bits, no parity, 1 stop bit */ U1LCR = 0x83; U1DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */ U1LCR = 0x03; /* Enable FIFO with 8-byte trigger level. */ U1FCR = 0x87; /* Enable RDA and THRE interrupts. */ U1IER = 0x03; VICDefVectAddr = (U32)def_interrupt; /* Enable UART1 interrupts. */ VICVectAddr14 = (U32)handler_UART1; VICVectCntl14 = 0x27; VICIntEnable |= (1 << 7); }
I have used WinXP SP2 on PC, created the Incoming Connection in 'Network Connections'. User: 'Keil' Password 'test' . The login information was added to WinXP and is selected as user allowed connecting.
Connection has not been established.
Also, connection was not established if function 'slip_connect' had been used.
But, connection was established successfully when I used the function 'ppp_listen' on the MCB2130 board side and PC connected to MCB2130 board.
Moreover, I need to establish connection between to MCB2130 boards via serial cable. I use Null-Modem Male-Male cable. I run application which calls 'ppp_listen' on first board. I run application which calls 'ppp_connect' on another board. PPP connection is not established.
"I am here and I am waiting for reply."
Don't just sit there - get debugging!
Have you run it in the simulator?
The MCB2130 supports JTAG debugging:
http://www.keil.com/arm/mcb2130/
http://www.keil.com/support/man/docs/mcb2130/mcb2130_db_ulink.htm
Have you made use of that?
Hello Andy Neil,
Thanks for a piece of good advice.
I have ULINK USB-JTAG Adapter. I use it. But, there are no source codes of TCP-IP implementation in RL-ARM RealView® Real-Time Library. I have made small and simple test application. I have analyzed it under debugger. Both functions main_TcpNet() and timer_tick () were called periodically. I have used RTLCD.LIB. I have enabled the debugging on the TCP/IP stack by setting the value DBG_ENABLE to 1. Moreover, I have enabled the full trace mode on PPP by setting DBG_PPP to 2. There were no errors detected in debug mode. However, strange log has been generated by function __debug__. Message which was started from text 'Dialing number' has had strange rubbish in memory. I have passed NULL value as a first argument (digital number) to function ppp_connect. May be PPP implementation has defect if NULL is passed to function ppp_connect.
I am thankful for your attention. I'm looking forward to response.
There is a ready example for PPP-server. It demonstrate an usage of TCPnet as a PPP-server. A PC connects to MCB2140 with PPP. When connected, you can browse the board with Internet Explorer. You can take this example as a reference.
For a PPP-client, this is a bit different. You have to: 1. properly configure a dial-in connection on your PC (it is preferred for a direct cable connection) 2. configure TCPnet for PPP-client and connect to PC
Here is an example for PPP-client:
int main() { init(); init_TcpNet(); ppp_connect(NULL,"Keil","test"); while (1) { timer_poll (); main_TcpNet(); } }
For a PC direct cable connection you need to add a Null_Modem.c driver to your project. There is a bug in TCPCD.lib library which prints out garbage when a NULL pointer is provided for ppp_connect(). You can avoid this by providing a zero-length string as a dialnum ppp_conect("",Keil","test");
Hello Franc Urbanc,
Thank you very much for your concern.
Unfortunately, implementation of functions
timer_poll ();
and
init();
are not included to your example.
Fortunately, function with the same names and purposes are included in help system for Keil and example 'HTTP_demo'. So, I have used following source:
#define MCLK 60000000 /* Master Clock 60 MHz */ #define TCLK 10 /* Timer Clock rate 10/s */ #define TCNT (MCLK/TCLK/4) /* Timer Counts */ /*--------------------------- init ------------------------------------------*/ void init () { /* Timer 1 reload to 100ms */ T1TCR = 1; T1MCR = 3; T1MR0 = TCNT - 1; /* Timer 1 Period */ IODIR1 = 0x00FF0000; /* P1.16..23 defined as Outputs */ /* Enable RxD1 and TxD1 pins. */ PINSEL0 &= ~0x000F0000; PINSEL0 |= 0x00050000; U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit*/ U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */ U0LCR = 0x03; /* DLAB = 0 */ } /*--------------------------- sendchar --------------------------------------*/ int sendchar (int ch) { /* Debug output to serial port. */ if (ch == '\n') { while (!(U0LSR & 0x20)); U0THR = '\r'; /* output CR */ } while (!(U0LSR & 0x20)); return (U0THR = ch); } static void timer_poll () { if (T1IR & 1) { T1IR = 1; /* Timer tick every 100 ms */ timer_tick (); } } int main() { init(); init_TcpNet(); // ppp_listen ("Keil", "test"); //ppp_connect("","Keil","test"); ppp_connect(NULL,"Keil","test"); while (1) { timer_poll (); main_TcpNet(); } }
Is it correct code?
Moreover, I have initialized COM1 port.
void init_serial (void) { /* Initialize the serial interface */ rbuf.in = 0; rbuf.out = 0; tbuf.in = 0; tbuf.out = 0; tx_active = __FALSE; /* Enable RxD1 and TxD1 pins. */ PINSEL0 &= ~0x000F0000; PINSEL0 |= 0x00050000; /* 8-bits, no parity, 1 stop bit */ U1LCR = 0x83; U1DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */ U1LCR = 0x03; /* Enable FIFO with 8-byte trigger level. */ U1FCR = 0x87; /* Enable RDA and THRE interrupts. */ U1IER = 0x03; VICDefVectAddr = (U32)def_interrupt; /* Enable UART1 interrupts. */ VICVectAddr14 = (U32)handler_UART1; VICVectCntl14 = 0x27; VICIntEnable |= (1 << 7); }
PPP connection has not been established.
But, PPP connection has been established successfully if ppp_listen is used. So, physically connection is OK.
1. Have you properly configured a dial-in connection on your PC? (to check connect another PC instead of MCB2130, use null-modem cable)
2. What do the debug messages say? (use ppp_connect("","Keil","temp"))
I glad to read your replay.
I have checked Incoming connection. Connection from another PC by Null-Modem cable has been established successfully.
Debug messages are: Initialize PPP interface Initailize PPP-LCP Initailize PPP-RAP Initailize PPP-IPCP Dialing number: Username: 'Keil', Password: 'test'
There is no rubbish in memory. Function '__error__' has not been called.
Is this all what you get from a debug? If you enable debug messages for PPP you should receive more?
Please do not type debug messages, use copy & paste. There is no PPP-RAP should be PPP-PAP (Pasword Authentication Protocol).
I have retested it one more time.
Log messages:
Initialize PPP interface Initailize PPP-LCP Initailize PPP-PAP Initailize PPP-IPCP Dialing number: Username: 'Keil', Password: 'test'
In file NET_DEBUG.C #define DBG_PPP 2
When I have been using Hyper Terminal text
RING
was showed.
Thank you in advance for help.
Did you check the HTTP demo Abstract.txt?
NOTE: Serial interface uses only TXD, RXD and GND signals from the RS232 line. However in most cases some additional connections are required by the PC COM interface. For a 9-PIN standard connector you should therefore connect the pin 7 (RTS) to pin 8 (CTS) and pin 1 (CD) to pin 4 (DTR) and to pin 6 (DSR).
Thanks for all who tried to help me.
It was Keil's defect in Null-Modem driver.
Keil sent me fixed version of RTL.