A4982-Dual Stepper Board

From RepRapWiki
Jump to: navigation, search

Crystal Clear action run.png

Release status: Experimental

Description A4982 Dual Stepper Board with STM8 MCU for VREF / MS1 / MS2
License GPLv3+
Author lkcl
Based-on [[]]
Categories Electronics, Stepper motor drivers, Surface-mount_electronics
CAD Models Eagle
External Link [1]


Dual A4982 Expansion Board

A 48x68mm expansion board providing two 2.0A A4982 stepper drivers, designed for general-purpose use on a wide range of 3D Printing Electronics, powered from 9-29 volts DC, compatible with 3.3v and 5v boards, and providing an on-board NTC temperature resistor, dual STEP/DIR/EN for motor control and an STM8 MCU for software-driven configuration of VREF, MS1 and MS2. Also the STM8 (which is optional) may be programmed to run completely independently, potentially running its own G-Code firmware and being controlled through standard reprap G-Code motion control software (pronterface, Cura etc).



  • Two independent A4982 steppers
  • Experimental 2-layer (1oz copper) design
  • Relatively large PCB to support proper thermal dissipation (48x68mm)
  • 1 on-board 100k NTC with a 4.7k bias
  • compatible with 3.3V or 5V electronics
  • Supports Motor DC Power input from 9 up to 29 volts.
  • 14-pin 2.54mm DIL Header with 1 ADC (thermistor), I2C (communication with the STM8) and SPI (unused)
  • On-board (optional) STM8 MCU which may be programmed to independently set MS1, MS2 and VREF for each A4982 stepper
  • Optional jumpers and Potentiometer for cost-saving scenarios or manual configuration.
  • STM8 may be programmed to run cut-down versions of Marlin (or other) firmware and may directly control each A4982 stepper.

Design considerations

The A4982 was chosen over the A4988 due to the A4982 being a 2A stepper, a TSOP package (which may be hand-soldered), and the fact that it has a large Exposed Pad for much better thermal dissipation. However unlike for example the TMC2130 and TMC2660 there is no simple means to control the maximum current or the micro-stepping.

On the Duet 0.6, 0.8.5 a quad Digipot IC is used which provides the reference voltage instead of requiring a manually-adjusted potentiometer. However the cost of digipot ICs actually exceeds the price for one A4982 stepper driver IC. By contrast, the STM8S003F6P6 - a 20-pin TSSOP - is around $0.30 to $0.40 even in small volume. It also operates anywhere from 2.9 to 5.5v volts so is perfect for

By using an STM8S it is possible to generate both VREF signals using PWM and a simple RC circuit. Given that the voltage range could be as high as 5v (matching the supply voltage), a resistor-divider bridge has been deployed to cut the VREF in half. Previous iterations of the design connected each PWM RC circuit directly back to one of the ADC pins, with a view to actually being able to reasonably accurately measure the voltage (hence the resistor-divider bridge). However, with the number of available pins being so limited this idea had to be dropped.

Also originally the SPI interface was to be connected, but again, with a limited pincount a decision was made instead to allow the STM8 to provide software-programmed control over MS1 and MS2 of each of the steppers, so that the micro-stepping can be set from the main Controller board's firmware in addition to being able to independently set each VREF.

In the instance however where people do not wish to use the STM8, the possibility of being able to set the voltage with a potentiometer was left in, and likewise for the micro-stepping settings: MS1 and MS2 jumpers were left in.

Part-way through the development process it was realised that there might be enough pins to connect the two sets of STEP/DIR/ENABLE# lines up to the STM8, and also put the UART TX/RX onto an external header. This was quite exciting as it would mean that the possibility existed for the STM8 to have a port of, for example, an extremely cut-down version of Marlin firmware. The STM8 only has something like 8k of EEPROM so any programs running on it have to be extremely small.

The STM8S003 was initially chosen as it is incredibly low cost: $0.24 in volume and it provides I2C, UART, ADC, PWM and SPI, where a dual I2C digipot is in excess of $0.70. What is nice about the STM8S series is that there are pin-compatible upgrades (STM8S103 for example) which could be used instead.

The 14-pin connector and motor connectors, if right-angle are used, means that multiple dual stepper boards can be stacked into a Controller in a similar fashion to BAM&DICE. Also, if all connectors and through-hole components (capacitors, power connector) are placed on the underside (bottom of PCB), there is room on the rear of the PCB to place heat-sinks as well just underneath each A4982's Exposed Pad. This would give better thermal dissipation than putting the heat sink on the (insulated) package, yet at the same time allow stepper board stacking clearance of around 10-12mm.

Update: a decision has been taken, because of the opportunity to run this board with its own G-code firmware, to connect both XENABLE# and YENABLE# together (who needs to disable just one of the motors?), freeing up one pin that may in turn be connected to the NTC. Also that means that some Controller boards, which may not have a free ADC pin, may instead use the I2C interface to communicate with the STM8 and obtain the NTC reading (temperature of the PCB) that way.

STM8 Header

  • Pin 6: GND
  • Pin 5: UART TX
  • Pin 4: UART RX
  • Pin 3: SWIM / XMS1
  • Pin 2: RST# (low to reset)
  • Pin 1: VCC

AUX2 Header

AUX2 is a 14-pin (2x7) header at the left of the board. Pin 1 is marked (bottom right, row 9). This header has two sets of STEP / DIR / ENABLE# lines (one per stepper), I2C (for communication with the STM8) and an ADC sensor which is connected to a 100k NTC thermistor in the middle of the PCB. The NTC thermistor may be used to check the temperature, to detect if the PCB is overheating. The SPI pins of this header are unused and should not be connected.

  • Pin 14 (row 1, left): SCL (for communication with the STM8)
  • Pin 13 (row 1, right): SDA (for communication with the STM8)
  • Pin 12 (row 2, left): NC
  • Pin 11 (row 2, right): STEP2
  • Pin 10 (row 3, left): NC
  • Pin 9 (row 3, right): DIR2
  • Pin 8 (row 4, left): NC
  • Pin 7 (row 4, right): MOTEN# - pull low to enable BOTH MOTORS.
  • Pin 6 (row 5, left): NC
  • Pin 5 (row 5, right): STEP1
  • Pin 4 (row 6, left): 100k NTC Thermistor, 4.7k biased.
  • Pin 3 (row 6, right): DIR1
  • Pin 2 (row 7, left): VCC
  • Pin 1 (row 7, right): GND

Flashing the STM8

TODO: use stm8flash, easiest way, get an STLinkV2. TODO: write/find firmware for arduino which substitutes for an STLinkV2 (http://kuku.eu.org/?projects/stm8spi/stm8spi is a good starting point)

Source, BOM, Schematics