Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unplug USB cable. Hangs the Repetier ( overheat warring )
#1
Yesterday I was printing using Repetier Host for windows (windows 7 64 bit) to upload the file to SD card prepare the printing.
I preheat the printer to ABS temperature.
After I done uploading to SD card. I disconnected the printer from Repetier host then unplug the printer.
As soon as I unplug the USB cable. Da Vinci stop reflesh the LCD and the heater continue to heat up to more then 300 degree C.
Luckily I was around to turn off the printer before it burns my hot end.
Usually I did the same procedure from my macbook without issues. Now I can reproduce the problem with the window machine every time.
I also test unplug the USB cable when it is connected. It also freeze/hangs the printer. Seems the USB driver in Arduino due is not foolproof yet.
If this happen during the print .. It might cause fire to the printer.
Is there a way to debug/fix is issue?
Reply
#2
I'm not going to argue it could or could not cause fire. There is a warning on the firmware site and rh software to never print unattended.

Having said that, I start it and go to bed, start it and leave for work, etc. 90 % of the time or so my printing is unattended because really, who can sit and watch one for literally hours?

Back to the story.... I had a tall print, and sometime during the night the power glitches and the printer locked up. Bed constant full heat. The hot end was also on full heat. My print was severely discolored within about 1/2 inch of where the hour end stopped; it was black (I was printing green. ) The printer, based on height completed, had to have stayed this way for at least 4 or 5 hours. So, I suspect there is a thermal limit that will be reached. (Essentially the max temp is limited by the heat sink properties of the bed/extruder)

There was no apparent damage to the printer. I powered it off, went to work, came home, cleaned the nozzle and bed, and started printing again.

I have my suspicion this is a microprocessor issue, so there might be no real way to solve it via firmware. I don't know this for a fact, it is strictly a guess.

Did I mention it didn't catch on fire? :-O

Kieth
Reply
#3
I think the overheat issue is preventable via enable watchdog in the micro processor. Basically just reset the micro controller if it trap itself in to a loop and never get out too feed the watchdog in time.
For fixing the root cause I believe there are some where in USB-serial code has some bug during the reading/writing data section without a timeout. Once the USB disconnected the printer will stop respond to anything. With proper JTAG debuger this should be very easy to see which part of the code has issue. Unfortunately I don't have debugger to test with. I might try the watchdog route first then figure out the root cause later when I got tools to debug it.
Reply
#4
I experience these hangs from time to time too.
They got better once I connected the DV to the Macbook's built-in USB port.
But once it runs off my USB hub it seems flaky.

Was googling in the Arduino community for anything related, but did not turn up much.
I wanted to wait for the next release of RH FW to see if anything was addressed in the USB/HAL.

Ollie.
Reply
#5
I try to enable the watchdog in Variant.cpp and set watchdog feature to 1 in configure.h but it seems not working correctly. Watchdog just keeping reset the printer around every 2.5 sec. Seems something is not setting right. I summit a ticket at github, hope some one can resolve the issue.

For the overheat problem. I agree with Kieth we should be safe, unless some one try to use the aluminum heat-block with 19V power supply and the Repetier just happen to hangs. There is the video for testing thermal runaway case. Compare to cheap hot-end, Da Vinci has better hot-end construction. we should be safe on that side.
[video width=425 height=344 type=youtube]qVjWg2vuWzk[/video]
Reply
#6
To use watchdog to prevent the USB unplug to cause overheat. Here are the place you have to modify.
This may not be the right way to do it, it just my work around solution.
(1) Vairant.cpp , enable and setup watchdog here , I use default 16sec (Note: this will effect all your Due board)
remove
Code:
WDT_Disable(WDT);
replace with , 0xFFF is the max interval for watchdog
Code:
WDT_Enable(WDT, 0x0fff2fff );
(2) in Printer.cpp
find , if you run stopWatchdog here will reset the MCU, only do reset here
Code:
void Printer::setup()
{
    HAL::stopWatchdog();
change to
Code:
void Printer::setup()
{
#if FEATURE_WATCHDOG
    WDT_Restart(WDT);
#endif // FEATURE_WATCHDOG

Also find
Code:
#if FEATURE_WATCHDOG
   HAL::startWatchdog();
#endif // FEATURE_WATCHDOG
}

void Printer::defaultLoopActions()
Change it to
Code:
#if FEATURE_WATCHDOG
    WDT_Restart(WDT);
#endif // FEATURE_WATCHDOG
}

void Printer::defaultLoopActions()

(3) Configure.h
find FEATURE_WATCHDOG , change to 1
Code:
#define FEATURE_WATCHDOG 1

After flash the code , the printer will reset itself if anything hangs the MCU.
Worst case you will have printer overheat for 16 seconds.
Good luck!
Reply
#7
I do not known but watchdog implementation did not work properly on my printer - I had random reset when homing, when doing nothing, etc...
so I removed it
I digged in and found the root cause is because when using Com::printFLN or other, arduino is wait in endless loop the usb is available:
Code:
while( UOTGHS_DEVEPTISR_TXINI != (UOTGHS->UOTGHS_DEVEPTISR[ep & 0xF] & UOTGHS_DEVEPTISR_TXINI )){}
it is in Arduino\hardware\arduino\sam\system\libsam\source\uotghs_device.c
so system hang until you plug back usb cable - so I have added a timeout (actually a try number) for the write to USB function.
but because this file looks precompiled somewhere any modifications are not take in account so I have modified the calling file.

in Arduino\hardware\arduino\sam\cores\arduino\USB\USBCore.cpp
look for
Code:
uint32_t USBD_Send(uint32_t ep, const void* d, uint32_t len)
function

and add
Code:
int count=0;
        while( UOTGHS_DEVEPTISR_TXINI != (UOTGHS->UOTGHS_DEVEPTISR[ep & 0xF] & UOTGHS_DEVEPTISR_TXINI ))
            {
                count++;
                if (count>10000) return len;
            }
like below
Code:
uint32_t USBD_Send(uint32_t ep, const void* d, uint32_t len)
{
    uint32_t n;
    int r = len;
    const uint8_t* data = (const uint8_t*)d;

    if (!_usbConfiguration)
    {
        TRACE_CORE(printf("pb conf\n\r");)
        return -1;
    }

    while (len)
    {
        if(ep==0) n = EP0_SIZE;
        else n =  EPX_SIZE;
        if (n > len)
            n = len;
        len -= n;
Code:
int count=0;
        while( UOTGHS_DEVEPTISR_TXINI != (UOTGHS->UOTGHS_DEVEPTISR[ep & 0xF] & UOTGHS_DEVEPTISR_TXINI ))
            {
                count++;
                if (count>10000) return len;
            }
Code:
UDD_Send(ep & 0xF, data, n);
        data += n;
    }
    //TXLED1;                    // light the TX LED
    //TxLEDPulse = TX_RX_LED_PULSE_MS;
    return r;
}

I put 10000 tries as under I got some data lost when plugged and this value looks working fine
for those like me who were not able to implement watchdog properly it is an easy and I think good solution
Reply
#8
Soon I will be installing Repetier to my dv 1.0. Will the issues mentioned in this thread be avoided if my Mac never goes to sleep, and I do not unplug usb?
Reply
#9
the issue happen if connection with repetier host is open and interrupted when open - many possibilities to generate this situation
Reply
#10
The easy way to avoid it is just using Raspberry pi with Octopi as printing server. So you will never have unplug issues.
Reply
#11
I do not know but drbogger has issue and he uses octopi as well check my github:
https://github.com/luc-github/Repetier-F.../issues/43
Reply
#12
Currently without luc's USB send code fix or enable watchdog, unplug USB will hang the printer for sure. Using Octopi just reduce the chance to unplug USB.
I power my Raspberry Pi with DaVinci's 5V. This setup make me run the printer for month no problems.
Reply
#13
I have witnessed a power glitch cause the problem while printing from sd card with no usb cable connected. I believe the watchdog timer to be the only real solution.

I wonder why the watchdog want enabled from day 1.

Kieth
Reply
#14
The repetier work092 brench has working watchdog solution. If anyone want to try it. Here is the link Commit for Fixed watchdog support for due, Fixed hangs on file select

Note: you still need to modify Vairant.cpp , setup watchdog.

Steven
Reply
#15
Quote:in Arduino\hardware\arduino\sam\system\libsam\source\USBCore.cpp

I don't have the above, but I do have:

C:\Program Files\Arduino\hardware\arduino\sam\cores\arduino\USB\USBCore.cpp

Is it ok to make the modifications there? I'm running Arduino 1.5.8 in VMWare on a Macbook.
Reply
#16
Yes your path is correct - I put wrong one ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)