I'm trying to control an unknown stepper motor with the high-end timer (NHET) module of a Texas Instruments Hercules microcontroller

I got a freebee from TI almost a year ago. An unknown stepper motor, a driver board and a Hercules RM57 LaunchPad. The code to run the motor was expected to arrive too (it was an assignment for an internal) but that never materialised. In this blog series I'm trying to program the NHET module so that it sends the right signals to make the stepper step.



In the second post I analyse the example program for the MSP430 microcontroller and try to link it to the datasheet of the controller.



Stepper Motor Controller

I'm using a DRV8711DRV8711. Its main purpose is to control a stepper (although it can also act as a 2 DC motor driver).

source: datasheet


The behaviour of the IC is controlled via SPI. You can set various parameters such as the step divider (allows you to take micro steps down to 1/256 of a step) and speed-up /wind-down profiles.

One of the more challenging attributes is the blanking time. If that's applied smartly, you can have a smooth rotating stepper motor.

All configurations are register based and programmable via that SPI interface.

The datasheet for the DRV8711 explains this in much detail. But it's easier to use the demo application for the BoosterPack. It shows on-screen what values are set i  the register.

You can see - and change - how the motor behaves and validate the register settings directly in that app.

source: BoosterPack demo app connected to an MSP430G2 LaunchPad


Understand the FirmWare

For me, as a non-MSP430 expert, cracking the firmware is like resolving an enigma. I have the code and it has comments telling what's done - roughly.

Still it takes significant time unraveling the underlying functionality. It's not my specialty - and if I'm trying to both understand code flow while not knowing the registers yet. I have a hard time.

I may take a shortcut and put a logic analyser between controller and chip. That way I understand better when SPI is used and when there's a pulse train coming from the PWM module.



What I've detected so far is that there are 3 timers set up. A0, A1 and the watchdog.

Interrupts are captured for the timers, for some GPIO pins (I think Fault and Stall), ADC, serial (for communication with the GUI running on the PC or for DPI?) and for a comparator.


A thing that I can certainly reuse is the SPI module. The settings are fairly easy to understand and the program structure is clear for SPI.

Whenever it comes to the logic applied to accelerating, de-accelerating and pulsing steps to the controller, it becomes more fuzzy.

It seems that the watchdog timer is involved in that, in combination with at least one generic timer that gets reprogrammed during the rotations.

I'll need to find out how that works. With the code and logic analyser at hand - I may have to pull in one of my MSP430-savvy friends when needed.


Related Blog
Part 1: Hardware Overview
Part 2: Stepper Controller and MSP430 Firmware
Part 3: SPI Commands and Pulse Control
Part 4: Analyse MSP430 PWM Step Signal
Part 5: Hercules RM57 Hardware Provisioning
Part 6: Hercules RM57 SPI
Part 7: HET Assembly Language Test
Part 8: HET Based Pulse Train Output