Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New atomic operation through RIAA (prevent due hang?), cold extrusion…
… command, bug fixes
- Loading branch information
Showing
33 changed files
with
1,817 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due (RepRap Duet) hangs anyway..the worse thing is that it hangs randomly
Where can be the cause? (Even with Serial object it hangs)
Is it possible to trace with JTAG?
Really waiting for your reply
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have a board with jtag interface that could help. I don't have it, so I make guesses and try again. Which is difficult since it seems not possible to force the hang with some simple commands. So a good print is no guarantee. Strangest thing of all is that it is the same code as for avr which seems to run with no problem. So it must be something arm specific (guess).
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a Due and am wiring it up to use a set of loose stepper-boards I have.
I also have a jlink adapter so I can try and see what's going on later.
I'll see if I have time to check the usb stuff too as I expect it is possible to handle this by using a soft timeout. The usb subsystem will never take more than a set ammount of time to be ready to transfer a packet so we can handle the missing connection.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to remove USBSerial at all from Arduino core...
It didnt help! So the problem isnt USB as it seems.
Also i tried to just put leds and turn it on when Due is in interrupt.
When it hangs it isnt in any interrupt (as i see,but not clearly).
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kyrreaa ,try to catch address or function in where it hangs
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also have ordered a jtag interface now. Hope the error occurs also with a naked due and does not take too long. On etester needed 40h to get it the first time. Long debug run!
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So..
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's now running for 3 days without any errors inside the debugger. And I only removed one one overflow bug if pdm was enabled in HAL.cpp
the +3 was missing. I think the hang was already before. Anyway I'm testing with fixed line without hang. Anyone else who could cause the hang with a naked board?
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to run& debug too...
Big thanks for info about this bug!
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you compiling with Arduino 1.5.x or with Makefile+arm-gcc...?
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With atmel studio using a very home brew configuration which includes the files of arduino as sources as well, so i can debug them as well. That was the easiest solution since the jtag works great within Atmel Studio. If you want I can send you the project also you would need to update the path settings to the gcc libraries. Just drop me a real mail so I can mail you the link.
Maybe that reorderd the data in a bad way, meaning removing the problem since the overwrite (if it is one) doe snot happen where it causes a damage.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try it(both master & 092 branch)
You can also try just to compile via Arduino IDE
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But how can I debug it then, if I compile with Arduino IDE? Compilation result must match my debug informations or I have still no clue what happens.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can send Atmel project to me
mail: (mynickname)@gmail.com
Thanks!
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mushketer888 Mail is on its way
@kyrreaa Don't understand what you mean. When I press debug in Atmel Studio it always starts the current project, compiles it and uploads it. How can I tell to use a external binary instead?
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
just wanted to let you know that the hangs also occur if the DUE is not connected to any host via USB. In my case I'm using DUE+RADDS+RADDS-LCD and I always print from SD-Card. It randomly hangs as described above. Strange enough, the very same gcode might print ok another time.
Are we sure, that the DUE just ain't picky about electromagnetic influences?
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding this special error nothing is sure:-) We had it with host or sd print, with h-belta nd delta printers, but I lost a bit track of the other combinations that already had that error. Especially since it is hard to see if it is always the same error. Only the fact, that is is already very rare lets us asume it is one error. Checking the interrupt handlers I even saw that the default interrupt handler is an infinite loop, so any normally unused interrupt would also cause a hang. Also I think the NMI interrupt is the most likely if it is a interrupt.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I compiled from Atmel Studio...
No hangs yet at all!!
Testing..
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, just found some more bugs in the HAL.cpp cooler handling which I fixed with latest update. Now there is no buffer overflow any more.
@mushketer888 Your version still contains the bug but no overflow.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
I updated latest changes
Running
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From USB it prints normally (as far as i go)
But with Due Software SPI it hangs randomly
Looks like something with software spi+interrupts (maybe interrupts damage spi bits etc)
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope it hangs anyway...strange (with or without software spi) usb<->spi
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So which version did hang? The one from Atmel Studio? Did it stop in debugger or just uploaded from studio?
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From Atmel with latest changes
I didnt connect debugger yet (cause i will use OpenOCD)..
I just uploaded .bin from studio
Now i disabled software spi,sd at all and testing..
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you using software SPI?
Anyhow you seem to get more errors with my Atmel version then I get, so if you send me your Config I can test that instead. Does not look like my settings are going to crash for me.
Did you test naked board or real printing? I'm only testing naked because I need to disable watchdog to see hang and that is dangerous as we know.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I got a hang while in debugger after a week of running. Hang occured in this function:
void HAL::microsecondsWait(uint32_t us)
{
uint32_t usStart, goal;
}
more precisely in
while(goal > TC_ReadCV(DELAY_TIMER, DELAY_TIMER_CHANNEL));
with goal = 0xffffffff
As everyone can see the likelyhood that read time is larger is extremely low. Also I think the function is not very accurate. Now I switched to the arduino version and hope it works as expected. This version is slightly faster whcih caused my lcd to not initalize correctly - I added some more delay there.
That also means that eventually your STEPPER_HIGH_DELAY may be to low now if you needed them.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I do timer delays is much simpler and bug free.
It handles wrap around implicitly as long as start is the same size as the timer.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
794df83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I think the Arduino solution I now use is most accurate
A simple loop knowing a cycle take 3 ticks. So overhead is a multiplication and that bge takes a tick longer when it leaves the loop. It is blocking but thats ok. We normally call it from interrupt for a 1us or 2us wait and that is not enough for writing a multithreaded firmware.
@nophead Your solution also works perfect, but a function call may be more overhead so timing would be correct time + [0..function call + sub + compare]. In case of the due it is not much and also would work well, just a little bit less inaccurate (< 1us I think).