[En-Nut-Discussion] Enhancing UDP transmission speed

Harald Kipp harald.kipp at egnite.de
Wed Feb 22 11:57:02 CET 2006


Mattias,

For maximum speed it is probably better to use a circular
buffer with a separate UDP thread. UDP will be sleeping
most of the time, leaving enough time to SPI. The optimum
would be to let an SPI interrupt fill the buffer and wake
up the UDP thread via NutEventPostFromIrq(), if enough
data is available for transmission. This way the idle
thread will run most of the time.

You may also enable UDP buffering, for example

   u_short bufsz = 512;
   NutUdpSetSockOpt(sock, SO_RCVBUF, &bufsz, sizeof(bufsz));

Also note, that the ATmega provides double speed SPI. You
may check the datasheet for proper register configuration.

Harald

At 11:38 22.02.2006 +0100, you wrote:
>Hello,
>I'm currently working on a project which looks as follows:
>
>Getting 3 bytes of sensor data over SPI (at least 20000 measurements per
>second = 60kB per second);




More information about the En-Nut-Discussion mailing list