[En-Nut-Discussion] Newbie
Harald Kipp
harald.kipp at egnite.de
Tue Feb 4 14:58:53 CET 2003
>
>However I did have problems when I tried the RS232D demo code at work.
>When transferring a file from the serial side, the rate of characters
>received by the telnet client decreased until eventually the board locked
>up. Is it normal for the board to struggle on a large network with large
>volumes of traffic or does anybody think I have a hardware problem ?
RS232D is somehow too simple. It should collect a few bytes
from the serial port before sending them on TCP. On high
traffic networks, Ethernut has some more work to do with
broadcasts and too many outgoing packets get queued. On
version 2.5.2 this may result in a deadlock situation. Version
2.6.0 should fix that. But still, if sending a complete packet
for every single byte from the UART, heap memory is consumed
very fast. Here's a different approach:
for(rlen = 0; rlen < (int)sizeof(rxbuff); rlen += c) {
if((c = NutDeviceRead(uart1, rxbuff + rlen, sizeof(rxbuff)
- rlen)) <= 0)
break;
}
if(rlen > 0) {
for(slen = 0; connected && slen < rlen; slen += c) {
if((c = NutTcpSend(sock, rxbuff + slen, rlen - slen))
< 0) {
if(connected) {
connected = 0;
NutTcpCloseSocket(sock);
}
}
}
}
It collects serial data until rxbuff is filled or the UART receiver times out.
This requires to call
NutDeviceIOCtl(uart1, UART_SETREADTIMEOUT, &rtimeout);
>
>The board was configured with a valid IP address, gateway address and the
>MAC address is still the one assigned by Egnite.
>
How did you "configure" it?
Harald
More information about the En-Nut-Discussion
mailing list