Hi I am using lpc4357 based on MCB4300. Ethernet maximum speed is too low. here is a part of FTP code which is using USB MSD as a data storage:
U16 tcp_callback (U8 soc, U8 evt, U8 *ptr, U16 par) { par = par; if (soc != socket_tcp) { return (0); } switch (evt) { case TCP_EVT_DATA: break; case TCP_EVT_CONREQ: return (1); case TCP_EVT_CONNECT: printf("connect\r\n"); return (1); } return (0); } ... SystemCoreClockUpdate(); SysTick->LOAD = (SystemCoreClock/ 100) - 1; SysTick->CTRL = 0x05; init_TcpNet (); socket_tcp = tcp_get_socket (TCP_TYPE_SERVER, 0, 1000, tcp_callback); if (socket_tcp != 0) { tcp_listen (socket_tcp, 1001); } while (1) { usbh_engine_all(); con = ((usbh_msc_status(1, 0) << 1) | usbh_msc_status(0, 0)) & 3; if (con ^ con_ex) { /* if connection changed */ if ((con ^ con_ex) & ~con & 1) /* if device 0 not connected */ printf ("\nDisconnected Drive U0:"); if ((con ^ con_ex) & con & 1) con |= init_msd ("U0:"); if ((con ^ con_ex) & con & 1) /* if device 0 connected */ printf ("\nConnected Drive U0:"); if (con) printf ("\nCmd> "); /* display prompt */ else printf ("\nNo drives connected, please connect any drive ... "); fflush (stdout); con_ex = con; } main_TcpNet (); timer_poll (); }
CPU is working at 204MHz. USB clock is 480MHz. in CGU all peripherals are connected to PLL1 and it is working at 204MHz.
download speed is about 4MB/s (in FlashFS sample code I could achieve 9MB/s for read and about 8MB/s for write)
I've manipulate FTP_UFI.c just for finding the maximum speed on ftp in this way:
unsigned long size=0; U16 ftp_fread (void *file, U8 *buf, U16 len) { /* Read 'len' bytes from file to buffer 'buf'. The file will be closed, */ /* when the number of bytes read is less than 'len'. */ size+=len; if (size>100000000) return 0; else return len; }
I know it is not working properly but I've omitted time of fread for speed test. in download progress speed is about 5.5MB/s. I think it is a disaster.
I've set it as a TCP server and through put is about 2% of 100Mb/s
this code is the same as my LPC1788 board and download speed on LPC1788 with SD card is about 2MB/s(it is usual) and as a TCP server is about 80% of 100Mb/s(is it so perfect)
I've changed SysTick setting but this is the most through put that I could obtain.
some critical definitions in net_config.c:
#define MEM_SIZE 2048 #define TICK_INTERVAL 10
Do you have any idea?
View all questions in Keil forum