stepRocker servo Open Source TMCL  1.00
 All Data Structures Files Functions Variables Typedefs Enumerations Macros
Functions
TMC429.c File Reference

TMC429 Stepper controller functions. More...

#include "derivative.h"
#include "bits.h"
#include "stepRocker.h"
#include "TMC429.h"
#include "Globals.h"
#include "SPI.h"
#include "TMC262.h"
#include "IO.h"
Include dependency graph for TMC429.c:

Functions

void ReadWrite429 (UCHAR *Read, UCHAR *Write)
 32 bit SPI communication with TMC429 More...
 
void Write429Bytes (UCHAR Address, UCHAR *Bytes)
 TMC429 write access. More...
 
void Write429Datagram (UCHAR Address, UCHAR HighByte, UCHAR MidByte, UCHAR LowByte)
 TMC429 write access. More...
 
void Write429Zero (UCHAR Address)
 Write zero to a TMC429 register. More...
 
void Write429Short (UCHAR Address, int Value)
 Write 16 bit value to a TMC429 register. More...
 
void Write429Int (UCHAR Address, int Value)
 Write 24 bit value to a TMC429 register. More...
 
UCHAR Read429Status (void)
 Read TMC429 status byte. More...
 
UCHAR Read429Bytes (UCHAR Address, UCHAR *Bytes)
 Read TMC429 register. More...
 
UCHAR Read429SingleByte (UCHAR Address, UCHAR Index)
 Read TMC429 register. More...
 
int Read429Short (UCHAR Address)
 Read TMC429 register (12 bit) More...
 
int Read429Int (UCHAR Address)
 Read TMC429 register (24 bit) More...
 
void Set429RampMode (UCHAR Axis, UCHAR RampMode)
 Set the ramping mode of an axis. More...
 
void Set429SwitchMode (UCHAR Axis, UCHAR SwitchMode)
 Set the end switch mode. More...
 
UCHAR SetAMax (UCHAR Motor, UINT AMax)
 Set the maximum acceleration. More...
 
void HardStop (UINT Motor)
 Stop a motor immediately. More...
 
void Init429 (void)
 TMC429 initialization. More...
 

Detailed Description

TMC429 Stepper controller functions.

Author
Trinamic Motion Control GmbH & Co KG
Version
2.20

This file provides all functions needed for easy access to the TMC429 motion control IC.

Function Documentation

HardStop ( UINT  Motor)

Stop a motor immediately.

Parameters
Motormotor number (0, 1, 2)

This function stops a motor immediately (hard stop) by switching to velocity mode and then zeroing the V_TARGT and V_ACTUAL registers of that axis.

Here is the call graph for this function:

Here is the caller graph for this function:

Init429 ( void  )

TMC429 initialization.

This function does all necessary initializations of the TMC429.

Here is the call graph for this function:

Here is the caller graph for this function:

Read429Bytes ( UCHAR  Address,
UCHAR Bytes 
)

Read TMC429 register.

Parameters
AddressTMC429 register address (see TMC429.h)
BytesPointer at array of three bytes
Returns
TMC429 status byte

This functions reads a TMC429 register and puts the result into an array of bytes. It also returns the TMC429 status bytes.

Here is the call graph for this function:

Here is the caller graph for this function:

Read429Int ( UCHAR  Address)

Read TMC429 register (24 bit)

Parameters
AddressTMC429 register address (see TMC429.h)
Returns
TMC429 register value (sign extended)

This functions reads a TMC429 24 bit register and sign-extends the register value to 32 bit.

Here is the call graph for this function:

Here is the caller graph for this function:

Read429Short ( UCHAR  Address)

Read TMC429 register (12 bit)

Parameters
AddressTMC429 register address (see TMC429.h)
Returns
TMC429 register value (sign extended)

This functions reads a TMC429 12 bit register and sign-extends the register value to 32 bit.

Here is the call graph for this function:

Here is the caller graph for this function:

Read429SingleByte ( UCHAR  Address,
UCHAR  Index 
)

Read TMC429 register.

Parameters
AddressTMC429 register address (see TMC429.h)
IndexTMC429 register byte to be returned (0..3)
Returns
TM429 register byte

This functions reads a TMC429 register and returns the desired byte of that register.

Here is the call graph for this function:

Here is the caller graph for this function:

Read429Status ( void  )

Read TMC429 status byte.

Returns
TMC429 status byte

This functions reads just the status byte of the TMC429 using a single byte SPI access which makes this a little bit faster.

Here is the caller graph for this function:

ReadWrite429 ( UCHAR Read,
UCHAR Write 
)

32 bit SPI communication with TMC429

Parameters
Readfour byte array holding the data read from the TMC428
Writefour byte array holding the data to write to the TMC428

This is the low-level function that does all SPI communication with the TMC429. It sends a 32 bit SPI telegramme to the TMC429 and receives the 32 bit answer telegramme from the TMC429. It also raises the motor current when there is write access to a register that could cause motor movement.

Here is the call graph for this function:

Here is the caller graph for this function:

Set429RampMode ( UCHAR  Axis,
UCHAR  RampMode 
)

Set the ramping mode of an axis.

Parameters
AxisMotor number (0, 1 or 2)
RampModeramping mode (RM_RAMP/RM_SOFT/RM_VELOCITY/RM_HOLD)

This functions changes the ramping mode of a motor in the TMC429. It is some TMC429 register bit twiddling.

Here is the call graph for this function:

Here is the caller graph for this function:

Set429SwitchMode ( UCHAR  Axis,
UCHAR  SwitchMode 
)

Set the end switch mode.

Parameters
AxisMotor number (0, 1 or 2)
SwitchModeend switch mode

This functions changes the end switch mode of a motor in the TMC429. It is some TMC429 register bit twiddling.

Here is the call graph for this function:

SetAMax ( UCHAR  Motor,
UINT  AMax 
)

Set the maximum acceleration.

Parameters
Motormotor number (0, 1, 2)
AMaxmaximum acceleration (1..2047)

This function sets the maximum acceleration and also calculates the PMUL and PDIV value according to all other parameters (please see the TMC429 data sheet for more info about PMUL and PDIV values).

Here is the call graph for this function:

Here is the caller graph for this function:

Write429Bytes ( UCHAR  Address,
UCHAR Bytes 
)

TMC429 write access.

Parameters
AddressTMC429 register address (see also TMC429.h)
BytesArray holding three bytes to be written to the TMC429 register.

This function writes an array of three bytes to a TMC429 register.

Here is the call graph for this function:

Here is the caller graph for this function:

Write429Datagram ( UCHAR  Address,
UCHAR  HighByte,
UCHAR  MidByte,
UCHAR  LowByte 
)

TMC429 write access.

Parameters
AddressTMC429 register address
HighByteMSB of the TMC429 register
MidBytemid byte of the TMC429 register
LowByteLSB of the TMC429 register

This function write three bytes to a TMC429 register.

Here is the call graph for this function:

Here is the caller graph for this function:

Write429Int ( UCHAR  Address,
int  Value 
)

Write 24 bit value to a TMC429 register.

Parameters
AddressTMC429 register address
ValueValue to be written

This function writes a 24 bit value to a TMC429 register.

Here is the call graph for this function:

Here is the caller graph for this function:

Write429Short ( UCHAR  Address,
int  Value 
)

Write 16 bit value to a TMC429 register.

Parameters
AddressTMC429 register address
ValueValue to be written

This function writes a 16 bit value to a TMC429 register.

Here is the call graph for this function:

Here is the caller graph for this function:

Write429Zero ( UCHAR  Address)

Write zero to a TMC429 register.

Parameters
AddressTMC429 register address

This function sets a TMC429 register to zero. This can be useful e.g. to stop a motor quickly.

Here is the call graph for this function:

Here is the caller graph for this function: