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

TCP packet filled with 'U' 1392 bytes long

Hi,

I'm trying the RL-ARM tcp/ip stack on a arm7 LPC2368 from ETT (futurlec).
I succeed setting up a TCP listen socket with the EasyWeb API.
But when I try to use the TCP stack from RL-ARM 4.12 I don't succeed.

When the controller goes online, it send one packet (ARP notify) and it is filled with 'U' (55) the whole frame/packet, 1392 bytes long.

If I try to setup a TCP connection from my controller to the PC.
several packets as described above appear.

Any idea?

Kind Regards.

Parents
  • This is the code I used:
    On flashmagic I have set Osc. freq to 48.0 Mhz

    #include <stdio.h>
    #include <RTL.h>
    #include <LPC23xx.H>                          /* LPC23xx definitions         */
    
    #define MCLK 48000000                         /* Master Clock 48 MHz         */
    #define TCLK       10                         /* Timer Clock rate 10/s       */
    #define TCNT (MCLK/TCLK/4)                    /* Timer Counts                */
    void delay(unsigned long int);
    void init(void);
    U16 tcp_callback (U8 soc, U8 evt, U8 *ptr, U16 par);
    void procrec (U8 *buf);
    static void timer_poll (void);
    
    U8 socket_tcp;
    U8 rem_ip[4] = {192,168,3,68};
    int main()
    {
       init();
       init_TcpNet ();
       socket_tcp = tcp_get_socket (TCP_TYPE_CLIENT, 0, 30, tcp_callback);  /* Initialize TCP Socket and start listening */
      // tcp_listen (socket_tcp, 300)          ;
            tcp_connect (socket_tcp, rem_ip, 300, 0);
        while(1)
            {
              timer_poll ();
              main_TcpNet ();
            }
    }
    void delay(unsigned long int count1)
    {
      count1 = count1 * 11000;
      while(count1-- > 0){ }
    }
    static void timer_poll ()
    {
      // System tick timer running in poll mode
       if (T1IR & 1)
       {
          T1IR = 1;
         // Timer tick every 100 ms
          timer_tick ();
       }
    }
    void init()
    {
       /* Timer 1 as interval timer, reload to 100ms. */
       T1TCR = 1;                                                                                           // Timer[1] = 100mS Trigger
       T1MCR = 3;
       T1MR0 = TCNT - 1;
    }
    U16 tcp_callback (U8 soc, U8 evt, U8 *ptr, U16 par)
    {
       if (soc != socket_tcp)
       {
          return (0);
       }
       switch (evt)
       {
          case TCP_EVT_DATA:  /* TCP data frame has arrived, data is located at *par1, */
             procrec(ptr); /* data length is par2. Allocate buffer to send reply.   */
             break;
    
          case TCP_EVT_CONREQ:   /* Remote peer requested connect, accept it */
          return (1);
          case TCP_EVT_CONNECT:  /* The TCP socket is connected */
          return (1);
       }
    
       return (0);
    }
    /*--------------------------- Process received data  ------------------------*/
    void procrec (U8 *buf)
    {
       switch (buf[0])
       {
          case 49:
           break;
       }
    }
    

Reply
  • This is the code I used:
    On flashmagic I have set Osc. freq to 48.0 Mhz

    #include <stdio.h>
    #include <RTL.h>
    #include <LPC23xx.H>                          /* LPC23xx definitions         */
    
    #define MCLK 48000000                         /* Master Clock 48 MHz         */
    #define TCLK       10                         /* Timer Clock rate 10/s       */
    #define TCNT (MCLK/TCLK/4)                    /* Timer Counts                */
    void delay(unsigned long int);
    void init(void);
    U16 tcp_callback (U8 soc, U8 evt, U8 *ptr, U16 par);
    void procrec (U8 *buf);
    static void timer_poll (void);
    
    U8 socket_tcp;
    U8 rem_ip[4] = {192,168,3,68};
    int main()
    {
       init();
       init_TcpNet ();
       socket_tcp = tcp_get_socket (TCP_TYPE_CLIENT, 0, 30, tcp_callback);  /* Initialize TCP Socket and start listening */
      // tcp_listen (socket_tcp, 300)          ;
            tcp_connect (socket_tcp, rem_ip, 300, 0);
        while(1)
            {
              timer_poll ();
              main_TcpNet ();
            }
    }
    void delay(unsigned long int count1)
    {
      count1 = count1 * 11000;
      while(count1-- > 0){ }
    }
    static void timer_poll ()
    {
      // System tick timer running in poll mode
       if (T1IR & 1)
       {
          T1IR = 1;
         // Timer tick every 100 ms
          timer_tick ();
       }
    }
    void init()
    {
       /* Timer 1 as interval timer, reload to 100ms. */
       T1TCR = 1;                                                                                           // Timer[1] = 100mS Trigger
       T1MCR = 3;
       T1MR0 = TCNT - 1;
    }
    U16 tcp_callback (U8 soc, U8 evt, U8 *ptr, U16 par)
    {
       if (soc != socket_tcp)
       {
          return (0);
       }
       switch (evt)
       {
          case TCP_EVT_DATA:  /* TCP data frame has arrived, data is located at *par1, */
             procrec(ptr); /* data length is par2. Allocate buffer to send reply.   */
             break;
    
          case TCP_EVT_CONREQ:   /* Remote peer requested connect, accept it */
          return (1);
          case TCP_EVT_CONNECT:  /* The TCP socket is connected */
          return (1);
       }
    
       return (0);
    }
    /*--------------------------- Process received data  ------------------------*/
    void procrec (U8 *buf)
    {
       switch (buf[0])
       {
          case 49:
           break;
       }
    }
    

Children