[En-Nut-Discussion] NutTcpConnect and NutTcpCloseSocket problem

CAMBON, Olivier Olivier.CAMBON at astrium.eads.net
Fri Aug 10 13:57:11 CEST 2012

Hi Ole,
Yes, the board reseted !

I understand what you said in your explanation.
This means that NutTcpSocketClose should use somewhere NutSleep(1) instead of NutThreadYeald().
As NutSleep(1) can releases the CPU to a lower priority thread...


-----Original Message-----
From: Ole Reinhardt [mailto:ole.reinhardt at embedded-it.de] 
Sent: Friday, August 10, 2012 1:19 PM
To: CAMBON, Olivier
Cc: Ethernut User Chat (English)
Subject: Re: [En-Nut-Discussion] NutTcpConnect and NutTcpCloseSocket problem

Hi Oliver,

> i found the problem !
> the function "test_connection" is called in a thread which priority is 23.
> I tried with a priority higher or equal to 32 (priority of the thread "tcpsm") and it works fine.

You say that your board resettet, right?

This might indeed point to a hidden bug in the TCP statemachine. We have
to check this further!

The lower the priority of your thread is, the higher the chance, that it
will get the CPU time on a thread-switch.

In other words: With priority 23 it is one of the highest priority
threads, supposingly only the ethernet RX thread has a higher priority.
If your thread now is callong NutTcpCloseSocket, it might came to a
scheduling point. But as no higher priorised thread want's the CPU it
might get back CPU time without waiting. A raise condition might sleep
here anywhere in the TCP stack.

I will try to implement your code on one of my boards and will try to
debug this. Hopefully I can reproduce the problem here.




Thermotemp GmbH, Embedded-IT

Embedded Hard-/ Software and Open Source Development, 
Integration and Consulting


Geschäftsstelle Siegen - Steinstraße 67 - D-57072 Siegen - 
tel +49 (0)271 5513597, +49 (0)271-73681 - fax +49 (0)271 736 97

Hauptsitz - Hademarscher Weg 7 - 13503 Berlin
Tel +49 (0)30 4315205 - Fax +49 (0)30 43665002
Geschäftsführer: Jörg Friedrichs, Ole Reinhardt
Handelsregister Berlin Charlottenburg HRB 45978 UstID DE 156329280 

Ce courriel (incluant ses eventuelles pieces jointes) peut contenir des informations confidentielles et/ou protegees ou dont la diffusion est restreinte. Si vous avez recu ce courriel par erreur, vous ne devez ni le copier, ni l'utiliser, ni en divulguer le contenu a quiconque. Merci d'en avertir immediatement l'expediteur et d'effacer ce courriel de votre systeme. Astrium decline toute responsabilite en cas de corruption par virus, d'alteration ou de falsification de ce courriel lors de sa transmission par voie electronique.
This email (including any attachments) may contain confidential and/or privileged information or information otherwise protected from disclosure. If you are not the intended recipient, please notify the sender immediately, do not copy this message or any attachments and do not use it for any purpose or disclose its content to any person, but delete this message and any attachments from your system. Astrium disclaims any and all liability if this email transmission was virus corrupted, altered or falsified. 
Astrium SAS (393 341 516 RCS Nanterre) - Capital: 16.587.728 EUR - Siege social: 12 rue Pasteur, 92150 Suresnes, France

More information about the En-Nut-Discussion mailing list