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'

Hi,

I'm trying the RL-ARM TCP/IP stack on a ARM7 LPC2478-STK board from Olimex.


int  main()
{

    U8 rem_ip[4] = {192,168,1,81};
    U8 tcp_soc;

    uart0_init();
    timer_init();

    init_TcpNet();
    tcp_soc = tcp_get_socket (TCP_TYPE_CLIENT_SERVER, 0, 30, tcp_callback);

    if (tcp_soc != 0)
    {
        tcp_connect (tcp_soc, rem_ip, 8181, 1000);
    }

    while(1)
    {
        main_TcpNet();
    }

    return 0;
}

When the controller goes online, it starts to send Ethernet packets filled with 'U' (0x55). This frame is captured with wireshark and it's 1366 bytes long (all 'U'). This should be ARP request.

I found forum thread with almost exactly problem, but unfortunately it's read-only. Only differece is that I'm using Olimex LPC2478-STK board and my packets are few bytes longer.

http://www.keil.com/forum/18207/

Author of thread managed to find solution. This is his last post.


Hello All,

I tried the debugging but I wasn't going anywhere with it.

I have tried the example in 'C:\Keil\ARM\Boards\Keil\MCB2300\RL\TCPnet\LEDClient'
And that worked. (after deleting LCD stuff )

I created a new project.
then add all the files that the example uses. (same path, didn't copy them..)
didn't work either...

aperently LPC23_EMAC.c has specified options...
Memory Assignment:
Code <Default>
Zero Init Data: IRAM2
Other DATA: IRAM2

After setting those, everything worked.

Why is that ?
How did I suppused to know this ?

Apparently, problem was with RAM memory settings in KEIL IDE.
I have set:

Read/Only Memory Areas
IROM1: 0x0 (start) 0x80000 (size), Default, Startup

Read/Write Memory Areas

IRAM1: 0x40000000(start) 0x10000 size) Default
IRAM2: 0x7FE00000(start) 0x4000, NoInit

But when I print location of arrays inside send_frame functions, dp pointer in not referencing to IRAM2 memory space. I tried set dp manualy to 0x7FE00000 but nothing changed.

void send_frame (OS_FRAME *frame)
{

  /* Send frame to EMAC ethernet controller */
  U32 idx,len;
  U32 *sp,*dp;

    printf("Send_frame...\n");

  idx = MAC_TXPRODUCEINDEX;
  sp  = (U32 *)&frame->data[0];
  dp  = (U32 *)Tx_Desc[idx].Packet;

  printf("sp: %08x\n", sp);
  printf("dp: %08x\n", dp)

  /* Copy frame data to EMAC packet buffers. */
  for (len = (frame->length + 3) >> 2; len; len--) {
    *dp++ = *sp++;
  }
  Tx_Desc[idx].Ctrl = (frame->length-1) | (TCTRL_INT | TCTRL_LAST);

  /* Start frame transmission. */
  if (++idx == NUM_TX_FRAG) idx = 0;
  MAC_TXPRODUCEINDEX = idx;
}

Any idea?

  • Did you set the memory assignment for the file LPC23_EMAC.c in the options for that specific file? From what you write, it looks like you only worked in the common settings dialog.

    To set memory assignment for a *specific* file you must right-click on the file in the file tree i uVision, and choose "Options for..." at the top of the right-click context menu. In the dialog box that appears, you can assign the file to specific memory areas, in your case IRAM2 for "Zero init data" and "Other data".

    The other option for specific assignments is to use scatter loading, but that's a different beast.

  • I overlooked that. I had set memory assignment only for whole project.

    Thank you, TCP/IP is working finally.

  • Hi, it seems you are using the same board as i am , LPc2478-STk. Though this post is inappropriate for the thread,still; I am new to TCPIP stack and have no clear idea from where to begin using RL-TCPnet for example, setting up a TCP active connection - I don't have a clue from where to start. So I will be very gratefull if you give me your code and some guidelines as to where to start. Thanks!