AM243x MCU+ SDK  08.04.00
EnDAT Diagnostic

The EnDat diagnostic application, described here, demonstrates the EnDat master operation.

The EnDat driver provides a well defined set of API's to expose EnDat master interface.

The diagnostic invokes these API's to

  • initialize EnDat,
  • configure the host trigger mode,
  • select between concurrent multi channel or single channel configuration,
  • select the channel (channels in the case of concurrent multi channel configuration)
  • and run the firmware.

Once these steps are executed,

  • the driver waits for the EnDat to be initialized.
  • It then sets clock frequency to 200KHz (as propagation delay is not yet compensated)
  • and obtains the encoder details including serial number, position resolution etc, and displays on the console.
  • Based on the whether encoder is 2.2 or 2.1 type, it sets clock to either 8MHz or 1MHz respectively.
  • While configuring clock, propagation delay is taken care using the automatically estimated propagation delay (user can override it too).
  • In the case of concurrent multi channel configuration, if propagation delay between various channels are different, that too is automatically taken care.

Once initial setup is over,

  • the diagnostic provides the user with a self explanatory menu.
  • Two types of menu options are presented. One type (1-14) will send an EnDat command as per EnDat 2.2 specification.
  • The other type (100-108) allows the user to configure clock frequency, various timing parameters, simulate motor control loop using 2.1 command as well as 2.2 command with safety (redundant position information), switch to continuous clock mode and monitor raw data.
  • Concurrent multi channel configuration can work simultaneously for up-to three encoders with identical part number, all variants of 2.2 position commands as well as the 2.1 position command is supported and an additional option (109) to configure wire delay (useful when propagation delay in each channel is different) is available.
  • Application by default, handles wire delay as required, the menu option provides a way to override it.

After the user selects an EnDat command,

  • the diagnostic asks for more details to frame the command and performs a basic sanity check on the user entered values.
  • Then the EnDat API is invoked to process the command.
  • The received EnDat is processed & validated using the defined API's. The result is then presented to the user.

Important files and directory structure

Folder/Files Description
${SDK_INSTALL_PATH}/examples/motor_control/endat_diagnostic
endat_diagnostic.c EnDAT diagnostic application
${SDK_INSTALL_PATH}/source/motor_control/position_sense/endat
firmware/ Folder containing EnDAT firmware sources.
driver/ EnDAT diagnostic driver.

Supported Combinations

Parameter Value
CPU + OS r5fss0-0 freertos
ICSSG ICSSG0
PRU PRU1
Toolchain ti-arm-clang
Board am243x-evm
Example folder examples/motorcontrol/endat_example

Steps to Run the Example

Hardware Prerequisites

Other than the basic EVM setup mentioned in EVM Setup, below additional HW is required to run this demo

  • EnDAT encoder
  • TIDA-00179 Universal Digital Interface to Absolute Position Encoders, https://www.ti.com/tool/TIDA-00179
  • TIDEP-01015 3 Axis board
  • Interface card connecting EVM and TIDEP-01015 3 Axis board

Hardware Setup

Hardware Setup

Build, load and run

  • When using CCS projects to build, import the CCS project and build it using the CCS project menu (see Using SDK with CCS Projects).
  • When using makefiles to build, note the required combination and build using make command (see Using SDK with Makefiles)
  • Launch a CCS debug session and run the executable, see CCS Launch, Load and Run
  • Refer to UART terminal for user interface menu options.

Sample Output

Shown below is a sample output when the application is run:

EnDAT Usage

Test Case Description

Test detail Steps Pass/fail crieteria
To check position value 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 1 to select "Encoder send position values" Crc success
To receive encoder's operating parameters(error messege) 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 2 to select "Selection of memory area" Crc success
4. Enter "B9" in MRS code to select "Operating parameters" Crc success
5. Enter 4 to select "Encoder to send parameter" Crc success
6. Enter 0 in "parameter address" for selecting "Error message" Crc success
To receive encoder's manufacture parameters for Endat 2.2 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 2 to select "Selection of memory area" Crc success
4. Enter "BD" in MRS code to select "Parameters of encoder manufacturer for Endat 2.2" Crc success
5. Enter 4 to select "Encoder to send parameter" Crc success
6. Enter 0 in "parameter address" for selecting "Status of additional info" Crc success
To set values to encoder's operating parameters (error message) 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 2 to select "Selection of memory area" Crc success
4. Enter "B9" in MRS code to select "Operating parameters" Crc success
5. Enter 3 to select "Encoder to receive parameter" Crc success
6. Enter 0 in "parameter address" for selecting "Error message" Crc success
7. Enter 0 in "parameter value" for seting value in " Error message" Crc success
To set values to encoder's manufacturing parameters for Endat 2.2(Status of additional info) 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 2 to select "Selection of memory area" Crc success
4. Enter "BD" in MRS code to select "Parameters of encoder manufacturer for Endat 2.2" Crc success
5. Enter 3 to select "Encoder to receive parameter" Crc success
6. Enter 0 in "parameter address" for selecting "Status of additional info" Crc success
7. Enter 0 in "parameter value" for seting value in " Status of additional info" Crc success
To reset encoder 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 5 to select "Encoder receive reset" Crc success
To receive test values from encoder with port address "0" 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 7 to select "Encoder receive test command"
4. Enter 0 in "enter port address"
5. Enter 6 to select "Encoder send test values" Crc success
To receive test values from encoder with port address "E" 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 7 to select "Encoder receive test command"
4. Enter "E" in "enter port address"
5. Enter 6 to select "Encoder send test values" Crc success
To check position value with aditional info. 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 8 to select "Encoder send position values + AI(s)" Crc success
To receive encoder's operating parameters(error messege) +receive position value with additional info 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 9 to select "Encoder send position values + AI(s) and Selection of memory area"
4. Enter "B9" in MRS code to select "Operating parameters" some time MRS code selection Failure
5. Enter 11 to select "Encoder send position values + AI(s) and send parameter"
6. Enter 0 in "parameter address" for selecting "Error message"
To receive encoder's manufacture parameters for Endat 2.2 +receive position value with additional info 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 9 to select "Encoder send position values + AI(s) and Selection of memory area"
4. Enter "BD" in MRS code to select "Parameters of encoder manufacturer for Endat 2.2" some time MRS code selection Failure
5. Enter 11 to select "Encoder send position values + AI(s) and send parameter"
6. Enter 0 in "parameter address" for selecting "Status of additional info"
To set values to encoder's operating parameters (error message) +receive position value with additional info 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 9 to select "Encoder send position values + AI(s) and Selection of memory area"
4. Enter "B9" in MRS code to select "Operating parameters" some time MRS code selection Failure
5. Enter 10 to select "Encoder send position values + AI(s) and receive parameter"
6. Enter 0 in "parameter address" for selecting "Error message"
7. Enter 0 in "parameter value" for seting value in " Error message"
To set values to encoder's manufacturing parameters for Endat 2.2(Status of additional info) +receive position value with additional info 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 9 to select "Encoder send position values + AI(s) and Selection of memory area"
4. Enter "BD" in MRS code to select "Parameters of encoder manufacturer for Endat 2.2" some time MRS code selection Failure
5. Enter 10 to select "Encoder send position values + AI(s) and receive parameter"
6. Enter 0 in "parameter address" for selecting "Status of additional info"
7. Enter 0 in "parameter value" for seting value in " Status of additional info"
To reset encoder +receive position value with additional info 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
5. Enter 12 to select "Encoder send position values + AI(s) and receive error reset" Crc success
1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 14 to select "Encoder receive communication command" Crc success
4. Enter ______in "enter encoder address" Crc success
5. Enter _____ in "instruction hex value" Crc success
1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 14 to select "Encoder receive communication command" Crc success
4. Enter ______in "enter encoder address" Crc success
5. Enter _____ in "instruction hex value" Crc success
Configure Clock 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 100 to select "configure clock" Failure for 16Mhz and Success for 12Mhz
4. Enter ___ for clock frequency(in Hz)
Simulate motor control 1.1 position loop 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 101 to select "Simulate motor control 2.1 position loop"
4. Enter 10000 to select "clock frequency"
5. Rotate the rotor of motor and see the changes in Position value on UART Position Values are changing when rotor moves
Toggle raw data display 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 102 to select "Toggle raw data display"
4. Enter 1 to select "Encoder send position value" raw data can be displayed
Configure TST delay
Start continous mode 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 104 to select "Start continous mode"
4. Rotate the rotor of motor and see the changes in Position value on UART Position Values are changing when rotor moves
Configure rx arm counter 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 105 to select "Configure rx arm counter"
4. Enter ___ to "select time in ns"
configure rx clock disable time 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 106 to select "configure rx clock disable time"
4. Enter ___ to "select time in ns"
Simulate motor control 2.2 position loop(safety) 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 107 to select "Simulate motor control 2.2 position loop"
4. Enter 10000 to select "clock frequency"
5. Rotate the rotor of motor and see the changes in Position value on UART Position Values are changing when rotor moves
Configure propogation delay(td) 1. Selct Single channel mode from UART menu
2. Enter 0 to select channel 0
3. Enter 108 to select "configure propagation delay"