tx_thread_create fails when ethernet cable is unpluged

Hello,

Application details:

  • Digi connectME ( -C jtag and S)
  • NET+OS Version 7.1
  • Uses ftp, cli, web server ( original, without user modifications)
  • Custom user thread for tcp-ip/serial bridge ( it does XML parsing and glue to an RS232 ASCII protocol)
  • Custom thread uses NAReset if no activity (on TCP) is detected within a certain amount of time.

When network cable is connected everything works ok.
If network cable is disconnected, application gets an auto-ip (as expected) and then fails to create custom thread, tx_thread_create returns with error code 14 - TX_THREAD_ERROR.

Thanks in advance,
Márcio Correia

Before going to your issue, i would like to clarify that NETOS applications do not work on -S modules. Those are plug and play modules you cannot load custom firmware on it.

-C, yes they are NETOS modules.
Try disabling auto-ip in appconfig.h

APP_ENABLE_AUTO_IP

My first (back of the envelope) guess would be that your issue is NOT directly tied to the cable not being plugged in and that this is a side effect of something else.

To that end I would check a could of things, as follows:

The thread control block (the TX_THREAD object) must be static global or malloced. That is it can not be allowed to go out of scope.

The thread control block (The TX_THREAD object should be cleared out before use (memset(theObject, ‘\0’, sizeof(TX_THREAD)).

Ensure you clear out the thread stack before use.

From what I can see the TX_THREAD_ERROR is defined as :
“Invalid thread control pointer. Either the pointer is NULL or the thread is already started.” Any chance you are trying to restart a thread that is already started?

1 Like