AM263Px Motor Control SDK  2025.00.00
Tamagawa Diagnostic

Note

Introduction

The Tamagawa diagnostic application does the following:

  • Configures pinmux, GPIO, UART, ICSSM
  • Initializes ICSSM-PRU0
  • Loads the initialization section of PRU firmware and executes it

This application is controlled with a terminal interface using a serial over USB connection between the PC host and the EVM. Please connect a USB cable between the PC and the EVM/LP. A serial terminal application (like teraterm/ hyperterminal/ minicom) is then run on the host. To configure, select the serial port corresponding to the port emulated over USB by the EVM. The host serial port should be configured to 115200 baud, no parity, 1 stop bit and no flow control.

Note
Tamagawa firmware is tested with ICSS Core Clock running at 200 MHz frequency only.

The Tamagawa diagnostic application interacts with the Tamagawa receiver firmware interface. It then presents the user with menu options to select Data ID code (as defined by Tamagawa) to be sent to the encoder. The application collects the data entered by the user and configures the relevant interface. Then via the Tamagawa receiver interface, the command is triggered. Once the command completion is indicated by the interface, the status of the transaction is checked. If the Status indicates success, the result is presented to the user.

Periodic Trigger Modes

The Tamagawa diagnostic application supports two types of periodic trigger modes for continuous position sampling as described in Periodic Trigger Modes.

CMP Mode (Compare Event Mode)

  • Implementation: Command 9 demonstrates this mode using position command DATA_ID_0
  • Configuration: Uses a user-defined compare value to trigger sampling events
  • IEP Counter Reset: Uses CMP0 by default (skip if reset is handled differently)
  • Notification: Firmware triggers an Arm® Cortex®-R5F interrupt after receiving encoder response

CAP Mode (Capture Event Mode)

  • Implementation: Command 10 demonstrates this mode using position command DATA_ID_0
  • XBAR Configuration for CAP6/CAP7 (LATCH_IN0/LATCH_IN1)
    • This example configures the XBAR for routing EPWM SYNC OUT as input to CAP using SysConfig
    • Customization: XBAR settings can be modified for alternative inputs
    • NOTE: XBAR routing configuration is optional if not needed
  • NOTE: When using different CAP events instead of the ones used in SDK example, ensure all related configurations (source selection, signal routing, etc.) are properly done.
  • Notification: Firmware triggers an R5F interrupt after receiving encoder response

Important Notes for Periodic Mode

  1. Initialization: Call tamagawa_command_process() once in host trigger mode before switching to periodic mode
  2. Automatic Behavior: In periodic mode, tamagawa_command_process() skips sending operations (PRU firmware handles triggering via IEP events)
  3. CMP Resource Allocation
    • Avoid using CMP0 if it's already used to IEP counter reset
    • Avoid using CMP1/CMP2 if they're used to SYNC OUT generation
    • Avoid sharing CMP events across different channels or instances of Tamagawa or other encoders. Each CMP event must be assigned exclusively to a single encoder channel.
  4. Modifying Commands in Periodic Mode
    • Default: DATA_ID_0 is used by default
    • To use a different command, modify the TAMAGAWA_PERIODIC_MODE_CMD macro value in example code

Important files and directory structure

Folder/Files Description
${SDK_INSTALL_PATH}/examples/position_sense/tamagawa_diagnostic
tamagawa_diagnostic.c Tamagawa diagnostic application
${SDK_INSTALL_PATH}/source/position_sense/tamagawa
firmware/ Folder containing Tamagawa PRU firmware sources
driver/ Tamagawa diagnostic driver

Supported Combinations

Parameter Value
CPU + OS r5fss0-0 freertos
ICSS ICSSM0
PRU PRU0
Toolchain ti-arm-clang
Board am263px-lp
Example folder examples/position_sense/tamagawa_diagnostic/single_channel

Single Channel with Single PRU Example

This example supports one Tamagawa channel using one PRU. In this example:

  • 1 Tamagawa driver instance and corresponding SysConfig Tamagawa module instance is used.

Steps to Run the Example

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

Hardware Prerequisites

Hardware Prerequisites with LP-AM263P

Hardware Setup (Using BP-AM2BLDCSERVO Booster Pack and LP-AM263P)

Hardware Setup of BP-AM2BLDCSERVO Booster Pack + LP for Tamagawa
Note
  • To enable VSENSOR1, BoosterPack pin J8.73 must be set high (In this example, this pin is configured in GPIO mode and pulled high)

LP-AM263P Jumper Configuration

Connect the jumpers J13 and J26 for providing 3.3V and 5V to boosterpack.

BP-AM2BLDCSERVO Booster Pack Jumper Configuration

Designator ON/OFF Description
J11 OFF VSENSE/ISENSE select
J13 OFF VSENSE/ISENSE select
J17 Pin 1-2 Connected SDFM Clock Feedback Select
J18/J19 J19 installed: sets VSENSOR1 to 5.0V Axis 1: Encoder/Resolver Voltage Select
J20/J21 J21 installed: sets VSENSOR2 to 5.0V Axis 2: Encoder/Resolver Voltage Select
J22 OFF Axis 1: Manchester Encoding Select
J23 OFF Axis 2: Manchester Encoding Select
J24 OFF Axis 1: RS485/DSL MUX
J25 OFF Axis 2: RS485/DSL MUX
J26 OFF VSENSE/ISENSE Select
J27 OFF Encoder and SDFM Paths Select
J28 ON AM243/AM263 Mode

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:

Tamagawa Sample Output

Tamagawa Debug Guide

This section describes how to debug the Tamagawa application, including a guide to debugging the Tamagawa example and firmware. Several common debugging steps on verifying the configuration of key registers, hardware details for probing pins, debugging firmware, common issues with multi-channel or continuous mode, etc. are described in Encoder Examples Debug Guide.

If the Tamagawa interface is not initializing correctly, the steps mentioned below can help identify the root cause. Additionally, ensure that the hardware connections and software configurations are properly set up before proceeding with debugging.

Initial Command Failures

In the case of getting a CRC failure, firmware getting stuck, or getting 0xffff data with CRC success when the command is run for the first time through the UART terminal, possible root causes can be:

  • Incorrect clock configuration
  • Incorrect hardware configuration

The following things can be tried for finding the root cause:

  1. Probe the four pins of the connected channel.
  2. Load the example and capture signals for command 0.
  3. Compare with the expected communication shown below:
Tamagawa cmd 0 Response

Verify that the clock frequency is set to 2.5 Mbps or 5 Mbps. The TX and RX signals should show meaningful data exchange for command 0.

If nothing is appearing on the signals, possible causes are:

  1. Firmware not loaded into the correct PRU core
  2. Firmware getting stuck due to:
    • Incorrect channel selection or incorrect configuration

This issue can be troubleshot by debugging the firmware and examining register values, as described in the Encoder Examples Debug Guide.

Test Case Description

Data_ID Name Description Pass/fail Criteria
Data ID 0 Data readout (absolute position data) Receive following data:
Absolute rotor position value in field name ABS.
Errors and warnings in field name SF(status field)
CRC success with ABS, SF, CF and CRC values printed in the terminal.
Data ID 1 Data readout (multi-turn data) Receive following data:
No. of rotor turns in field name ABM.
Errors and warnings in field name SF(status field).
CRC success with ABM, SF, CF and CRC values printed in the terminal.
Data ID 2 Encoder-ID Receive following data:
Tamagawa encoder make-ID in ENID field.
Errors and warnings in field name SF(status field)
CRC success with ENID, SF, CF and CRC values printed in the terminal.
Data ID 3 Data readout(absolute+multiturn+encoder-ID) Receive following data: Absolute rotor position value in field name ABS. No. of rotor turns in field name ABM. Tamagawa encoder make-ID in ENID field. Errors and warnings in field name SF(status field) Other warnings in field name ALMC CRC success with ABS, ENID, ABM, ALMC, SF, CF and CRC values printed in the terminal.
Data ID 6 Writing to EEPROM Transmit following data:
Proper address of the EEPROM where you want to write
Proper data that you want to write.

Receive following data:
Control Field for EEPROM Write command
EEPROM address that you want to write to
Data that you want to write to the EEPROM
CRC value
CRC success with EDF, ADF, CF and CRC values printed in the terminal.
Data ID D Readout from EEPROM Transmit following data:
Proper address of the EEPROM that you want to read.

Receive following data:
Control Field for EEPROM Read command
EEPROM address that was read from
Data read from the EEPROM
CRC value
CRC success with EDF, ADF, CF and CRC values printed in the terminal.
Data ID 7 Reset-Error This command is used to reset errors. CRC success with ABS, SF, CF and CRC values printed in the terminal.
Data ID 8 Reset - absolute This command is used to reset absolute position data(ABS). In order to reset the ABS value, send this command 10 times and send Data ID 0. CRC success with ABS value set to 0 along with SF, CF and CRC values printed in the terminal.
Data ID C Reset - multiturn This command is used to reset multi-turn data(ABM). In order to reset the ABM value, send this command 10 times and send Data ID 1. CRC success with ABM value set to 0 along with SF, CF and CRC values printed in the terminal.
9 (NOTE: This is not a command with Data ID 9, it is UART option number 9) Start Periodic CMP Mode In this command, encoder sends absolute position data based on IEP CMP event. CRC success with ABS, SF, CF and CRC stats printed in the terminal.
10 (NOTE: This is not a command with Data ID 10, it is UART option number 10) Start Periodic CAP Mode In this command, encoder sends absolute position data based on IEP CAP event. CRC success with ABS, SF, CF and CRC stats printed in the terminal.
Note
Arm is a registered trademark of Arm Limited (or its subsidiaries or affiliates) in the US and/or elsewhere.