- Note
- A-format® is a registered trademark of the Nikon Corporation.
Introduction
Nikon A-format absolute encoder receiver implementation on the TI PRU-ICSS interfaces with the Nikon A-format encoders either via point-to-point communication or up to 8 Nikon A-format encoders connected on a bus. Nikon A-format encoders use a proprietary asynchronous serial bi-directional half-duplex communication protocol compliant with RS-485. The encoder can generate either single- or multi-turn absolute position data and can operate at a baud rate of up to 16 MHz. Besides position data, the encoder can also send status and diagnostic information as well. Reliability is ensured by using a 3-bit CRC by the receiver and an 8-bit CRC by the encoder. Another interesting feature of the Nikon-A encoders is the optional battery backup circuit, which can be used in case of power failure. Nikon A-format encoders are widely used in industrial machinery, including industrial robots in automobile production lines and machine tools, and are highly valued as the next-generation standard for sensors that can detect the absolute rotational displacement values of robot arms.
- Note
- This implementation using Peripheral input/output mode of PRU-ICSS. Refer Peripheral IF mode for more details.
Features Supported
- Support for Nikon version 2.1 and Nikon version 3.0
- Support for point-to-point and bus communication (up to 8 encoders).
- Support for baud rates from 2.5 MHz, 4 MHz, 6.67 MHz, 8 MHz, and 16 MHz.
- Support for oversampling ratio with different baud rates.
| Clock Source | Interface Speed |
| 2.5 MHz | 4 MHz | 6.67 MHz | 8 MHz | 16 MHz |
| PRU UART Clock (192 MHz) | Not tested | 8x | Not tested | 8x | 8x with fractional div |
| PRU Core Clock (200 MHz) | 8x | Not tested | 6x | Not tested | Not tested |
| PRU Core Clock (300 MHz) | 8x | Not tested | 6x with fractional div | Not tested | Not tested |
- Support for concurrent multi-channel support on a single PRU
- Up to 3 channels with identical number of encoders of the same frequency connected to all configured channels.
- Data transmission and reception must happen simultaneously on all channels.
- The encoder configuration and cable length should be the same on all channels.
- If encoders across channels don't respond at the same time, this mode will not work. Load share configuration should be used instead.
- Support for multi-channel with encoders of different make and different numbers of encoders connected across channels under load share mode (Refer Load Share Mode for more details).
- Up to 3 channels with encoders of the same frequency connected to all configured channels.
- Data transmission and reception can happen independently on all channels.
- After a command is sent, all channels wait for a response and process the response independently. However, all channels must finish processing before the next command can be triggered.
- Support for up to 40-bit absolute position (single turn + multi turn) data with additional information.
- Support for position preset, temperature information and alarms.
- Support for non-volatile (EEPROM) read and write.
- Support for identification code read and write.
- Support for encoder address setting.
- Support for individual and multiple transmission mode with encoder addresses ranging between ENC1-ENC8.
- Nikon A-format version 3.0 specific supported features:
- Support for velocity and acceleration data.
- Support for velocity coefficient read and write.
- Support for non-volatile (EEPROM) read and write access with bank.
- Support for factory setting modes which change the command response behavior:
- CMD1/CMD5 for reading ABS 40-bit data and velocity.
- CMD8/CMD9/CMD10/CMD11/CMD12 for reading lower ABS 24-bit data.
- Support for periodic trigger using PRU-ICSS IEP timer module
- Same clock frequency for all channels in multi channel mode within the same PRU-ICSS slice
- Different PRU slices can simultaneously handle encoders operating at different frequencies
Features Not Supported
In general, peripherals or features not mentioned as part of the "Features Supported" section are not supported in this release, including the following:
- Independent clock frequency for each channel in multi channel mode within the same PRU-ICSS slice
- Clock frequency is a PRU-ICSS slice level configuration
- Each channel within the same PRU-ICSS slice in multi-channel mode will have same clock frequencies
Known Limitations
- 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
- 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 2025.00.00
- Example cases when firmware gets stuck
- Any command is sent with encoder address not matching that of the encoder connected with the device
- In bus mode, if encoders with addresses 0, 1, 2 are connected and MT command is sent with encoder address 3 or more
- Command 20 is sent with ID not matching the encoder connected with the device
SysConfig Features
- Note
- It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
- Attention
- For each PRU-ICSS slice being used for Nikon, one module instance should be created in SysConfig. For up to 3 channels using 1 slice, only 1 instance needs to be added.
SysConfig can be used to configure the following:
- Selecting the ICSSG instance (Tested on ICSSG0)
- Selecting the ICSSG PRU slice (Tested on ICSSG0-PRU1)
- Configuring PINMUX
- Frequency selection
- Channel selection
- Selecting Multi Channel with encoders connected in Different Configurations (bus or one-to-one) using load share mode.
- Enabling SA Mux mode.
- Selecting source clock
- Selecting Nikon protocol version (2.1 or 3.0)
- IEP instance and IEP event selection for periodic trigger mode
- Booster Pack Support: Enable when using BP-AM2BLDCSERVO
- Note
- Nikon firmware is tested with ICSS Core Clock running at 200 MHz/300 MHz frequency or ICSS UART Clock running at 192 MHz only. ICSS Core Clock at 225/250/333 MHz is not supported due to clock divider requirements.
Periodic Trigger Modes
The Nikon driver supports two types of periodic trigger modes for continuous position sampling:
CMP Mode (Compare Event Mode)
In CMP mode, the IEP timer compare event triggers position sampling. Compare events occur when the IEP timer counter matches the configured compare value. This mode enables fixed-rate periodic sampling.
Configuration:
- Compare event range: CMP0-CMP15 (0-15)
- Configured via nikon_config_periodic_trigger_cmp_mode() API
- IEP compare event number set via nikon_config_iep_cmp_event() API
- Event selection can be done in SysConfig
- IEP configuration and CMP event configuration should be done in application. Driver uses above APIs to inform firmware to enable CMP periodic mode and uses the configured CMP event to start sampling periodically.
CAP Mode (Capture Event Mode)
In CAP mode, external signals trigger position sampling through IEP capture events. The capture event is triggered on the rising edge of the external input pulse, enabling event-driven position capture. Internal signals can also be mapped to IEP capture events via TIMESYNC/GPIOMUX router.
Configuration:
- Capture event range: CAP0-CAP7 (0-7)
- Configured via nikon_config_periodic_trigger_cap_mode() API
- IEP capture event number set via nikon_config_iep_cap_event() API
- Event selection can be done in SysConfig
- IEP configuration and CAP event configuration should be done in application. Driver uses above APIs to inform firmware to enable CAP periodic mode and uses the configured CAP event to start sampling periodically.
- Note
- External signal must be routed to IEP capture input (if needed) in application
- CAP6 and CAP7 support falling edge detection as well. In Nikon, rising edge is used always.
- Attention
- Both IEP event configuration APIs (nikon_config_iep_cmp_event() and nikon_config_iep_cap_event()) are automatically called during nikon_init() with values configured in SysConfig.
PRU-ICSS Resource Usage
- Utilizes the Peripheral IF mode (3-channel peripheral interface mode) for Nikon communication. Maximum of 3 channels are available per PRU slice. (Refer Peripheral IF mode for more details)
- Each channel has 4 pins (Clock, Data out, Data in, Output enable)
- Following table contains details of memory usage, IEP usage and interrupt controller usage:
- Attention
- In addition to the following resources used by PRU firmware, SDK examples also configure IEPx CMP0 for IEP counter reset in periodic trigger CMP mode and IEPx CMP1 for generating SYNC OUT0 used as input to CAP in periodic trigger CAP mode.
| Configuration per slice | PRU Core(s) | Memory Usage | IEP Usage | Interrupt Controller (INTC) Usage | Description |
| Single channel | PRUx | DMEM: 580 Bytes (0x0 to 0x243)
IMEM: ~ 1.4 kB | CMP Mode: IEPx CMPy for trigger (IEPx and CMPy selected in SysConfig)
CAP Mode: IEPx CAPy for trigger (IEPx and CAPy selected in SysConfig) | INTC event/input number 18 or 21 (prx_pru_mst_intr[2/3]_intr_req) is used to trigger interrupt to Arm® Cortex®-R5F based on slice | IEP, CMP/CAP events and INTC signals are used only in periodic trigger modes |
| Multi-channel with single PRU core | PRUx | DMEM: 580 Bytes (0x0 to 0x243)
IMEM: ~ 1.73 kB | CMP Mode: IEPx CMPy for trigger (IEPx and CMPy selected in SysConfig)
CAP Mode: IEPx CAPy for trigger (IEPx and CAPy selected in SysConfig) | INTC event/input number 18 or 21 (prx_pru_mst_intr[2/3]_intr_req) is used to trigger interrupt to R5F based on slice | IEP, CMP/CAP events and INTC signals are used only in periodic trigger modes |
| Multi-channel with load share across 3 PRU cores | PRUx | DMEM: 580 Bytes (0x0 to 0x243)
IMEM (per core): ~ 1.6 kB | CMP Mode: IEPx CMPy for trigger per channel (IEPx and CMPy selected in SysConfig)
CAP Mode: IEPx CAPy for trigger per channel (IEPx and CAPy selected in SysConfig) | INTC events/inputs number 18, 19, 20 or 21, 22, 23(prx_pru_mst_intr[2/3/4/5/6/7]_intr_req) are used to trigger interrupts to R5F | IEP, CMP/CAP events and INTC signals are used only in periodic trigger modes |
| RTU_PRUx |
| TX_PRUx |
- Note
- For pin usage, see Pin Multiplexing page.
NIKON Design
Nikon Protocol Design explains the design in detail.
Example
NIKON Diagnostic
API
APIs for Nikon A-Format Encoder
- Note
- Arm is a registered trademark of Arm Limited (or its subsidiaries or affiliates) in the US and/or elsewhere.