AM263Px Motor Control SDK  2025.00.00
NIKON Diagnostic

Note
A-format® is a registered trademark of the Nikon Corporation.

Nikon diagnostic application does the following:

  • Configures pinmux, GPIO, UART, ICSS clock to 200MHz
  • Initializes PRU-ICSS
  • Initializes default parameters, loads the PRU firmware and executes it
Note
Nikon firmware is tested with ICSS Core Clock running at 200 MHz frequency or ICSS UART Clock running at 192 MHz frequency only.

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.

The Nikon receiver firmware running on ICSS-PRU provides a defined interface. The Nikon diagnostic application interacts with the Nikon receiver firmware interface. It then presents the user with menu options to select different commands. The application collects the data entered by the user and configures the relevant interface. Then via the Nikon 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.

Note
Limitation with BP-AM2BLDCSERVO boosterpack with TI LaunchPad
  • Hardware Limitation with BP-AM2BLDCSERVO
    • Only up to 7 encoders in bus connection have been tested with BP-AM2BLDCSERVO
    • This limitation is due to insufficient voltage when attempting to power 8 encoders
    • Attempting to connect 8 encoders may result in unreliable operation
  • Software Support
    • The example code and PRU firmware are designed to handle 8 encoders

Periodic Trigger Modes

The Nikon 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 32 demonstrates this mode using position command CMD_4
  • 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 33 demonstrates this mode using position command CMD_4
  • 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 nikon_command_process() once in host trigger mode before switching to periodic mode
  2. Automatic Behavior: In periodic mode, nikon_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 Nikon or other encoders. Each CMP event must be assigned exclusively to a single encoder channel.
  4. Modifying Commands in Periodic Mode
    • Default: Position Command 4 (CMD_4) is used by default
    • To use a different command:
      • First modify the nikon_process_periodic_command() function in example code
      • Before switching to periodic mode, send this command once using nikon_get_pos() in host trigger mode
      • Ensure all prerequisite APIs are called before nikon_get_pos() to properly set up command data (e.g., nikon_generate_cdf()). Refer the nikon_handle_command() function in the example code to identify all required API calls for specific command

Important files and directory structure

Folder/Files Description
${SDK_INSTALL_PATH}/examples/position_sense/nikon_diagnostic
nikon_diagnostic.c Nikon diagnostic application
${SDK_INSTALL_PATH}/source/position_sense/nikon
firmware/ Folder containing Nikon PRU firmware sources
driver/ Nikon diagnostic driver

Supported Combinations

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

Single Channel with Single PRU Example

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

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

Steps to Run the Example

Hardware Prerequisites

Hardware Setup

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

Hardware Setup of BP-AM2BLDCSERVO Booster Pack + LP for Nikon
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

Designator ON/OFF Description
J13 Pin 1-2 Connected 3V3 Supply to Booster Pack
J14 Pin 1-2 Connected 5V0 Supply to Booster Pack

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:

Nikon Sample Output

Nikon A-format Debug Guide

This section describes how to debug the Nikon A-format application, including a guide to debugging the Nikon A-format example and firmware. It mainly focuses on verifying the configuration of all components and encoder registers, as described in the Encoder Examples Debug Guide.

If the Nikon A-format 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, as described in the Encoder Examples Debug Guide.

Initialization Failures

In case of initialization failure, perform the following steps to identify the root cause:

  1. Probe the TX, RX, TX_EN and clock pins of the connected channel (as per Encoder Examples Debug Guide)
  2. Run the example and capture signals during the initialization sequence. CMD_4 which is a multi-transmission command, is sent during initialization.
  3. Compare with the expected initialization sequence below:
Nikon A-format Initialization Response
  1. Verify that the TX and RX signals show meaningful data exchanges.

If the initialization communication is incorrect, possible causes include:

  1. Firmware not loaded into the correct PRU core
  2. Firmware stuck due to:
    • No response or incorrect response from encoder
    • Incorrect channel selection or incorrect clock configuration

Troubleshooting steps:

  1. Verify hardware connections
  2. Confirm the pin settings and the clock configuration
  3. If the above are correct, debug the PRU firmware by connecting to the appropriate core as described in the Encoder Examples Debug Guide

Command Failures

  • If the encoder ID is not set correctly for encoders, it may cause problems with PRU firmware or R5F driver. Correct encoder ID should be set using UART menu option 31 before sending commands or by calling nikon_update_enc_addr API appropriately.
  • In single PRU multi-channel mode, the encoder ID should be same on all channels.
  • PRU Firmware gets stuck if encoder does not respond with the number of bytes expected by the driver as per PINDSW-9179 in Release Notes 10.02.00
  • Example cases when firmware gets stuck
    1. Any command is sent with encoder address not matching that of the encoder connected with the device
    2. In bus mode, if encoders with addresses 0, 1, 2 are connected and MT command is sent with encoder address 3 or more
    3. Command 20 is sent with ID not matching the encoder connected with the device

Test Case Description

CMD_ID CMD Description Pass/fail Criteria
0 ABS full 40 bit data request In this command, encoder sends absolute 40 bit data for single encoder with status information. CRC success with rotor angle, number of rotations and CRC values printed in the terminal.
1 ABS lower 24bit data request In this command, encoder sends absolute lower 24 bit data for single encoder with status information. CRC success with rotor angle, number of rotations and CRC values printed in the terminal.
1 (Nikon A-format version 3.0 only, based on factory setting) ABS full 40bit data + velocity data request In this command, encoder sends absolute 40 bit data for single encoder with status and velocity information. CRC success with rotor angle, number of rotations, velocity and CRC values printed in the terminal.
2 ABS upper 24bit data request In this command, encoder sends absolute upper 24 bit data for single encoder with status information. CRC success with rotor angle, number of rotations and CRC values printed in the terminal.
3 Encoder status Request In this command, encoder sends status information, alarm bits and additional information. Alarm bits (PM Alarm bits shown for Nikon A-format version 3.0 only), encoder status bits printed in the terminal along with CRC success.
4 ABS full 40 bit data request(MT) In this command, encoder sends absolute 40 bit data for multiple encoders connected in bus with status information. CRC success with rotor angle, number of rotations and CRC values printed in the terminal.
5 ABS lower 24bit data request(MT) In this command, encoder sends absolute lower 24 bit data for multiple encoders connected in bus with status information. CRC success with rotor angle, number of rotations and CRC values printed in the terminal.
5 (Nikon A-format version 3.0 only, based on factory setting) ABS full 40bit data + velocity data request In this command, encoder sends absolute 40 bit data for multiple encoders connected in bus with status and velocity information. CRC success with rotor angle, number of rotations, velocity and CRC values printed in the terminal.
6 ABS upper 24bit data request(MT) In this command, encoder sends absolute upper 24 bit data for multiple encoders connected in bus with status information. CRC success with rotor angle, number of rotations and CRC values printed in the terminal.
7 Encoder status Request(MT) In this command, encoder sends status information, alarm bits and additional information for all encoders connected in bus. Alarm bits (PM Alarm bits shown for Nikon A-format version 3.0 only), encoder status bits printed in the terminal along with CRC success.
8 Status flag clear request In this command, encoder sends status information, alarm bits and additional information after clearing the status flags. Alarm bits (PM Alarm bits shown for Nikon A-format version 3.0 only), encoder status bits printed in the terminal along with CRC success.
9 Multiple turn data clear request In this command, encoder sends status information, alarm bits and additional information after clearing the multiple turn data bits. Alarm bits (PM Alarm bits shown for Nikon A-format version 3.0 only), encoder status bits printed in the terminal along with CRC success.
10 Status+ Multiple turn data clear request In this command, encoder sends status information, alarm bits and additional information after clearing the status and multiple turn data bits. Alarm bits (PM Alarm bits shown for Nikon A-format version 3.0 only), encoder status bits printed in the terminal along with CRC success.
11 Encoder address setting I (one-to-one connection) In this command, encoder address setting will be performed and status will be returned with ALM bits. Alarm bits (PM Alarm bits shown for Nikon A-format version 3.0 only), encoder status bits printed in the terminal along with CRC success.
12 Single turn data zero preset In this command, encoder sets single turn data bits to zero and returns status bits along with ALM bits. Alarm bits (PM Alarm bits shown for Nikon A-format version 3.0 only), encoder status bits printed in the terminal along with CRC success.
8 to 12 (Nikon A-format version 3.0 only, based on factory setting) ABS lower 24bit data request In this command, encoder sends absolute lower 24 bit data for single encoder with status information. CRC success with rotor angle, number of rotations and CRC values printed in the terminal.
13 EEPROM read request In this command, encoder sends EEPROM register data along with the requested address information. CRC success with matching address (received address should be the same as sent by user)
13 (Nikon A-format version 3.0 only) EEPROM read request with bank In this command, encoder sends EEPROM register data along with the requested address and bank information. CRC success with matching address and bank (received address and bank should be the same as sent by user)
14 EEPROM write request In this command, encoder performs write and acknowledges the data and address specified by user. CRC success with matching data and address (received data and address should be the same as sent by user)
14 (Nikon A-format version 3.0 only) EEPROM write request with bank In this command, encoder performs write and acknowledges the data, address and bank specified by user. CRC success with matching data, address and bank (received data, address and bank should be the same as sent by user)
15 Temperature data request In this command, encoder sends temperature information along with status. Encoder temperature and status bits printed in the terminal along with CRC success.
16 Identification code read I In this command, encoder sends identification code. Encoder identification code will be printed in the terminal along with CRC success.
16 (Nikon A-format version 3.0 only) Velocity coefficient read In this command, encoder sends velocity coefficient. Encoder velocity coefficient will be printed in the terminal along with CRC success.
17 Identification code read II(one-to-one connection) In this command, encoder sends identification code irrespective of encoder address. Encoder identification code will be printed in the terminal along with CRC success.
18 Identification code write I In this command, encoder writes and acknowledges identification code provide by user in its local register. CRC success with matching identification code (received identification code should be the same as sent by user)
18 (Nikon A-format version 3.0 only) Velocity coefficient write In this command, encoder writes and acknowledges velocity coefficient. CRC success with matching velocity coefficient (received velocity coefficient should be the same as sent by user)
19 Identification code write II(one-to-one connection) In this command, encoder writes and acknowledges identification code provide by user in its local register irrespective of encoder address. CRC success with matching identification code (received identification code should be the same as sent by user)
20 Encoder address setting II In this command, encoder address is set based on identification code provided by user. CRC success with matching identification code (received identification code should be the same as sent by user)
21 ABS lower 17bit data request In this command, encoder sends absolute lower 17 bit data for single encoder with status information. CRC success with rotor angle, number of rotations and CRC values printed in the terminal.
22 ABS lower 17bit data request(MT) In this command, encoder sends absolute lower 17 bit data for encoders connected in bus with status information. CRC success with rotor angle, number of rotations and CRC values printed in the terminal.
23 (Nikon A-format version 3.0 only) ABS lower 24bit + velocity request In this command, encoder sends absolute lower 24 bit data for single encoder with velocity information. CRC success with rotor angle, number of rotations, velocity and CRC values printed in the terminal.
24 (Nikon A-format version 3.0 only) ABS lower 24bit + velocity request(MT) In this command, encoder sends absolute lower 24 bit data for encoders connected in bus with velocity information. CRC success with rotor angle, number of rotations, velocity and CRC values printed in the terminal.
25 (Nikon A-format version 3.0 only) ABS lower 24bit + velocity + acceleration request In this command, encoder sends absolute lower 24 bit data for single encoder with velocity and acceleration information. CRC success with rotor angle, number of rotations, velocity, acceleration and CRC values printed in the terminal.
26 (Nikon A-format version 3.0 only) ABS lower 24bit + velocity + acceleration request(MT) In this command, encoder sends absolute lower 24 bit data for encoders connected in bus with velocity and acceleration information. CRC success with rotor angle, number of rotations, velocity, acceleration and CRC values printed in the terminal.
27 ABS lower 24bit + status request In this command, encoder sends absolute lower 24 bit data for single encoder with status and alarm bits information. CRC success with rotor angle, number of rotations, alarm bits and CRC values printed in the terminal.
28 ABS lower 24bit + status request(MT) In this command, encoder sends absolute lower 24 bit data for encoders connected in bus with status and alarm bits information. CRC success with rotor angle, number of rotations, alarm bits and CRC values printed in the terminal.
29 ABS lower 24bit + temperature data request In this command, encoder sends absolute lower 24 bit data for single encoder with temperature information. CRC success with rotor angle, number of rotations, temperature and CRC values printed in the terminal.
30 ABS lower 24bit + temperature data request(MT) In this command, encoder sends absolute lower 24 bit data for encoders connected in bus with temperature information. CRC success with rotor angle, number of rotations, temperature and CRC values printed in the terminal.
32 (NOTE: This is not a command with ID 32, it is UART option number 32) Start Periodic CMP Mode In this command, encoder sends absolute lower 40 bit data for encoders connected in point to point / bus based on IEP CMP event. CRC success with rotor angle, number of rotations and CRC stats printed in the terminal.
33 (NOTE: This is not a command with ID 33, it is UART option number 33) Start Periodic CAP Mode In this command, encoder sends absolute lower 40 bit data for encoders connected in point to point / bus based on IEP CAP event. CRC success with rotor angle, number of rotations 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.