NetBurner SAME70 Stepper Motor Interval Timer Example
Overview
This example demonstrates how to use the NetBurner SAME70 platform's interval timer functionality to generate precise timing signals for stepper motor control. The application configures a hardware timer to produce step and direction signals that can drive stepper motor controllers.
Supported Platforms
Features
- Hardware-based interval timer configuration
- Variable step frequency control (steps per second)
- Bidirectional control (up/down counting)
- Real-time command interface via serial console
- Timer channel configuration for stepper motor applications
Hardware Configuration
Pin Assignments
MODM7AE70:**
Timer Configuration
The application uses Timer Channel 11 (STEPPER_TIMER) configured in stepper mode with the following features:
- Configurable frequency from 0 to several thousand steps per second
- Direction control via up/down counting
- Hardware-generated step pulses
- Interrupt-free operation for precise timing
Application Flow
System Initialization
|
v
Pin Function Setup
|
v
Timer Allocation
|
v
User Command Loop
|
v
+-------------+
| User Input |
| <steps><dir>|
+-------------+
|
v
Process Command
|
+----+----+
| |
v v
Update Stop
Timer Timer
User Interface
The application provides a simple command-line interface for controlling the stepper motor timing:
Command Format
Where:
- Steps per second: Integer value (0 to stop)
- Direction: 'U' or 'u' for up, 'D' or 'd' for down
Usage Examples
> 300D
300 steps per second, counting Down
> 2000U
2000 steps per second, counting Up
> 0U
Stop, 0 steps per second
Key Functions
Timer Management
InitStepperTimer(int pps, bool dirUp) - Initialize timer with frequency and direction
UpdateStepperTimer(int pps, bool dirUp) - Update running timer parameters
StopStepperTimer() - Stop timer operation
Hardware Configuration
- Pin function assignment for timer outputs
- Timer channel configuration in stepper mode
- Interrupt disable for hardware-only operation
Important Notes
- On MODM7AE70 MOD-DEV-70, P2.28 is connected to SPI DOUT, so the flash card socket must be empty when using this example
- Timer interrupts are disabled to allow pure hardware generation of step signals
- The timer operates independently once configured, providing precise timing without CPU intervention
- Direction changes and frequency updates can be made in real-time
Application Notes
This example is particularly useful for:
- Stepper motor control applications
- Precision timing signal generation
- Learning SAME70 timer capabilities
- Hardware-based pulse generation without software overhead
The hardware timer approach ensures consistent timing regardless of CPU load or interrupt activity, making it ideal for applications requiring precise motor control timing.