Welcome! Log In Create A New Profile

Advanced

Understanding the firmware

Posted by tatagatha 
Understanding the firmware
April 26, 2010 02:00PM
Hello,

While I've got a pet project that will eventually result in a custom firmware, I'm trying to understand somethings that are going on in the current 3g firmware, before I'm slicing it up.

Quick background on my pet project: This is a learning project to build a simple pen plotter that
a) implements the communications protocol rather than interpret directly on an microcontroller (in my case, always an arduino). This way, the plotter can be driven with replicator-g and at a later date, some other controller.
b) Uses the motor shield from adafruit.

What I've figured out for the firmware.
    1) I'm actually going to be using the sanguino master firmware as a base, with all references to Serial1 removed since I'm using an arduino and I'm not communicating with any other slave controllers.
    2) I'll be writing my own PacketProcessor switch cases for the two handle_query functions.
    3) The loop has three parts
      - Check for new packets. Add it to the command queue if queue-able and or respond if its an inquiry.
      - handle commands - pull command off the queue and do. Most frequently, the do is a queue point command.
      - check my end stops

What I don't understand.
If the the handle_command function is queueing up points. When/where is the code that actually issues the steps. I see do_step called from the SIGNAL handler, but I'm not sure how that code gets executed.
Re: Understanding the firmware
April 26, 2010 03:28PM
The SIGNAL handler is just an interrupt handler. It will be generated by a timer.


[www.hydraraptor.blogspot.com]
Re: Understanding the firmware
April 26, 2010 04:47PM
Ahhh...! So there is a timer that is just ticking like a clock and each tick interrupts the normal operations (the collection of packets, the processing of those packets, and the checking of the optos) to do the actual stepping. And the timer is set up when initializing the stepper code. The program pops back and forth between the higher level operational code and the stepping code by way of the interrupt.

It is slowly coming into view.

Pausing a build is just turning off the response/handler to the timer, but not turning off the timer itself. (is this statement true?)
Sorry, only registered users may post in this forum.

Click here to login