Forum Discussion
lwip MicroC/OS-II throughput
Does anyone know if the throughput rates on pate 1-31 of the "Using Lightweight IO with the Nios II Processor tutorial" document was for 100Mbps ethernet?
The transmit rate of 5.16 Mbps seems really low unless it is a 10Mbps link. It is not clear what application software they are running to test UDP rates. I am assuming it is not their simple socket server application which uses TCP. My goal is to us TCP to download vga images captured and processed by NIOS-II.21 Replies
- Altera_Forum
Honored Contributor
can the cs8900 chip work in the condition of NIOSII?
I see cs8900 in quartusII sopc, but I find the ethernet chip that all the people discussed is lan91c111. the chip is too expensive for me! I made a nios development kit by using cs8900! but I don't know if the ethernet chip can work!! - Altera_Forum
Honored Contributor
Hi Soin
you wrote about a UDP-server implementation with MicroC/OS-II. Could you send me an example of your way to send UDP-packages? I'm trying to do without it, but so far it doesn't work. When I send something it always goes from source port 0 to destination port 0. Cheers, Danny - Altera_Forum
Honored Contributor
Solved that problem, but now all the PC is receiving is some ascii-code...
- Altera_Forum
Honored Contributor
OK solved that problem too... things are going great... now I've got 37 MBit... compiling another NIOS II now according to the altera ethernet acceleration white paper... let's see how that works out
- Altera_Forum
Honored Contributor
I performed a test using Bob's changes. The test consists in sending 200 bytes long packets to a PC that sends them back to the interface and measuring the time to cover the loop. The thread performes the send operation and then blocks on the receive on a different socket. It runs on a Stratix II @ 50 MHz. and the times are averaged over 1000 sends/receives
The results are depriming: 5154 microseconds to complete the loopback i.e. 620Kbps integrated over transmit and receive. Here is a portion of code:
--- Quote Start --- originally posted by bob@Jun 9 2005, 02:38 AM i made the following changes which compiled and tested ok, but haven't done any comparative performance measurements yet.while(1) { start=alt_timestamp(); if (sendto(fd_write, buffer, MSG_LEN , 0, (struct sockaddr*)&rem_addr, sizeof(struct sockaddr_in)) < 0) { fprintf(stderr, "%s: sendto failed: ", __FUNCTION__); } sent++; if((num_car_letti= recvfrom(fd_listen, str_in, NUM_CAR, 0, &src_addr, &namelen)) == -1) { fprintf(stderr,"%s: recvfrom failed: \n", __FUNCTION__); exit(1); } stop=alt_timestamp(); delay=(stop-start); sum+=delay; if(sent == 1000) { fprintf(stderr, "delay %lu usec", (sum/1000)/(tps/1000000)); fprintf(stderr, " %lu\n ", sum); sent=stop=delay=sum=0; alt_timestamp_start(); } }//while1.) added the following code to:
\altera\kits\nios2\components\altera_lwip\ucosii\inc\lwipopts.h
/*
* enable lightweight protection.
* refer \altera\kits\nios2\components\altera_lwip\ucosii\src\downloads\lwip-1.1.0\src\include\lwip\sys.h
* for changes to the sys_arch_decl_protect(), sys_arch_protect() and
* sys_arch_unprotect() macros.
*/# define sys_lightweight_prot 1
2.) made the following changes in:
\altera\kits\nios2\components\altera_lwip\ucosii\src\downloads\lwip-1.1.0\src\include\lwip\sys.h
/** sys_arch_decl_protect
* declare a protection variable. this macro will default to defining a variable of
* type sys_prot_t. if a particular port needs a different implementation, then
* this macro may be defined in sys_arch.h.
*/
//#define sys_arch_decl_protect(lev) sys_prot_t lev# define sys_arch_decl_protect(lev) alt_irq_context lev
/** sys_arch_protect
* perform a "fast" protect. this could be implemented by
* disabling interrupts for an embedded system or by using a semaphore or
* mutex. the implementation should allow calling sys_arch_protect when
* already protected. the old protection level is returned in the variable
* "lev". this macro will default to calling the sys_arch_protect() function
* which should be implemented in sys_arch.c. if a particular port needs a
* different implementation, then this macro may be defined in sys_arch.h
*/
//#define sys_arch_protect(lev) lev = sys_arch_protect()# define sys_arch_protect(lev) lev = alt_irq_disable_all()
/** sys_arch_unprotect
* perform a "fast" set of the protection level to "lev". this could be
* implemented by setting the interrupt level to "lev" within the macro or by
* using a semaphore or mutex. this macro will default to calling the
* sys_arch_unprotect() function which should be implemented in
* sys_arch.c. if a particular port needs a different implementation, then
* this macro may be defined in sys_arch.h
*/
//#define sys_arch_unprotect(lev) sys_arch_unprotect(lev)# define sys_arch_unprotect(lev) alt_irq_enable_all(lev)
//sys_prot_t sys_arch_protect(void);
//void sys_arch_unprotect(sys_prot_t pval);
3.) added the following include to:
\altera\kits\nios2\components\altera_lwip\ucosii\src\downloads\lwip-1.1.0\src\core\pbuf.c
\altera\kits\nios2\components\altera_lwip\ucosii\src\downloads\lwip-1.1.0\src\core\memp.c
# include "sys/alt_irq.h"
not sure about any of the other tuning options, haven't got that far yet.
ciao
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=7529)
--- quote end ---
--- Quote End ---
- Altera_Forum
Honored Contributor
I discovered that i compiled my test with -O0 for the library. After replacing all optimization to -O2 I get 1.715 ms to send/receive 200 bytes. This is still a factor ~2 above the values in table 1-3 of the lwip tutorial. Does anybodyhave any explaination for this factor?
- Altera_Forum
Honored Contributor
--- Quote Start --- hi soin, I am interesting your project of lwip. i know the lan91c111 speed is too slow from see some pdf. no more than 10M.i want to accelerate speed.i see your result .i want to get your code.by the way ,i want to know your method how to test the speed of lan91,use the niosii time or other software?if software ,tell me name. thank for your help,if you have time,please send project to [email protected]. - Altera_Forum
Honored Contributor
Hi all,
my testing environment is Cyclone 1c20 chip, 50MHz Nios II cpu, Lan91c111 MAC. I am using lwIP 1.1 with Quartus II 6.0 and Nios IDE 6.0 software. I am transfering bulk image data from the embedded system to PC via UDP and the fastest speed I ever got is about 9Mbit/s ( 1.1MByte/s). The problem is that when I use any compiler optimize options when building my NiosII project, it stops functioning. It must be compiled with -O0 level. Does anybody have any idea about this problem? Thanks!! - Altera_Forum
Honored Contributor
Hi heavenscape,
you should be using the lwip stand-alone version if possible. That way you can reach the highest bandwith http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif Cheers, Danny - Altera_Forum
Honored Contributor
Hi DannyJacobs,
Thank you for your attention and suggestion!! I am not quite sure how to use the lwip stand alone version. Do I just need to copy the relative source files into my NiosII project and rebuild it? When I call a lwip stack function, how can I know if it is the stand alone version is called or it is the version provided by NiosII kit is called? Or is there a tutorial or example that shows me how to use the stand alone version of the stack? Thank you!! Regards, Heavenscape --- Quote Start --- originally posted by dannyjacobs@Aug 21 2006, 01:58 AM hi heavenscape,you should be using the lwip stand-alone version if possible. that way you can reach the highest bandwith http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/smile.gif
cheers,
danny
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17737)
--- quote end ---
--- Quote End ---