This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PPP connection problem

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.

Parents
  • 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.

Reply
  • 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.

Children