[En-Nut-Discussion] Problem with app rs232d.

Ernst Stippl ernst at stippl.org
Thu Jun 7 23:04:17 CEST 2007


Hi Paulo!

I tried the test you describe on an Ethernut 2.1b with Nut/OS 4.2.1 and the
original rs232d example, and it also hangs/reboots when a character is sent
from the rs232 to the telnet session t(during an open telnet session) AFTER
a telnet session has been connected / disconnected without any character
transferred.

I can imagine the reason you give may be indeed the cause of the problem. I
am just thinking about what could be the smallest change to the  rs232d
example which could be working properly ....

regard
ernst   

-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von Paulo da Silva
Gesendet: Donnerstag, 07. Juni 2007 15:25
An: Ethernut User Chat (English)
Betreff: Re: [En-Nut-Discussion] Problem with app rs232d.

HI Ernst and Dusan,

With yours sugestions I did a several tests with no success.
But I think I found something in that code, I explain below:

I think the problem is not memory  overwriting, because I can have data in
both directions, and the size of this data can be gigabytes, and when I
close the telnet conection and with it closed if I send a char from rs232
terminal, this situation does sistem return to a thread receive and the
memory "malloced" been freed, and when I start a new telnet connection and
type a char into PS rs232 terminal the data is received in PC telnet
application, so the NUS-OS does not crash, I think this prove that it is
impossible the problem be a memory overwritting. I did this for a lot of
times and it always works. But if I close and open a telnet without a
character sent from PC rs232 terminal the Nut-OS crashs all the times I do
that, tested it for a several times too.
Another thing is in the past I was thinking that the quantity of data was
important to this bug, but this is not true.
If I open and close for 10 times a telnet connection with no data trafic,
and after this open one telnet and try to send a character from rs232
terminal, the sistem crashs, againg if I send a character from rs232 to a
telnet with it closed the problem does not appear.

So thanks to Ernst  for your help, but you do not need to do in the weekend,
that test in your board, because the amount of data does not difference.

This problem seems to be that thread receive when it calls StreamCopy , has
a pointer to a socket and it stay bloqued in fread to read data from rs232,
so you close the telnet and open again, but the socket pointer changes the
values, and if you type a char from rs232, when it will do a write to socket
the StreamCopy function has an older pointer that not exist anymore, bang
the sistem crashs, I try to use volatile in the declareation of FILE
*cd_tcpip, but the problem persists.

Any coments about this will be welcome.

regards

Paulo

_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion



--
No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.472 / Virus Database: 269.8.11/837 - Release Date: 06.06.2007
14:03





More information about the En-Nut-Discussion mailing list