stefanix / LasaurGrbl

This is grbl for the Lasersaur. Grbl is a g-code-centric CNC controller and Lasersaur is an open source laser cutter.
http://lasersaur.com/
42 stars 14 forks source link

geometry errors (mostly on norcham branch) #7

Closed stefanix closed 12 years ago

stefanix commented 12 years ago

Symptoms: gcode lines get dropped or scrambled leading to flattened curves and spikes in the cuts.

Suspicion: serial flow control and/or transmission buffers drop characters leading to lines being disregarded or inadvertenly changed

stefanix commented 12 years ago

New suspicion: The avr's serial port interrupt does not get called on time because the stepper interrupt is fairly long. At 9600bps no other ISR may block for more than 104 microseconds ( this is 1664 instruction as one instruction takes 62.5ns@16MHz or probably less because of ISR overhead). At 57600bps this amounts to 17.3us or 277 instructions.

Will drop the bps and see if this helps ...

Find a good intro here: https://binglongx.wordpress.com/2011/10/26/arduino-serial-port-communication/

chamnit commented 12 years ago

I've been studying up on interrupt functionality this weekend to track down a premature step end bug that I noticed when I plugged grbl into an oscilloscope for the first time (which has been fixed now.) The both stepper interrupts are very short and the long one can be interrupted by the serial rx/tx interrupts after the sei() command is called. Or at least it should. As far as I have noticed, the time for non-interruptible execution of the stepper interrupts is on the order of a 3 usecs.

chamnit commented 12 years ago

One more thing. I had a similar problem when I forgot that the serial ring buffer is one less than the defined size of 256, due to one of the bytes is used for tracking the beginning and end of the ring buffer. This one drove me nuts for a couple of days.

stefanix commented 12 years ago

In the rewrite of the flow control this got resolved.