-
Notifications
You must be signed in to change notification settings - Fork 298
Using Pin Changes for Timing (and light debugging)
Rob Giseburt edited this page Mar 25, 2015
·
9 revisions
Making pin changes in the code can allow you to do timing using a logic analyzer or a scope. You can use it for some minor debugging or debugging where the timing is hard to tell with a debugger.
Pin changes are not a substitute for a proper debugger.
- Go to the motate_pin_assignments.h file, e.g. in the
v9_3x8c/motate_pin_assignments.h
file, and swap the pin you want to "steal from" with the debug pin you want
Say spindle change:
pin_number kSpindle_EnablePinNumber = 112;
to
pin_number kSpindle_EnablePinNumber = -1; // was 112
- Assign one or more debug pins to pins you want to temporarily "take over".
pin_number kDebug1_PinNumber = 112; // using the spindle pin temporarily
pin_number kDebug2_PinNumber = -1;
pin_number kDebug3_PinNumber = -1;
pin_number kDebug4_PinNumber = -1;
- Then at the top of the file you want to instrument, put (or, more likely, uncomment) the
OutputPin<>
definition. For example, at the top of plan_exec.cpp now is:
//OutputPin<kDebug1_PinNumber> exec_debug_pin1;
//OutputPin<kDebug2_PinNumber> exec_debug_pin2;
OutputPin<kDebug3_PinNumber> exec_debug_pin3;
//OutputPin<-1> exec_debug_pin3;
- Now, in that file, anywhere you want to set the pin:
exec_debug_pin3 = 1;
and the clear it:
exec_debug_pin3 = 0;
PLEASE -- don't git commit the changes to the motate_pin_assignments.h
file.
ALSO -- avoid putting more than just the pin changes in. if...then
statements around the pins can easily have side effects, and it you're just timing or doing light debugging, you don't want that.
Getting Started Pages
- Home
- What is g2core?
- Who uses g2core?
- Jerk-Controlled Motion
- Getting Started with g2core
- Connecting to g2core
- Configuring g2core
- Flashing g2core
- Troubleshooting
Reference Pages
- Gcodes
- Mcodes
- Text Mode
- JSON Communications
- GPIO Digital IO
- Alarms & Exceptions
- Power Management
- Coordinate Systems
- Status Reports
- Status Codes
- G2 Communications
- Tool Offsets and Selection
- Probing
- Feedhold, Resume, Job Kill
- Marlin Compatibility
- 9 Axis UVW Operation
- gQuintic Specs
Discussion Topics
- Roadmap
- GPIO for 1.X Releases
- Toolheads
- Raster Streaming Prototol
- g2core REST Interface
- Gcode Parsing
- G2 3DP Dialect
- Consensus Gcode
- Digital DRO
- Overview of Motion Processing
Developer Pages
- Development & Contribution
- Branching and Release - DRAFT
- Getting Started with g2core Development
- Project Structure & Motate
- Compiling G2
- OSX w/Xcode
- OSX/Linux Command Line
- Windows10 w/AtmelStudio7
- Debugging G2 on OSX
- Board and Machine Profiles
- Arduino Due Pinout
- Arduino DUE External Interfaces
- Diagnostics
- Debugging w/Motate Pins
- Development Troubleshooting
- g2core Communications
- Git Procedures
- Windows 10 / VMware 8 Issues
- Dual Endpoint USB Internals
- G2core License
- VSCode Setup
- Compatibility Axioms
- Wiki History