Lost connection with USB and TCP/IP

  • Hello,


    I'm using the kernel 1.26 and have often lost/interrupted connections with usb and tcp/ip.
    When I'm debugging via active snyc and USB it works for a while an then I often receive following message:

    Quote

    Die Remoteverbindung mit dem Gerät wurde unterbrochen. Ãœberprüfen Sie die Verbindung mit dem Gerät, und starten Sie das Debugging erneut.


    I get this message always, when I debug several minutes. My target device hangs then and I have to switch it off/on. Connection by USB cable is fine. Problem occurs on all NetDCU11 boards. It's very frustrating always when you are very close to detect an error, and the debugger is closed with mentioned message!


    I also have problems with network connections. They are often interrupted and my program does not recognize it. After close connection and open it again manually, connection works again for a while. I also found out that sometimes (after a new start) the network connection icon is very quick and shows a connected state immediately and sometimes it takes up to one minute to detect a connected state.
    With NetDCU6 boards there were no such problems.


    Best regards, Kaiser

  • Hello,
    do you run high priorisized threads within your application? And can you switch to a lower priority while "#ifdef DEBUG"?
    Does this help?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello!
    I'm using the the method CreateThread(), which generates threads with THREAD_PRIORITY_NORMAL priority by default. No change is done.
    I have approximated 2-4 threads with this priority and think this should not cause this problems?
    This threads are responsible for communication with CAN, COM and network.

  • Hello,

    Quote

    I have approximated 2-4 threads with this priority (THREAD_PRIORITY_NORMAL) and think this should not cause this problems?

    Ok, i think you are right. I will check further options. Do you have a (simple) sample which shows me the problem?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • I don't know how to help/support you. A sample would be my whole project - a bigger one. I try it now with a smaller tool and hope to get the same error but I don't use there a network connection - only debugging via USB. The sourcecode of the main program is the same as on NetDCU6 and I had there no problems.


    Interrupt happens irregular and occasionally - I can't reproduce it. Today I needed about 60min to get a lost connection. It is generally very short - after one second connection is there again (browse with ActiveSync works again), but Debugger was closed and program hangs (when debugging). In release version the program does not hang, but network connection is lost.
    Also the network connection works again quickly after interrupt. Unfortunately I have to close the socket of my program and open it again manually to continue communication. An automatic recognition of interrupted network connection is not possible.


    It seems that both (USB and network) are interrupted together.

  • Hello

    Quote

    It seems that both (USB and network) are interrupted together.

    Yes, both are using tcpip!
    Did you try several complier options (project setting ->...->C/C++->optimization)?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello,
    I have optimized the release version with "maximize speed" (/O2) which has caused network interrupts.
    The debug version was without optimization and had also caused usb and network interrupts.
    Now I'm testing debug version with "complete optimization" (/Ox). Will write later if it's better.

  • Hello,
    I have to tell you that the debug version with complete optimization has the same problems.
    I had one interrupt after creating a connection by serial interface. But I can't reproduce that.Maybe that was only good/bad luck?
    I can't remember the earlier interrupts had something to do with my serial connections. But could this be possible/a reason?

  • Hello,

    Quote

    I had one interrupt after creating a connection by serial interface

    Can you give me details about this? Maybe there is a bug in driver or driver handling from kernel?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello,
    yes I'm using on COM2 a serial Modbus RTU protocol to connect to an external machine.
    Settings are 9600,8,1,None.
    For that I'm using the free libmodbus library in version 3.0.1. http://www.libmodbus.org/
    For tests with connection I use a Modbus RTU Server v1.1. This can be downloaded on several freeware hosters like
    http://www.brothersoft.com/modbus-rtu-server-292457.html
    However, I'm not sure if that's the reason because I can't reproduce it.

  • Hello,
    I have now updated the libmodbus to version 3.0.2 and the kernel to 1.27 (bootloader 1.39) but there is the same problem.
    This time the connection was interrupted while program start (and maybe connect to serial port) in debug mode without compile optimization.

  • Hello,
    I have to say that it happened again with versions mentioned above.
    Now program was running in debug mode and nothing has been done. No user input. Serial port was opened but no communication took place.
    Then the USB connection to debugger was interrupted.

  • Hello,
    -update-
    Now I have another strange behavior. While debugging with visualStudio 2008 the tool Microsoft ActiveSync played sound and shows me that I'm not connected with display any more. But the connection to debugger is still there and I can break and debug as usual. After a few minutes the connection to debugger also broke down.

  • Hello,
    you should keep in mind that a lot of processes and theads are active while debugging. ActiveSync may not be able to handle this, did you try debugging over Ethernet? Refer http://www.fs-net.de/download/bin/->Tools->VS LAN Connection (use NOT the files attached you will find them also on your VS Install directory). Does this help?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello,
    I tried your suggestion. All worked fine until now.
    Now I received the same error message like in the first message of this thread:

    Quote

    Die Remoteverbindung mit dem Gerät wurde unterbrochen...


    Completely the same behavior: Debugger is closed and display program hungs.
    COM-Port and network communication was active/opend but not used at the moment the interrupt occurred.


    I'm not wondering because the network connection was interrupted also with my first posts.


    I have also to mention, that network interrupts also occur in release mode (without use of USB).

  • Hello i cannot found any problem related to your description!
    - When you debug via Ethernet you are connnected via Ethernet only, means USB device cabe is detached?
    - What happens if you decrease HKLM\drivers\builtin\usbfn\Priority256 drastically?
    - Which hardware do you access and which Priortiy256 values set under HKLM\Drivers\Builtin\<driver>?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello

    Quote

    - When you debug via Ethernet you are connnected via Ethernet only, means USB device cabe is detached?

    Yes, USB cable is detached when debugged over network.

    Quote

    - What happens if you decrease HKLM\drivers\builtin\usbfn\Priority256 drastically?

    I have to test but I am out of office until monday. Can tell you afterward more.

    Quote

    - Which hardware do you access and which Priortiy256 values set under HKLM\Drivers\Builtin\<driver>?

    I use for all hardware the default values, I mean I have nothing changed after installation of kernel.
    Serial1 and Serial2 have no value Priority256
    Usbfn has DWORD=100
    CAN1 has no value Priority256
    Network/Ethernet (propably Ethman?) has no value Priority256


    It's strange but this week I had no interrupts over USB cable until today. Have nothing changed. I only remember I haven't used network - but only serial connection and USB debugging.

  • Hello,


    I have tested it now with "HKLM\drivers\builtin\usbfn\Priority256 drastically=10" (the old value was 100, but I haven't detected a difference - debugger is running without problems. I think after a time the problem occurs again.


    Today in the morning I was installing a software and used ftp+usb connections. No software was running and I had again a connection interrupt. Both connections has been closed and opened again after a few milliseconds automatically. But my ftp client was then not able to transfer any files. after a restart it worked again. So when no software was running I think it cannot be a problem of our software.