AM263Px Motor Control SDK  2025.00.00
Tamagawa over UART Example

Introduction

The Tamagawa over UART application does the following:

  • Configures pinmux, GPIO, UART (UART clock to 192 MHz, baud rate, etc.)
  • Initializes UART0 for debug log and UART3 for encoder communication
  • Selects UART LLD with polling mode for encoder communication
  • Loads and executes Tamagawa example on Arm® Cortex®-R5F

Connect the Tamagawa encoder via RS-485 Half-Duplex EVM to the LaunchPad. The connections between the LaunchPad and RS-485 EVM:

UART RX Pin(UART3_RXD)->JMP1-R, UART TX Pin(UART3_TXD)->JMP4-D, GPIO Pin(GPIO62)->JMP3-DE

The Tamagawa over UART example runs on R5F and communicates with Tamagawa encoder using a UART instance. It presents the user with menu options to select a 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 command. Then via the UART LLD write API, the command is passed to the encoder. Once the command is sent, the encoder starts to respond, and the UART LLD read API reads this response. The response is stored in the Tamagawa interface structure, and the data integrity is verified by CRC calculation. If CRC verification passes, the result is presented to the user, otherwise a CRC failure message is displayed.

Example Flow-Chart

Tamagawa UART example flow-chart

Important files and directory structure

Folder/Files Description
${SDK_INSTALL_PATH}/examples/position_sense/tamagawa_diagnostic_over_soc_uart
uart_tamagawa.c Tamagawa UART application
${SDK_INSTALL_PATH}/source/position_sense/tamagawa_over_soc_uart
include/ Folder containing Tamagawa interface file.
driver/ Tamagawa UART driver

Supported Combinations

Parameter Value
CPU + OS r5fss0-0 freertos
Toolchain ti-arm-clang
Board am263px-lp
Example folder examples/position_sense/tamagawa_diagnostic_over_soc_uart/am263px-lp/r5fss0-0_freertos

Steps to Run the Example

Hardware Prerequisites

  • Tamagawa Encoders
  • LP-AM263P Board
  • RS-485 Half Duplex EVM
  • 5V and 3.3V power supplier

Hardware Setup

Tamagawa Encoder Hardware Setup with LP-AM263P

Hardware Setup For LP-AM263P

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 UART Sample Output

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). CRC success with ABS, SF, CF and CRC values printed in the terminal.
Data ID C Reset - multiturn This command is used to reset multi-turn data(ABM). CRC success with ABS, SF, CF and CRC values printed in the terminal.
Note
Arm is a registered trademark of Arm Limited (or its subsidiaries or affiliates) in the US and/or elsewhere.