AM243x Motor Control SDK  2025.00.00
APIs for EnDAT3 Encoder

Introduction

The EnDAT3 API module provides functions for initializing and communicating with EnDAT3-compatible encoders. It supports both host-triggered and periodic communication, and provides interfaces for command transmission and response parsing.

Parameter Validation Strategy

The EnDAT3 driver implements following parameter validation approach:

Typical Usage Flow

The following sequence demonstrates typical usage of the EnDAT3 driver:

1. Initialization:

2. Operating Mode Configuration:

3. Command Execution (Host Trigger Mode):

4. Data Retrieval:

5. Error Handling:

6. Cleanup:

Data Structures

struct  endat3_bg_cmd_params
 Background command request parameters. More...
 
struct  endat3_clock_config
 Structure defining ENDAT3 clock configuration for selected frequency. More...
 
struct  endat3_params
 EnDAT3 initialization parameters. More...
 
struct  endat3_attrs
 EnDAT3 attributes (compile-time/SysConfig configuration data) More...
 
struct  endat3_hpf
 High Priority Frame structure. More...
 
struct  endat3_lph
 Low Priority Header structure. More...
 
struct  endat3_lpf
 Low Priority Frame structure. More...
 
struct  endat3_periodic_trigger_cfg
 Structure defining ENDAT3 periodic trigger configuration. More...
 
struct  endat3_interface
 EnDAT3 Interface structure. More...
 
struct  endat3_priv
 EnDAT3 private data structure (runtime state and configuration) More...
 
struct  endat3_config
 EnDAT3 configuration handle structure. More...
 

Functions

void endat3_params_init (endat3_params *params)
 Initialize EnDAT3 parameters with default values. More...
 
endat3_handle endat3_init (uint32_t index, const endat3_params *endat3_params)
 Initialize an EnDAT3 instance. More...
 
void endat3_deinit (endat3_handle handle)
 De-initialize an EnDAT3 instance. More...
 
const endat3_attrsendat3_get_attrs (endat3_handle handle)
 Get pointer to EnDAT3 attributes structure. More...
 
endat3_privendat3_get_priv (endat3_handle handle)
 Get pointer to EnDAT3 private data structure. More...
 
int32_t endat3_send_command (endat3_handle handle, uint8_t cmd, uint8_t frames)
 Send EnDAT3 command. More...
 
int32_t endat3_receive_response (endat3_handle handle)
 Receive EnDAT3 response. More...
 
const char * endat3_get_error_description (endat3_error_code error_code)
 Get error description string. More...
 
const char * endat3_get_error_action (endat3_error_code error_code)
 Get recommended action for error code. More...
 
int32_t endat3_handle_background_command_request (endat3_handle handle, const endat3_bg_cmd_params *params, uint8_t *mode, const char **acc_level_desc)
 Handle background command request. More...
 
int32_t endat3_get_hpf_status (endat3_handle handle, uint8_t *status)
 Get HPF status byte. More...
 
int32_t endat3_get_hpf_data (endat3_handle handle, uint8_t *data)
 Get HPF data array. More...
 
int32_t endat3_get_hpf_crc (endat3_handle handle, uint8_t *crc)
 Get HPF CRC value. More...
 
int32_t endat3_get_hpf_data_64_bit (endat3_handle handle, uint64_t *data)
 Get HPF data as 64-bit value. More...
 
int32_t endat3_is_hpf_data_valid (endat3_handle handle, uint8_t *is_valid)
 Check if HPF data is valid. More...
 
int32_t endat3_has_hpf_error (endat3_handle handle, uint8_t *has_error)
 Check if HPF has error flag set. More...
 
int32_t endat3_has_hpf_warning (endat3_handle handle, uint8_t *has_warning)
 Check if HPF has warning flag set. More...
 
int32_t endat3_has_absolute_value (endat3_handle handle, uint8_t *has_absolute)
 Check if absolute value is available. More...
 
int32_t endat3_get_lph_status (endat3_handle handle, uint8_t *status)
 Get LPH status byte. More...
 
int32_t endat3_get_lph_lpf_count (endat3_handle handle, uint8_t *num_lpf)
 Get number of LPF frames. More...
 
int32_t endat3_get_lph_crc (endat3_handle handle, uint8_t *crc)
 Get LPH CRC value. More...
 
int32_t endat3_get_lph_state (endat3_handle handle, endat3_lph_status *state)
 Get LPH communication state. More...
 
int32_t endat3_has_bg_error (endat3_handle handle, uint8_t *has_error)
 Check if background operation has error. More...
 
int32_t endat3_is_bg_busy (endat3_handle handle, uint8_t *is_busy)
 Check if background processor is busy. More...
 
int32_t endat3_has_bg_rtx_error (endat3_handle handle, uint8_t *has_error)
 Check if background RTX error occurred. More...
 
int32_t endat3_get_lpf_status (endat3_handle handle, uint8_t index, uint8_t *status)
 Get LPF status byte for specific frame. More...
 
int32_t endat3_get_lpf_data (endat3_handle handle, uint8_t index, uint8_t *data)
 Get LPF data array for specific frame. More...
 
int32_t endat3_get_lpf_crc (endat3_handle handle, uint8_t index, uint8_t *crc)
 Get LPF CRC value for specific frame. More...
 
int32_t endat3_get_lpf_fid (endat3_handle handle, uint8_t index, uint8_t *fid)
 Get LPF FID (Frame ID) for specific frame. More...
 
int32_t endat3_is_connected (endat3_handle handle, uint8_t *is_connected)
 Get connection status. More...
 
int32_t endat3_is_busy (endat3_handle handle, uint8_t *is_busy)
 Get busy status. More...
 
int32_t endat3_set_busy (endat3_handle handle, uint8_t busy)
 Set or clear busy status. More...
 
int32_t endat3_get_expected_tx_frame_count (endat3_handle handle, uint32_t *count)
 Get expected TX frame count. More...
 
int32_t endat3_set_expected_tx_frame_count (endat3_handle handle, uint32_t count)
 Set expected TX frame count. More...
 
int32_t endat3_get_propagation_time (endat3_handle handle, uint32_t *prop_time)
 Get propagation time. More...
 
int32_t endat3_get_foreground_op_code (endat3_handle handle, uint32_t *opcode)
 Get foreground operation code. More...
 
int32_t endat3_set_foreground_op_code (endat3_handle handle, uint32_t opcode)
 Set foreground operation code. More...
 
int32_t endat3_get_background_op_code (endat3_handle handle, uint32_t *opcode)
 Get background operation code. More...
 
int32_t endat3_set_background_op_code (endat3_handle handle, uint32_t opcode)
 Set background operation code. More...
 
int32_t endat3_get_bg_data (endat3_handle handle, uint8_t index, uint32_t *data)
 Get background data word. More...
 
int32_t endat3_set_bg_data (endat3_handle handle, uint8_t index, uint32_t data)
 Set background data word. More...
 
int32_t endat3_get_all_bg_data (endat3_handle handle, uint32_t *data)
 Get all background data. More...
 
int32_t endat3_set_all_bg_data (endat3_handle handle, const uint32_t *data)
 Set all background data. More...
 
const volatile uint8_t * endat3_get_rx_buffer (endat3_handle handle)
 Get RX buffer pointer. More...
 
const volatile uint8_t * endat3_get_tx_buffer (endat3_handle handle)
 Get TX buffer pointer. More...
 
int32_t endat3_set_tx_buffer (endat3_handle handle, const uint8_t *data, uint32_t length)
 Copy data to TX buffer. More...
 
int32_t endat3_get_hpf_frame (endat3_handle handle, endat3_hpf *hpf)
 Get complete HPF structure. More...
 
int32_t endat3_get_lph_frame (endat3_handle handle, endat3_lph *lph)
 Get complete LPH structure. More...
 
int32_t endat3_get_lpf_frame (endat3_handle handle, uint8_t index, endat3_lpf *lpf)
 Get complete LPF structure. More...
 
int32_t endat3_get_error_code (endat3_handle handle, endat3_error_code *error_code)
 Extract error code from HPF or LPF. More...
 
endat3_interfaceendat3_get_interface (endat3_handle handle)
 Get interface pointer (advanced use) More...
 
int32_t endat3_set_operating_mode (endat3_handle handle, uint8_t opmode)
 Set operating mode (host trigger or periodic trigger) More...
 
int32_t endat3_get_operating_mode (endat3_handle handle, uint8_t *opmode)
 Get current operating mode. More...
 
int32_t endat3_config_iep_cap_event (endat3_handle handle, uint8_t event_num)
 Configure IEP CAP event number in PRU DMEM. More...
 
int32_t endat3_config_iep_cmp_event (endat3_handle handle, uint8_t event_num)
 Configure IEP CMP event number in PRU DMEM. More...
 
int32_t endat3_release_start_trigger (endat3_handle handle)
 Release start trigger to firmware. More...
 
int32_t endat3_clear_start_trigger (endat3_handle handle)
 Clear start trigger flag. More...
 
int32_t endat3_get_start_trigger_status (endat3_handle handle, uint8_t *trigger_status)
 Get current start trigger status. More...
 

Typedefs

typedef endat3_configendat3_handle
 EnDAT3 Driver Handle. More...
 

Enumerations

enum  endat3_lph_status { LPH_STATUS_IDLE = 0, LPH_STATUS_RX_START = 1, LPH_STATUS_RX_LAST = 2, LPH_STATUS_BUSY = 3 }
 Low Priority Header status values. More...
 
enum  endat3_bg_req_opcode {
  ENDAT3_BGREQ_NOP = 0x01, ENDAT3_BGREQ_READ = 0x02, ENDAT3_BGREQ_WRITE = 0x03, ENDAT3_BGREQ_RECONFIGURE = 0x04,
  ENDAT3_BGREQ_AUTH = 0x80, ENDAT3_BGREQ_PROTECT = 0x81, ENDAT3_BGREQ_RESERVED = 0x82, ENDAT3_BGREQ_SETPASS = 0x83,
  ENDAT3_BGREQ_LOCATE = 0x84
}
 EnDAT3 Background Request (BGREQ) OpCodes. More...
 
enum  endat3_req_code {
  ENDAT3_REQ_DATA0 = 0x00, ENDAT3_REQ_DATA1 = 0x01, ENDAT3_REQ_DATA2 = 0x02, ENDAT3_REQ_DATA3 = 0x03,
  ENDAT3_REQ_DATA4 = 0x04, ENDAT3_REQ_DATA5 = 0x05, ENDAT3_REQ_DATA6 = 0x06, ENDAT3_REQ_DATA7 = 0x07,
  ENDAT3_REQ_DATA = 0x08, ENDAT3_REQ_DATANOP = 0x09, ENDAT3_REQ_RESET = 0x0B, ENDAT3_REQ_CLEAR = 0x0C,
  ENDAT3_REQ_ECHO = 0x0E, ENDAT3_REQ_RATE = 0x10, ENDAT3_REQ_HELLO = 0x22, ENDAT3_REQ_RESERVED = 0x40,
  ENDAT3_REQ_BUSBC = 0x80, ENDAT3_REQ_BUSP2P = 0x81, ENDAT3_REQ_BUSINIT = 0x82, ENDAT3_REQ_FORCE = 0x90
}
 EnDAT3 Foreground Request (REQ.CODE) OpCodes. More...
 
enum  endat3_menu_option {
  ENDAT3_MENU_DATA0 = 1, ENDAT3_MENU_DATA1, ENDAT3_MENU_DATA2, ENDAT3_MENU_DATA3,
  ENDAT3_MENU_DATA4, ENDAT3_MENU_DATA5, ENDAT3_MENU_DATA6, ENDAT3_MENU_DATA7,
  ENDAT3_MENU_DATA, ENDAT3_MENU_DATANOP, ENDAT3_MENU_RESET, ENDAT3_MENU_CLEAR,
  ENDAT3_MENU_ECHO, ENDAT3_MENU_RATE, ENDAT3_MENU_HELLO, ENDAT3_MENU_RESERVED,
  ENDAT3_MENU_BUSBC, ENDAT3_MENU_BUSP2P, ENDAT3_MENU_BUSINIT, ENDAT3_MENU_FORCE
}
 EnDAT3 Menu Options. More...
 
enum  endat3_hpf_status_bits {
  ENDAT3_HPF_STATUS_F = 0x01, ENDAT3_HPF_STATUS_W = 0x02, ENDAT3_HPF_STATUS_HPFV = 0x04, ENDAT3_HPF_STATUS_RM = 0x08,
  ENDAT3_HPF_STATUS_ERR_REQ = 0x10
}
 HPF STATUS bits. More...
 
enum  endat3_lph_status_flags {
  ENDAT3_LPH_STATUS_IDLE = 0x0, ENDAT3_LPH_STATUS_RX_START = 0x1, ENDAT3_LPH_STATUS_RX_LAST = 0x2, ENDAT3_LPH_STATUS_BUSY = 0x3,
  ENDAT3_LPH_BG_ERR_EXEC = 0x4, ENDAT3_LPH_BG_BUSY = 0x8, ENDAT3_LPH_BG_RTX_ERROR = 0x10, ENDAT3_LPH_STATE_MASK = 0x3
}
 LPH Status Flags. More...
 
enum  endat3_error_code {
  ENDAT3_ERR_UNKNOWN = 0x0000, ENDAT3_FGERR_RECONFIGURE = 0x0001, ENDAT3_FGERR_ECHO = 0x0002, ENDAT3_FGERR_INVALID_FID = 0x0100,
  ENDAT3_FGERR_DUPLICATE_FID = 0x0101, ENDAT3_FGERR_INVALID_DATA = 0x0200, ENDAT3_FGERR_INT_TRM = 0x0201, ENDAT3_FGERR_NO_SENSOR_DATA = 0x0300,
  ENDAT3_BGERR_USAGE = 0x1100, ENDAT3_BGERR_USAGE_OPCODE = 0x1101, ENDAT3_BGERR_USAGE_ARGUMENTS = 0x1102, ENDAT3_BGERR_USAGE_SEQUENCE = 0x1103,
  ENDAT3_BGERR_USAGE_ACCESS_DENIED = 0x1104, ENDAT3_BGERR_USAGE_MEM_ADDRESS = 0x1105, ENDAT3_BGERR_USAGE_NO_BG = 0x1106, ENDAT3_BGERR_INTERNAL = 0x1200,
  ENDAT3_BGERR_INTERNAL_MEMORY = 0x1201, ENDAT3_BGERR_INTERNAL_CONFIG = 0x1202
}
 EnDat3 Error Codes. More...
 

Macros

#define ENDAT3_OPMODE_PERIODIC_CMP   (0x0U)
 EnDat3 Operation Mode: Periodic trigger with CMP event. More...
 
#define ENDAT3_OPMODE_HOST_TRIGGER   (0x1U)
 EnDat3 Operation Mode: Host trigger. More...
 
#define ENDAT3_OPMODE_PERIODIC_CAP   (0x2U)
 EnDat3 Operation Mode: Periodic trigger with CAP event. More...
 
#define ENDAT3_SUCCESS   (0)
 
#define ENDAT3_ERR_INVALID_INPUT   (-1)
 
#define ENDAT3_ERR_BUSY   (-2)
 
#define ENDAT3_ERR_RX_FAIL   (-3)
 
#define ENDAT3_ERR_LPH_CRC_FAIL   (-4)
 
#define ENDAT3_ERR_HPF_CRC_FAIL   (-5)
 
#define ENDAT3_ERR_LPF_CRC_FAIL   (-6)
 
#define ENDAT3_ERR_SAMPLING_ERROR   (-7)
 
#define ENDAT3_ERR_INVALID_OPMODE   (-8)
 
#define ENCODER_IDLE   (0x0)
 
#define ENCODER_BUSY   (0x1)
 
#define ENCODER_ERROR   (0x2)
 
#define ENDAT3_FRAME_SIZE_BYTES   (4U)
 
#define ENDAT3_CHANNEL_MASK_MAX   (0x7U)
 
#define ENDAT3_MAX_BG_CMD_INDEX   (3U)
 
#define ENDAT3_CORE_CLK_200MHZ   (200000000U)
 
#define ENDAT3_CORE_CLK_300MHZ   (300000000U)
 
#define REFERENCE_PRU_FREQ_HZ   (1000000ULL)
 Reference frequency for delay calculations (1 MHz) More...
 
#define REFERENCE_PRU_FREQ_HZ_FOR_SAMPLING   (5000000ULL)
 5 MHz reference for sampling delay (gives 60 cycles @ 300MHz, 40 cycles @ 200MHz) More...
 
#define ENDAT3_BAUD_RATE_12_5_MBPS   (0U)
 
#define ENDAT3_BAUD_RATE_25_MBPS   (1U)
 
#define ENDAT3_OVERSAMPLE_RATE_8X   (8U)
 
#define ENDAT3_SB_POLARITY   (0U)
 
#define ENDAT3_TX_CLOCK_MULTIPLIER   (2U)
 
#define ENDAT3_HPF_TOTAL_SIZE   (8)
 
#define ENDAT3_LPH_TOTAL_SIZE   (4)
 
#define ENDAT3_LPF_TOTAL_SIZE   (8)
 
#define ENDAT3_HPF_OFFSET   (0)
 
#define ENDAT3_LPH_OFFSET   (8)
 
#define ENDAT3_LPF_OFFSET   (12)
 
#define ENDAT3_MIN_RX_BUFFER_SIZE   (20)
 
#define ENDAT3_RESET_HARD   (0x01)
 
#define ENDAT3_RESET_SOFT   (0x00)
 
#define ENDAT3_CLEAR_F   (0x01)
 
#define ENDAT3_CLEAR_W   (0x02)
 
#define ENDAT3_CLEAR_REF   (0x04)
 
#define ENDAT3_RATE_12_5MBPS   (0x00)
 
#define ENDAT3_RATE_25MBPS   (0x01)
 
#define ENDAT3_BUSINIT_RESET_ADDR   (0x01)
 
#define ENDAT3_BUSINIT_KEEP_ADDR   (0x00)
 
#define ENDAT3_PROTECT_QUERY   (0x01)
 
#define ENDAT3_PROTECT_SET_READ   (0x02)
 
#define ENDAT3_PROTECT_SET_WRITE   (0x03)
 
#define ENDAT3_PASSWORD_HIGH_MASK   (0xFFFF0000)
 
#define ENDAT3_PASSWORD_LOW_MASK   (0x0000FFFF)
 
#define ENDAT3_PASSWORD_HIGH_SHIFT   (16)
 
#define ENDAT3_PRE_LENGTH   (25)
 
#define ENDAT3_POST_LENGTH   (4)
 

EnDat3 PRU Operating Modes

#define ENDAT3_MODE_SINGLE_CHANNEL_SINGLE_PRU   (0U)
 Single channel, single PRU mode (non-load-share) More...
 
#define ENDAT3_TX_START_DELAY_1_REF_CYCLES   (218U)
 
#define ENDAT3_TX_START_DELAY_2_REF_CYCLES   (1748U)
 
#define ENDAT3_TX_START_DELAY_3_REF_CYCLES   (438U)
 
#define ENDAT3_DELAY_10MS_REF_CYCLES   (10486U)
 
#define ENDAT3_BAUD_RATE_12_5_MBPS_VALUE   (12500000U)
 
#define ENDAT3_BAUD_RATE_25_MBPS_VALUE   (25000000U)
 
#define ENDAT3_IEP_MAX_CAP_EVENT   (0x8U)
 
#define ENDAT3_IEP_MAX_CMP_EVENT   (0x10U)
 
#define ENDAT3_CFG_REG_SIZE   (4U)
 
#define ENDAT3_CSL_ICSS_PR1_IEP0_SLV_CAP0_REG0   (CSL_ICSS_PR1_IEP0_SLV_CAP_CFG_REG + 2U*ENDAT3_CFG_REG_SIZE)
 
#define ENDAT3_8_BYTE_REG_OFFSET   (8U)
 
#define HPF_DATA_SIZE   (6)
 
#define LPF_DATA_SIZE   (6)
 
#define MAX_LPF_COUNT   (8)
 
#define LUT_SIZE   (64)
 
#define RX_BUFFER_SIZE   (64)
 
#define TX_BUFFER_SIZE   (24)
 
#define BG_DATA_SIZE   (6)
 

Macro Definition Documentation

◆ ENDAT3_MODE_SINGLE_CHANNEL_SINGLE_PRU

#define ENDAT3_MODE_SINGLE_CHANNEL_SINGLE_PRU   (0U)

Single channel, single PRU mode (non-load-share)

◆ ENDAT3_OPMODE_PERIODIC_CMP

#define ENDAT3_OPMODE_PERIODIC_CMP   (0x0U)

EnDat3 Operation Mode: Periodic trigger with CMP event.

In periodic CMP mode, the PRU firmware automatically triggers position readout at regular intervals using IEP CMP (Compare) events.

◆ ENDAT3_OPMODE_HOST_TRIGGER

#define ENDAT3_OPMODE_HOST_TRIGGER   (0x1U)

EnDat3 Operation Mode: Host trigger.

In host trigger mode, the R5F host processor explicitly triggers each position readout by setting the trigger bit.

◆ ENDAT3_OPMODE_PERIODIC_CAP

#define ENDAT3_OPMODE_PERIODIC_CAP   (0x2U)

EnDat3 Operation Mode: Periodic trigger with CAP event.

In periodic CAP mode, the PRU firmware automatically triggers position readout at regular intervals using IEP CAP (Capture) events.

◆ ENDAT3_SUCCESS

#define ENDAT3_SUCCESS   (0)

Success code

◆ ENDAT3_ERR_INVALID_INPUT

#define ENDAT3_ERR_INVALID_INPUT   (-1)

Invalid input parameter (NULL pointer, invalid value, out of bounds)

◆ ENDAT3_ERR_BUSY

#define ENDAT3_ERR_BUSY   (-2)

Encoder busy (transfer in progress)

◆ ENDAT3_ERR_RX_FAIL

#define ENDAT3_ERR_RX_FAIL   (-3)

Reception failure

◆ ENDAT3_ERR_LPH_CRC_FAIL

#define ENDAT3_ERR_LPH_CRC_FAIL   (-4)

LPH (Low Priority Header) CRC mismatch

◆ ENDAT3_ERR_HPF_CRC_FAIL

#define ENDAT3_ERR_HPF_CRC_FAIL   (-5)

HPF (High Priority Frame) CRC mismatch

◆ ENDAT3_ERR_LPF_CRC_FAIL

#define ENDAT3_ERR_LPF_CRC_FAIL   (-6)

LPF (Low Priority Frame) CRC mismatch

◆ ENDAT3_ERR_SAMPLING_ERROR

#define ENDAT3_ERR_SAMPLING_ERROR   (-7)

Encoder sampling/timing error

◆ ENDAT3_ERR_INVALID_OPMODE

#define ENDAT3_ERR_INVALID_OPMODE   (-8)

Invalid operating mode (mode > 2)

◆ ENCODER_IDLE

#define ENCODER_IDLE   (0x0)

Encoder idle, ready for communication

◆ ENCODER_BUSY

#define ENCODER_BUSY   (0x1)

Encoder busy, transfer in progress

◆ ENCODER_ERROR

#define ENCODER_ERROR   (0x2)

Encoder error detected during transfer

◆ ENDAT3_FRAME_SIZE_BYTES

#define ENDAT3_FRAME_SIZE_BYTES   (4U)

EnDAT3 frame size in bytes

◆ ENDAT3_CHANNEL_MASK_MAX

#define ENDAT3_CHANNEL_MASK_MAX   (0x7U)

Maximum valid channel mask (ch0|ch1|ch2)

◆ ENDAT3_MAX_BG_CMD_INDEX

#define ENDAT3_MAX_BG_CMD_INDEX   (3U)

Exclusive upper bound for background command index (valid range: 0-2)

◆ ENDAT3_CORE_CLK_200MHZ

#define ENDAT3_CORE_CLK_200MHZ   (200000000U)

200 MHz core clock frequency

◆ ENDAT3_CORE_CLK_300MHZ

#define ENDAT3_CORE_CLK_300MHZ   (300000000U)

300 MHz core clock frequency

◆ REFERENCE_PRU_FREQ_HZ

#define REFERENCE_PRU_FREQ_HZ   (1000000ULL)

Reference frequency for delay calculations (1 MHz)

◆ REFERENCE_PRU_FREQ_HZ_FOR_SAMPLING

#define REFERENCE_PRU_FREQ_HZ_FOR_SAMPLING   (5000000ULL)

5 MHz reference for sampling delay (gives 60 cycles @ 300MHz, 40 cycles @ 200MHz)

◆ ENDAT3_TX_START_DELAY_1_REF_CYCLES

#define ENDAT3_TX_START_DELAY_1_REF_CYCLES   (218U)

These values are derived from the original 300 MHz PRU frequency implementation and are scaled to actual PRU frequency at runtime using the formula: actual_cycles = (reference_cycles * actual_freq) / REFERENCE_PRU_FREQ_HZ TX start delay 1 reference (65535 / 300)

◆ ENDAT3_TX_START_DELAY_2_REF_CYCLES

#define ENDAT3_TX_START_DELAY_2_REF_CYCLES   (1748U)

TX start delay 2 reference (524288 / 300)

◆ ENDAT3_TX_START_DELAY_3_REF_CYCLES

#define ENDAT3_TX_START_DELAY_3_REF_CYCLES   (438U)

TX start delay 3 reference (131328 / 300)

◆ ENDAT3_DELAY_10MS_REF_CYCLES

#define ENDAT3_DELAY_10MS_REF_CYCLES   (10486U)

10ms delay reference (3145728 / 300)

◆ ENDAT3_BAUD_RATE_12_5_MBPS

#define ENDAT3_BAUD_RATE_12_5_MBPS   (0U)

12.5 Mbps mode selector

◆ ENDAT3_BAUD_RATE_25_MBPS

#define ENDAT3_BAUD_RATE_25_MBPS   (1U)

25 Mbps mode selector

◆ ENDAT3_BAUD_RATE_12_5_MBPS_VALUE

#define ENDAT3_BAUD_RATE_12_5_MBPS_VALUE   (12500000U)

Clock configuration constants 12.5 Mbps baud rate value in Hz

◆ ENDAT3_BAUD_RATE_25_MBPS_VALUE

#define ENDAT3_BAUD_RATE_25_MBPS_VALUE   (25000000U)

25 Mbps baud rate value in Hz

◆ ENDAT3_IEP_MAX_CAP_EVENT

#define ENDAT3_IEP_MAX_CAP_EVENT   (0x8U)

IEP (Industrial Ethernet Peripheral) event limits for periodic trigger mode Maximum IEP CAP events (0-7)

◆ ENDAT3_IEP_MAX_CMP_EVENT

#define ENDAT3_IEP_MAX_CMP_EVENT   (0x10U)

Maximum IEP CMP events (0-15)

◆ ENDAT3_CFG_REG_SIZE

#define ENDAT3_CFG_REG_SIZE   (4U)

IEP register offsets for periodic trigger mode IEP configuration register size in bytes

◆ ENDAT3_CSL_ICSS_PR1_IEP0_SLV_CAP0_REG0

#define ENDAT3_CSL_ICSS_PR1_IEP0_SLV_CAP0_REG0   (CSL_ICSS_PR1_IEP0_SLV_CAP_CFG_REG + 2U*ENDAT3_CFG_REG_SIZE)

IEP CAP0 register 0 offset

◆ ENDAT3_8_BYTE_REG_OFFSET

#define ENDAT3_8_BYTE_REG_OFFSET   (8U)

8-byte register offset for IEP CMP/CAP registers

◆ ENDAT3_OVERSAMPLE_RATE_8X

#define ENDAT3_OVERSAMPLE_RATE_8X   (8U)

8x oversampling rate for RX clock

◆ ENDAT3_SB_POLARITY

#define ENDAT3_SB_POLARITY   (0U)

Start bit polarity configuration

◆ ENDAT3_TX_CLOCK_MULTIPLIER

#define ENDAT3_TX_CLOCK_MULTIPLIER   (2U)

TX clock multiplier: TX clock = 2x baud rate

◆ HPF_DATA_SIZE

#define HPF_DATA_SIZE   (6)

Buffer and data size definitions High Priority Frame data size in bytes

◆ LPF_DATA_SIZE

#define LPF_DATA_SIZE   (6)

Low Priority Frame data size in bytes

◆ MAX_LPF_COUNT

#define MAX_LPF_COUNT   (8)

Maximum number of LPF frames

◆ LUT_SIZE

#define LUT_SIZE   (64)

Lookup table size (256 bytes / 4 bytes per uint32_t)

◆ RX_BUFFER_SIZE

#define RX_BUFFER_SIZE   (64)

Receive buffer size

◆ TX_BUFFER_SIZE

#define TX_BUFFER_SIZE   (24)

Transmit buffer size

◆ BG_DATA_SIZE

#define BG_DATA_SIZE   (6)

Background data array size

◆ ENDAT3_HPF_TOTAL_SIZE

#define ENDAT3_HPF_TOTAL_SIZE   (8)

HPF total frame size: 6 data + 1 status + 1 CRC

◆ ENDAT3_LPH_TOTAL_SIZE

#define ENDAT3_LPH_TOTAL_SIZE   (4)

LPH total frame size: 2 data + 1 status + 1 CRC

◆ ENDAT3_LPF_TOTAL_SIZE

#define ENDAT3_LPF_TOTAL_SIZE   (8)

LPF total frame size: 6 data + 1 FID/status + 1 CRC

◆ ENDAT3_HPF_OFFSET

#define ENDAT3_HPF_OFFSET   (0)

HPF offset in RX buffer

◆ ENDAT3_LPH_OFFSET

#define ENDAT3_LPH_OFFSET   (8)

LPH offset in RX buffer (after HPF)

◆ ENDAT3_LPF_OFFSET

#define ENDAT3_LPF_OFFSET   (12)

LPF offset in RX buffer (after HPF + LPH)

◆ ENDAT3_MIN_RX_BUFFER_SIZE

#define ENDAT3_MIN_RX_BUFFER_SIZE   (20)

Minimum RX buffer size: HPF(8) + LPH(4) + LPF(8)

◆ ENDAT3_RESET_HARD

#define ENDAT3_RESET_HARD   (0x01)

Hard reset command data

◆ ENDAT3_RESET_SOFT

#define ENDAT3_RESET_SOFT   (0x00)

Soft reset command data

◆ ENDAT3_CLEAR_F

#define ENDAT3_CLEAR_F   (0x01)

Clear F (error) flag

◆ ENDAT3_CLEAR_W

#define ENDAT3_CLEAR_W   (0x02)

Clear W (warning) flag

◆ ENDAT3_CLEAR_REF

#define ENDAT3_CLEAR_REF   (0x04)

Clear reference flag

◆ ENDAT3_RATE_12_5MBPS

#define ENDAT3_RATE_12_5MBPS   (0x00)

12.5 Mbps data rate

◆ ENDAT3_RATE_25MBPS

#define ENDAT3_RATE_25MBPS   (0x01)

25 Mbps data rate

◆ ENDAT3_BUSINIT_RESET_ADDR

#define ENDAT3_BUSINIT_RESET_ADDR   (0x01)

Bus init with address reset

◆ ENDAT3_BUSINIT_KEEP_ADDR

#define ENDAT3_BUSINIT_KEEP_ADDR   (0x00)

Bus init keeping addresses

◆ ENDAT3_PROTECT_QUERY

#define ENDAT3_PROTECT_QUERY   (0x01)

Query current access levels

◆ ENDAT3_PROTECT_SET_READ

#define ENDAT3_PROTECT_SET_READ   (0x02)

Set access level for read operations

◆ ENDAT3_PROTECT_SET_WRITE

#define ENDAT3_PROTECT_SET_WRITE   (0x03)

Set access level for write operations

◆ ENDAT3_PASSWORD_HIGH_MASK

#define ENDAT3_PASSWORD_HIGH_MASK   (0xFFFF0000)

Upper 16 bits mask

◆ ENDAT3_PASSWORD_LOW_MASK

#define ENDAT3_PASSWORD_LOW_MASK   (0x0000FFFF)

Lower 16 bits mask

◆ ENDAT3_PASSWORD_HIGH_SHIFT

#define ENDAT3_PASSWORD_HIGH_SHIFT   (16)

Shift for upper 16 bits

◆ ENDAT3_PRE_LENGTH

#define ENDAT3_PRE_LENGTH   (25)

Minimum preamble length in halfbits

◆ ENDAT3_POST_LENGTH

#define ENDAT3_POST_LENGTH   (4)

Postamble length in halfbits

Typedef Documentation

◆ endat3_handle

EnDAT3 Driver Handle.

Opaque handle to an EnDAT3 instance. Obtained from endat3_init() and used in all subsequent EnDAT3 API calls.

Enumeration Type Documentation

◆ endat3_lph_status

Low Priority Header status values.

Status values that can appear in the LPH status byte.

Enumerator
LPH_STATUS_IDLE 

IDLE state

LPH_STATUS_RX_START 

RX_START state - beginning of reception

LPH_STATUS_RX_LAST 

RX_LAST state - last reception frame

LPH_STATUS_BUSY 

BUSY state - processing in progress

◆ endat3_bg_req_opcode

EnDAT3 Background Request (BGREQ) OpCodes.

Operation codes for background processing operations.

Enumerator
ENDAT3_BGREQ_NOP 

No operation

ENDAT3_BGREQ_READ 

Read from encoder memory

ENDAT3_BGREQ_WRITE 

Write to encoder memory

ENDAT3_BGREQ_RECONFIGURE 

Reconfigure parameters

ENDAT3_BGREQ_AUTH 

Authentication

ENDAT3_BGREQ_PROTECT 

Set protection

ENDAT3_BGREQ_RESERVED 

Reserved for future use

ENDAT3_BGREQ_SETPASS 

Set password

ENDAT3_BGREQ_LOCATE 

Locate function

◆ endat3_req_code

EnDAT3 Foreground Request (REQ.CODE) OpCodes.

Operation codes for foreground request commands.

Enumerator
ENDAT3_REQ_DATA0 

Activate LPF send list 0

ENDAT3_REQ_DATA1 

Activate LPF send list 1

ENDAT3_REQ_DATA2 

Activate LPF send list 2

ENDAT3_REQ_DATA3 

Activate LPF send list 3

ENDAT3_REQ_DATA4 

Activate LPF send list 4

ENDAT3_REQ_DATA5 

Activate LPF send list 5

ENDAT3_REQ_DATA6 

Activate LPF send list 6

ENDAT3_REQ_DATA7 

Activate LPF send list 7

ENDAT3_REQ_DATA 

Data with BGD

ENDAT3_REQ_DATANOP 

Data without BGD

ENDAT3_REQ_RESET 

Encoder reset

ENDAT3_REQ_CLEAR 

Resetting of states

ENDAT3_REQ_ECHO 

Echo for measuring propagation time

ENDAT3_REQ_RATE 

Set data transfer rate

ENDAT3_REQ_HELLO 

Switch to EnDat 3 mode

ENDAT3_REQ_RESERVED 

Reserved

ENDAT3_REQ_BUSBC 

Bus command for broadcast

ENDAT3_REQ_BUSP2P 

Bus command for point-to-point communication

ENDAT3_REQ_BUSINIT 

Initialization of a bus setup

ENDAT3_REQ_FORCE 

Forced dynamic sampling

◆ endat3_menu_option

EnDAT3 Menu Options.

Menu options for user interface commands.

Enumerator
ENDAT3_MENU_DATA0 

Start with 1

ENDAT3_MENU_DATA1 

DATA1 command

ENDAT3_MENU_DATA2 

DATA2 command

ENDAT3_MENU_DATA3 

DATA3 command

ENDAT3_MENU_DATA4 

DATA4 command

ENDAT3_MENU_DATA5 

DATA5 command

ENDAT3_MENU_DATA6 

DATA6 command

ENDAT3_MENU_DATA7 

DATA7 command

ENDAT3_MENU_DATA 

DATA command

ENDAT3_MENU_DATANOP 

DATANOP command

ENDAT3_MENU_RESET 

RESET command

ENDAT3_MENU_CLEAR 

CLEAR command

ENDAT3_MENU_ECHO 

ECHO command

ENDAT3_MENU_RATE 

RATE command

ENDAT3_MENU_HELLO 

HELLO command

ENDAT3_MENU_RESERVED 

RESERVED command

ENDAT3_MENU_BUSBC 

BUSBC command

ENDAT3_MENU_BUSP2P 

BUSP2P command

ENDAT3_MENU_BUSINIT 

BUSINIT command

ENDAT3_MENU_FORCE 

FORCE command

◆ endat3_hpf_status_bits

HPF STATUS bits.

Individual bits in the HPF status byte.

Enumerator
ENDAT3_HPF_STATUS_F 

Bit 0: Collective error bit

ENDAT3_HPF_STATUS_W 

Bit 1: Collective warning bit

ENDAT3_HPF_STATUS_HPFV 

Bit 2: Validity of HPF data

ENDAT3_HPF_STATUS_RM 

Bit 3: Availability of absolute value

ENDAT3_HPF_STATUS_ERR_REQ 

Bit 4: Request code not supported

◆ endat3_lph_status_flags

LPH Status Flags.

Status flags for the Low Priority Header (LPH).

Enumerator
ENDAT3_LPH_STATUS_IDLE 

Idle state, no background operation in progress

ENDAT3_LPH_STATUS_RX_START 

First frame of a multi-frame background response

ENDAT3_LPH_STATUS_RX_LAST 

Last frame of a multi-frame background response

ENDAT3_LPH_STATUS_BUSY 

Background operation in progress

ENDAT3_LPH_BG_ERR_EXEC 

Error during background operation execution

ENDAT3_LPH_BG_BUSY 

Background processor is busy

ENDAT3_LPH_BG_RTX_ERROR 

Background transmit/receive error

ENDAT3_LPH_STATE_MASK 

Mask for extracting LPH state (bits 0-1)

◆ endat3_error_code

EnDat3 Error Codes.

Error codes used in foreground and background communication.

Enumerator
ENDAT3_ERR_UNKNOWN 

The cause of the error is unknown

ENDAT3_FGERR_RECONFIGURE 

Device is in configuration as a result of RECONFIGURE

ENDAT3_FGERR_ECHO 

An ECHO is being responded to

ENDAT3_FGERR_INVALID_FID 

An invalid FID was configured

ENDAT3_FGERR_DUPLICATE_FID 

FID was selected more than once during the cycle

ENDAT3_FGERR_INVALID_DATA 

LPF is supported, but invalid data were delivered internally

ENDAT3_FGERR_INT_TRM 

LPF is supported but currently unavailable

ENDAT3_FGERR_NO_SENSOR_DATA 

Sensor box data not available

ENDAT3_BGERR_USAGE 

Generic operator error

ENDAT3_BGERR_USAGE_OPCODE 

Invalid or unsupported command code

ENDAT3_BGERR_USAGE_ARGUMENTS 

Invalid arguments

ENDAT3_BGERR_USAGE_SEQUENCE 

Invalid command sequence

ENDAT3_BGERR_USAGE_ACCESS_DENIED 

Access denied; insufficient user level

ENDAT3_BGERR_USAGE_MEM_ADDRESS 

Access to invalid address

ENDAT3_BGERR_USAGE_NO_BG 

Encoder does not support background processing

ENDAT3_BGERR_INTERNAL 

Generic exception error in the encoder

ENDAT3_BGERR_INTERNAL_MEMORY 

Exception error when accessing memory

ENDAT3_BGERR_INTERNAL_CONFIG 

Exception error: configuration invalid

Function Documentation

◆ endat3_params_init()

void endat3_params_init ( endat3_params params)

Initialize EnDAT3 parameters with default values.

Populates the endat3_params structure with default values. Must be called before passing params to endat3_init.

Parameters
[out]paramsPointer to params structure to initialize
Note
On NULL params, function returns without performing any operation

◆ endat3_init()

endat3_handle endat3_init ( uint32_t  index,
const endat3_params endat3_params 
)

Initialize an EnDAT3 instance.

Initializes an EnDAT3 driver instance with the specified configuration. This function validates all parameters, sets up the firmware interface, and configures hardware based on both SysConfig attributes and runtime params.

Note
This function internally calls: PRUICSS_setGpMuxSelect(), endat3_config_clr_cfg0(), endat3_calculate_clock(), endat3_config_clock(), endat3_set_delay_cycles(), endat3_set_channel_mask(), endat3_generate_memory_image(), endat3_config_iep_base_address(), endat3_config_iep_cmp_event(), endat3_config_iep_cap_event(), and endat3_set_operating_mode().
Parameters
[in]indexIndex of EnDAT3 (0 to gEndat3ConfigNum - 1)
[in]endat3_paramsPointer to structure containing EnDAT3 initialization parameters
Return values
handlePointer to initialized endat3_handle instance
NULLOn validation failure including:
  • Invalid index (>= gEndat3ConfigNum)
  • NULL params or params->pruicss_handle
  • NULL attrs/priv in config array
  • Invalid attrs fields
  • Only ENDAT3_BAUD_RATE_12_5_MBPS supported (12.5 Mbps)
  • Only 200MHz or 300MHz core_clk_freq supported
  • Hardware initialization failure (PRUICSS_setGpMuxSelect, clock config, etc.)

◆ endat3_deinit()

void endat3_deinit ( endat3_handle  handle)

De-initialize an EnDAT3 instance.

De-initializes the EnDAT3 instance by marking the handle as closed (is_open = 0). It does not free memory or disable PRU cores.

Parameters
[in]handleHandle to EnDAT3 instance
Note
On NULL handle, function returns without performing any operation.

◆ endat3_get_attrs()

const endat3_attrs* endat3_get_attrs ( endat3_handle  handle)

Get pointer to EnDAT3 attributes structure.

Provides access to the read-only attributes structure containing configuration parameters set during initialization or generated by SysConfig.

Parameters
[in]handleEnDAT3 handle
Return values
attrsPointer to const endat3_attrs structure
NULLIf handle is NULL

◆ endat3_get_priv()

endat3_priv* endat3_get_priv ( endat3_handle  handle)

Get pointer to EnDAT3 private data structure.

Provides access to the private data structure containing runtime state information.

Parameters
[in]handleEnDAT3 handle
Return values
privPointer to endat3_priv structure
NULLIf handle is NULL

◆ endat3_send_command()

int32_t endat3_send_command ( endat3_handle  handle,
uint8_t  cmd,
uint8_t  frames 
)

Send EnDAT3 command.

Prepares and sends an EnDAT3 command with the specified command code and number of frames. Validates input parameters and checks for buffer overflow conditions before transmission.

Parameters
handleEnDAT3 handle
cmdCommand code
framesNumber of frames to transmit (1-6, limited by TX_BUFFER_SIZE/4)
Returns
ENDAT3_SUCCESS (0) on success
ENDAT3_ERR_INVALID_INPUT (-1) on error: invalid handle, NULL pointers, buffer overflow, or invalid parameters
Note
CRITICAL: Always check return value before calling endat3_set_busy() or waiting for response
Validation performed:
  • Handle NULL check
  • Frame count validation via endat3_prepare_request() (1 to ENDAT3_MAX_TX_FRAMES)
  • Background data array validation (NULL check)
Internal function used: endat3_prepare_request()

◆ endat3_receive_response()

int32_t endat3_receive_response ( endat3_handle  handle)

Receive EnDAT3 response.

Receives and processes EnDAT3 response frames, verifying CRC integrity and parsing the data into appropriate structures.

Parameters
handleEnDAT3 handle
Returns
ENDAT3_SUCCESS (0) on successful reception with valid CRC
ENDAT3_ERR_INVALID_INPUT (-1) if handle or priv is NULL
ENDAT3_ERR_BUSY (-2) if encoder is busy (transfer in progress)
ENDAT3_ERR_LPH_CRC_FAIL (-4) on LPH CRC mismatch
ENDAT3_ERR_HPF_CRC_FAIL (-5) on HPF CRC mismatch
ENDAT3_ERR_LPF_CRC_FAIL (-6) on LPF CRC mismatch
ENDAT3_ERR_SAMPLING_ERROR (-7) on encoder sampling/timing error (busy==ENCODER_ERROR)
Note
IMPORTANT: Check return value == ENDAT3_SUCCESS before reading HPF/LPH/LPF data
Validation performed:
  • Handle NULL check
  • Busy status checking via endat3_wait_rx_complete()
  • RX buffer validation (internal)
  • CRC validation for HPF, LPH, and LPF (when applicable)

◆ endat3_get_error_description()

const char* endat3_get_error_description ( endat3_error_code  error_code)

Get error description string.

Returns a human-readable description for the given EnDAT3 error code. Useful for logging and debugging error conditions.

Parameters
error_codeThe error code to get description for
Returns
Pointer to error description string (never NULL, always returns valid string)
if(endat3_get_error_code(handle, &error) == ENDAT3_SUCCESS)
{
const char* desc = endat3_get_error_description(error);
DebugP_log("Error: %s\r\n", desc);
}

◆ endat3_get_error_action()

const char* endat3_get_error_action ( endat3_error_code  error_code)

Get recommended action for error code.

Returns a recommended action string for the given EnDAT3 error code. Helps users understand what to do when an error occurs.

Parameters
error_codeThe error code to get recommended action for
Returns
Pointer to recommended action string (never NULL, always returns valid string)
if(endat3_get_error_code(handle, &error) == ENDAT3_SUCCESS)
{
const char* action = endat3_get_error_action(error);
DebugP_log("Recommended action: %s\r\n", action);
}

◆ endat3_handle_background_command_request()

int32_t endat3_handle_background_command_request ( endat3_handle  handle,
const endat3_bg_cmd_params params,
uint8_t *  mode,
const char **  acc_level_desc 
)

Handle background command request.

Processes and prepares a background command request for transmission. Handles various background operations like READ, WRITE, AUTH, PROTECT, etc. Formats the command data according to the operation code and parameters.

Parameters
handleEnDAT3 handle
paramsPointer to background command parameters structure (endat3_bg_cmd_params)
modePointer to store mode value (optional, can be NULL if not needed). Only populated when op_code is ENDAT3_BGREQ_PROTECT and mode is not NULL.
acc_level_descPointer to store access level description string (optional, can be NULL if not needed). Only populated when op_code is ENDAT3_BGREQ_PROTECT and acc_level_desc is not NULL.
Return values
ENDAT3_SUCCESS(0) on success
ENDAT3_ERR_INVALID_INPUT(-1) on validation failure (NULL handle, NULL params, or index >= ENDAT3_MAX_BG_CMD_INDEX)
Note
Validation performed:
  • Handle NULL check
  • Params pointer NULL check
  • Index bounds check (index must be 0-2)
  • Individual parameter members (op_code, addr_msb, addr_lsb, data, frame_cnt) are NOT validated
Output parameters (mode, acc_level_desc) are only meaningful for ENDAT3_BGREQ_PROTECT operation

◆ endat3_get_hpf_status()

int32_t endat3_get_hpf_status ( endat3_handle  handle,
uint8_t *  status 
)

Get HPF status byte.

Retrieves the status byte from the High Priority Frame, which contains critical status flags including F, W, HPFV, RM, and ERR_REQ bits.

Parameters
handleEnDAT3 handle
statusPointer to store HPF status byte
Returns
ENDAT3_SUCCESS (0) on success, ENDAT3_ERR_INVALID_INPUT (-1) if handle or status is NULL
uint8_t status;
if(endat3_get_hpf_status(handle, &status) == ENDAT3_SUCCESS)
{
if(status & ENDAT3_HPF_STATUS_F)
{
// Handle error condition
}
}

◆ endat3_get_hpf_data()

int32_t endat3_get_hpf_data ( endat3_handle  handle,
uint8_t *  data 
)

Get HPF data array.

Retrieves the 6-byte data payload from the High Priority Frame. The data is copied to the provided buffer.

Parameters
handleEnDAT3 handle
dataBuffer to store HPF data (must be at least 6 bytes)
Returns
Number of bytes copied (6) on success
ENDAT3_ERR_INVALID_INPUT (-1) if handle or data is NULL
Note
On failure (NULL handle or data pointer), returns ENDAT3_ERR_INVALID_INPUT immediately without accessing any memory. Always check return value before using the data buffer.
uint8_t hpf_data[6];
int32_t bytes = endat3_get_hpf_data(handle, hpf_data);
if(bytes == 6)
{
// Process HPF data
}

◆ endat3_get_hpf_crc()

int32_t endat3_get_hpf_crc ( endat3_handle  handle,
uint8_t *  crc 
)

Get HPF CRC value.

Retrieves the CRC checksum from the High Priority Frame.

Parameters
handleEnDAT3 handle
crcPointer to store HPF CRC value
Returns
ENDAT3_SUCCESS (0) on success, ENDAT3_ERR_INVALID_INPUT (-1) if handle or crc is NULL

◆ endat3_get_hpf_data_64_bit()

int32_t endat3_get_hpf_data_64_bit ( endat3_handle  handle,
uint64_t *  data 
)

Get HPF data as 64-bit value.

Retrieves the HPF data payload as a single 64-bit unsigned integer. Useful for position data extraction. Data is packed in little-endian format.

Parameters
handleEnDAT3 handle
dataPointer to store HPF data as uint64_t
Returns
ENDAT3_SUCCESS (0) on success, ENDAT3_ERR_INVALID_INPUT (-1) if handle or data is NULL
uint64_t position;
if(endat3_get_hpf_data_64_bit(handle, &position) == ENDAT3_SUCCESS)
{
uint32_t single_turn = position & 0x1FFF; // Extract 13-bit single turn
}

◆ endat3_is_hpf_data_valid()

int32_t endat3_is_hpf_data_valid ( endat3_handle  handle,
uint8_t *  is_valid 
)

Check if HPF data is valid.

Checks the HPFV bit in the HPF status to determine if the data is valid.

Parameters
handleEnDAT3 handle
is_validPointer to store result (1 if HPF data is valid, 0 otherwise)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or is_valid is NULL

◆ endat3_has_hpf_error()

int32_t endat3_has_hpf_error ( endat3_handle  handle,
uint8_t *  has_error 
)

Check if HPF has error flag set.

Checks the F bit in the HPF status to determine if an error is present.

Parameters
handleEnDAT3 handle
has_errorPointer to store result (1 if error flag is set, 0 otherwise)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or has_error is NULL

◆ endat3_has_hpf_warning()

int32_t endat3_has_hpf_warning ( endat3_handle  handle,
uint8_t *  has_warning 
)

Check if HPF has warning flag set.

Checks the W bit in the HPF status to determine if a warning is present.

Parameters
handleEnDAT3 handle
has_warningPointer to store result (1 if warning flag is set, 0 otherwise)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or has_warning is NULL

◆ endat3_has_absolute_value()

int32_t endat3_has_absolute_value ( endat3_handle  handle,
uint8_t *  has_absolute 
)

Check if absolute value is available.

Checks the RM bit in the HPF status to determine if absolute position value is available.

Parameters
handleEnDAT3 handle
has_absolutePointer to store result (1 if absolute value is available, 0 otherwise)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or has_absolute is NULL

◆ endat3_get_lph_status()

int32_t endat3_get_lph_status ( endat3_handle  handle,
uint8_t *  status 
)

Get LPH status byte.

Retrieves the status byte from the Low Priority Header, which contains the communication state and error flags.

Parameters
handleEnDAT3 handle
statusPointer to store LPH status byte
Returns
ENDAT3_SUCCESS (0) on success, ENDAT3_ERR_INVALID_INPUT (-1) if handle or status is NULL

◆ endat3_get_lph_lpf_count()

int32_t endat3_get_lph_lpf_count ( endat3_handle  handle,
uint8_t *  num_lpf 
)

Get number of LPF frames.

Retrieves the number of Low Priority Frames indicated in the LPH.

Parameters
handleEnDAT3 handle
num_lpfPointer to store number of LPF frames (0 to MAX_LPF_COUNT)
Returns
ENDAT3_SUCCESS (0) on success, ENDAT3_ERR_INVALID_INPUT (-1) if handle or num_lpf is NULL

◆ endat3_get_lph_crc()

int32_t endat3_get_lph_crc ( endat3_handle  handle,
uint8_t *  crc 
)

Get LPH CRC value.

Retrieves the CRC checksum from the Low Priority Header.

Parameters
handleEnDAT3 handle
crcPointer to store LPH CRC value
Returns
ENDAT3_SUCCESS (0) on success, ENDAT3_ERR_INVALID_INPUT (-1) if handle or crc is NULL

◆ endat3_get_lph_state()

int32_t endat3_get_lph_state ( endat3_handle  handle,
endat3_lph_status state 
)

Get LPH communication state.

Extracts the communication state from the LPH status byte (bits 0-1).

Parameters
handleEnDAT3 handle
statePointer to store LPH state (IDLE, RX_START, RX_LAST, BUSY)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or state is NULL
if(endat3_get_lph_state(handle, &state) == ENDAT3_SUCCESS)
{
switch(state)
{
// Ready for new command
break;
// Background operation in progress
break;
}
}

◆ endat3_has_bg_error()

int32_t endat3_has_bg_error ( endat3_handle  handle,
uint8_t *  has_error 
)

Check if background operation has error.

Checks the BG.ERR_EXEC bit in the LPH status.

Parameters
handleEnDAT3 handle
has_errorPointer to store result (1 if background error is present, 0 otherwise)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or has_error is NULL

◆ endat3_is_bg_busy()

int32_t endat3_is_bg_busy ( endat3_handle  handle,
uint8_t *  is_busy 
)

Check if background processor is busy.

Checks the BG.BUSY bit in the LPH status.

Parameters
handleEnDAT3 handle
is_busyPointer to store result (1 if background processor is busy, 0 otherwise)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or is_busy is NULL

◆ endat3_has_bg_rtx_error()

int32_t endat3_has_bg_rtx_error ( endat3_handle  handle,
uint8_t *  has_error 
)

Check if background RTX error occurred.

Checks the BG.RTX_ERROR bit in the LPH status.

Parameters
handleEnDAT3 handle
has_errorPointer to store result (1 if background RTX error occurred, 0 otherwise)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or has_error is NULL

◆ endat3_get_lpf_status()

int32_t endat3_get_lpf_status ( endat3_handle  handle,
uint8_t  index,
uint8_t *  status 
)

Get LPF status byte for specific frame.

Retrieves the status byte from a specific Low Priority Frame.

Parameters
handleEnDAT3 handle
indexLPF frame index (0 to MAX_LPF_COUNT-1)
statusPointer to store LPF status byte
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle, status is NULL or index is invalid

◆ endat3_get_lpf_data()

int32_t endat3_get_lpf_data ( endat3_handle  handle,
uint8_t  index,
uint8_t *  data 
)

Get LPF data array for specific frame.

Retrieves the 6-byte data payload from a specific Low Priority Frame.

Parameters
handleEnDAT3 handle
indexLPF frame index (0 to MAX_LPF_COUNT-1)
dataBuffer to store LPF data (must be at least 6 bytes)
Returns
Number of bytes copied (6) on success
ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL, data is NULL, or index >= MAX_LPF_COUNT(8)
Note
Validation performed:
  • Handle and data buffer validation
  • Index bounds checking (index < MAX_LPF_COUNT)
uint8_t lpf_data[6];
int32_t bytes = endat3_get_lpf_data(handle, 0, lpf_data);
if(bytes == 6)
{
// Process first LPF data
}

◆ endat3_get_lpf_crc()

int32_t endat3_get_lpf_crc ( endat3_handle  handle,
uint8_t  index,
uint8_t *  crc 
)

Get LPF CRC value for specific frame.

Retrieves the CRC checksum from a specific Low Priority Frame for validation.

Parameters
handleEnDAT3 handle
indexLPF frame index (0 to MAX_LPF_COUNT-1)
crcPointer to store LPF CRC byte
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle, crc is NULL or index is invalid

◆ endat3_get_lpf_fid()

int32_t endat3_get_lpf_fid ( endat3_handle  handle,
uint8_t  index,
uint8_t *  fid 
)

Get LPF FID (Frame ID) for specific frame.

Extracts the Frame ID from the LPF status byte.

Parameters
handleEnDAT3 handle
indexLPF frame index (0 to MAX_LPF_COUNT-1)
fidPointer to store FID value (0-255)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle, fid is NULL or index is invalid

◆ endat3_is_connected()

int32_t endat3_is_connected ( endat3_handle  handle,
uint8_t *  is_connected 
)

Get connection status.

Checks if the encoder is connected and communicating.

Parameters
handleEnDAT3 handle
is_connectedPointer to store connection status (1 if connected, 0 otherwise)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or is_connected is NULL

◆ endat3_is_busy()

int32_t endat3_is_busy ( endat3_handle  handle,
uint8_t *  is_busy 
)

Get busy status.

Checks if a transfer is currently in progress. Returns 1 only when encoder state is ENCODER_BUSY. Both ENCODER_IDLE and ENCODER_ERROR states return 0.

Parameters
handleEnDAT3 handle
is_busyPointer to store busy status (1 if state == ENCODER_BUSY, 0 otherwise)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or is_busy is NULL

◆ endat3_set_busy()

int32_t endat3_set_busy ( endat3_handle  handle,
uint8_t  busy 
)

Set or clear busy status.

Sets or clears the busy flag. Set busy=1 to mark a transfer as in progress; set busy=0 to clear the busy state when no transfer is active.

Parameters
handleEnDAT3 handle
busyBusy state to set (1 for busy, 0 for not busy)
Returns
ENDAT3_SUCCESS (0) on success
ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL, busy > 1, or internal structures are NULL
Note
Check return value to ensure state was set properly

◆ endat3_get_expected_tx_frame_count()

int32_t endat3_get_expected_tx_frame_count ( endat3_handle  handle,
uint32_t *  count 
)

Get expected TX frame count.

Retrieves the number of frames expected to be transmitted.

Parameters
handleEnDAT3 handle
countPointer to store expected TX frame count
Returns
ENDAT3_SUCCESS (0) on success, ENDAT3_ERR_INVALID_INPUT (-1) if handle or count is NULL

◆ endat3_set_expected_tx_frame_count()

int32_t endat3_set_expected_tx_frame_count ( endat3_handle  handle,
uint32_t  count 
)

Set expected TX frame count.

Sets the number of frames expected to be transmitted.

Parameters
handleEnDAT3 handle
countExpected frame count
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL
Note
Check return value - incorrect frame count causes communication errors

◆ endat3_get_propagation_time()

int32_t endat3_get_propagation_time ( endat3_handle  handle,
uint32_t *  prop_time 
)

Get propagation time.

Retrieves the measured propagation time from ECHO command. The value is in PRU clock cycles.

Parameters
handleEnDAT3 handle
prop_timePointer to store propagation time in PRU clock cycles
Returns
ENDAT3_SUCCESS (0) on success, ENDAT3_ERR_INVALID_INPUT (-1) if handle or prop_time is NULL
uint32_t prop_time_cycles;
if(endat3_get_propagation_time(handle, &prop_time_cycles) == ENDAT3_SUCCESS)
{
// Convert to nanoseconds (assuming 200MHz PRU clock)
uint32_t prop_time_ns = (prop_time_cycles * 1000) / 200;
}

◆ endat3_get_foreground_op_code()

int32_t endat3_get_foreground_op_code ( endat3_handle  handle,
uint32_t *  opcode 
)

Get foreground operation code.

Retrieves the current foreground operation code.

Parameters
handleEnDAT3 handle
opcodePointer to store foreground operation code
Returns
ENDAT3_SUCCESS (0) on success, ENDAT3_ERR_INVALID_INPUT (-1) if handle or opcode is NULL

◆ endat3_set_foreground_op_code()

int32_t endat3_set_foreground_op_code ( endat3_handle  handle,
uint32_t  opcode 
)

Set foreground operation code.

Sets the foreground operation code for the next command.

Parameters
handleEnDAT3 handle
opcodeOperation code to set (use endat3_req_code enum values)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL CRITICAL: Check return value before calling endat3_send_command() - wrong opcode sends wrong command
{
DebugP_log("ERROR: Failed to set foreground opcode\r\n");
return;
}

◆ endat3_get_background_op_code()

int32_t endat3_get_background_op_code ( endat3_handle  handle,
uint32_t *  opcode 
)

Get background operation code.

Retrieves the current background operation code.

Parameters
handleEnDAT3 handle
opcodePointer to store background operation code
Returns
ENDAT3_SUCCESS (0) on success, ENDAT3_ERR_INVALID_INPUT (-1) if handle or opcode is NULL

◆ endat3_set_background_op_code()

int32_t endat3_set_background_op_code ( endat3_handle  handle,
uint32_t  opcode 
)

Set background operation code.

Sets the background operation code for the next command.

Parameters
handleEnDAT3 handle
opcodeOperation code to set (use endat3_bg_req_opcode enum values)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL CRITICAL: Check return value before calling endat3_send_command() - wrong opcode sends wrong background operation
{
DebugP_log("ERROR: Failed to set background opcode\r\n");
return;
}

◆ endat3_get_bg_data()

int32_t endat3_get_bg_data ( endat3_handle  handle,
uint8_t  index,
uint32_t *  data 
)

Get background data word.

Retrieves a specific word from the background data array.

Parameters
handleEnDAT3 handle
indexData word index (0 to BG_DATA_SIZE-1)
dataPointer to store the retrieved data value
Returns
ENDAT3_SUCCESS (0) on success, ENDAT3_ERR_INVALID_INPUT (-1) if handle, data is NULL, or index is invalid

◆ endat3_set_bg_data()

int32_t endat3_set_bg_data ( endat3_handle  handle,
uint8_t  index,
uint32_t  data 
)

Set background data word.

Sets a specific word in the background data array.

Parameters
handleEnDAT3 handle
indexData word index (0 to BG_DATA_SIZE-1)
dataData value to set
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL or index >= BG_DATA_SIZE(6)
Note
Check return value - wrong background data sends incorrect command parameters
// Set RESET command data
{
DebugP_log("ERROR: Failed to set background data\r\n");
return;
}

◆ endat3_get_all_bg_data()

int32_t endat3_get_all_bg_data ( endat3_handle  handle,
uint32_t *  data 
)

Get all background data.

Retrieves all background data words into the provided buffer.

Parameters
handleEnDAT3 handle
dataBuffer to store background data (must be at least BG_DATA_SIZE words = 6 words = 24 bytes)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL or data buffer is NULL
Note
Check return value to ensure data was retrieved successfully

◆ endat3_set_all_bg_data()

int32_t endat3_set_all_bg_data ( endat3_handle  handle,
const uint32_t *  data 
)

Set all background data.

Sets all background data words from the provided buffer. Copies exactly BG_DATA_SIZE (6) words (24 bytes) from the source buffer to the internal background data array.

Parameters
handleEnDAT3 handle
dataBuffer containing background data (must be at least BG_DATA_SIZE words = 6 words = 24 bytes)
Returns
ENDAT3_SUCCESS (0) on success
ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL, data buffer is NULL, or internal structures are NULL
Note
This function copies a fixed size of BG_DATA_SIZE (6) words regardless of actual data content
Check return value to ensure data was set successfully

◆ endat3_get_rx_buffer()

const volatile uint8_t* endat3_get_rx_buffer ( endat3_handle  handle)

Get RX buffer pointer.

Provides read-only access to the receive buffer.

Parameters
handleEnDAT3 handle
Returns
Pointer to RX buffer (RX_BUFFER_SIZE = 64 bytes), or NULL if handle is NULL
Warning
Do not modify the returned buffer. Use for read-only access.

◆ endat3_get_tx_buffer()

const volatile uint8_t* endat3_get_tx_buffer ( endat3_handle  handle)

Get TX buffer pointer.

Provides read-only access to the transmit buffer.

Parameters
handleEnDAT3 handle
Returns
Pointer to TX buffer (TX_BUFFER_SIZE = 24 bytes), or NULL if handle is NULL
Warning
Do not modify the returned buffer. Use for read-only access.

◆ endat3_set_tx_buffer()

int32_t endat3_set_tx_buffer ( endat3_handle  handle,
const uint8_t *  data,
uint32_t  length 
)

Copy data to TX buffer.

Safely copies data to the transmit buffer with bounds checking.

Parameters
handleEnDAT3 handle
dataSource data buffer
lengthNumber of bytes to copy (1-24)
Returns
Number of bytes copied on success (1-24)
ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL, data is NULL, length is 0, or length > TX_BUFFER_SIZE

◆ endat3_get_hpf_frame()

int32_t endat3_get_hpf_frame ( endat3_handle  handle,
endat3_hpf hpf 
)

Get complete HPF structure.

Retrieves the entire High Priority Frame structure.

Parameters
handleEnDAT3 handle
hpfPointer to HPF structure to fill
Returns
ENDAT3_SUCCESS (0) on success
ENDAT3_ERR_INVALID_INPUT (-1) if handle or hpf is NULL
if(endat3_get_hpf_frame(handle, &hpf) == 0)
{
// Access hpf.status, hpf.data, hpf.crc
}

◆ endat3_get_lph_frame()

int32_t endat3_get_lph_frame ( endat3_handle  handle,
endat3_lph lph 
)

Get complete LPH structure.

Retrieves the entire Low Priority Header structure.

Parameters
handleEnDAT3 handle
lphPointer to LPH structure to fill
Returns
ENDAT3_SUCCESS (0) on success
ENDAT3_ERR_INVALID_INPUT (-1) if handle or lph is NULL

◆ endat3_get_lpf_frame()

int32_t endat3_get_lpf_frame ( endat3_handle  handle,
uint8_t  index,
endat3_lpf lpf 
)

Get complete LPF structure.

Retrieves the entire Low Priority Frame structure for a specific index.

Parameters
handleEnDAT3 handle
indexLPF frame index (0 to MAX_LPF_COUNT-1)
lpfPointer to LPF structure to fill
Returns
ENDAT3_SUCCESS (0) on success
ENDAT3_ERR_INVALID_INPUT (-1) if handle/lpf is NULL or index is invalid

◆ endat3_get_error_code()

int32_t endat3_get_error_code ( endat3_handle  handle,
endat3_error_code error_code 
)

Extract error code from HPF or LPF.

Extracts the error code from HPF data (when HPFV=0) or LPF data (when BG.ERR_EXEC is set).

Parameters
handleEnDAT3 handle
error_codePointer to store error code value
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or error_code is NULL
if(endat3_get_error_code(handle, &error) == ENDAT3_SUCCESS)
{
if(error != ENDAT3_ERR_UNKNOWN)
{
const char* desc = endat3_get_error_description(error);
DebugP_log("Error: %s\r\n", desc);
}
}

◆ endat3_get_interface()

endat3_interface* endat3_get_interface ( endat3_handle  handle)

Get interface pointer (advanced use)

Provides direct access to the endat3_interface structure for advanced users who need full control. Use with caution.

Parameters
handleEnDAT3 handle
Returns
Pointer to endat3_interface structure, or NULL if handle is NULL
Warning
Direct manipulation of the interface structure can lead to undefined behavior. Use the provided APIs whenever possible.

◆ endat3_set_operating_mode()

int32_t endat3_set_operating_mode ( endat3_handle  handle,
uint8_t  opmode 
)

Set operating mode (host trigger or periodic trigger)

Configures the firmware operating mode for the EnDAT3 interface. This determines whether the encoder is triggered by host command, or sampled automatically when IEP counter reaches the configured CMP event compare value, or sampled automatically when an external signal triggers the IEP capture event.

**Configuration requirements for ENDAT3_OPMODE_PERIODIC_CMP :**

  • IEP hardware CMP registers must be configured separately
  • Use endat3_config_iep_cmp_event to set event number in firmware. This function is called inside endat3_init by default.
  • CMP event range: 0-15

**Configuration requirements for ENDAT3_OPMODE_PERIODIC_CAP :**

  • IEP hardware CAP registers must be configured separately
  • External signal to IEP capture input should be configured
  • Use endat3_config_iep_cap_event to set event number in firmware. This function is called inside endat3_init by default.
  • CAP event range: 0-7
Parameters
handleEnDAT3 handle
opmodeOperating mode: 0 = periodic CMP trigger, 1 = host trigger, 2 = periodic CAP trigger
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL ENDAT3_ERR_INVALID_OPMODE (-8) if opmode > 2 CRITICAL: Check return value - wrong operating mode causes complete communication failure
// Set to host trigger mode
{
DebugP_log("ERROR: Failed to set operating mode\r\n");
return;
}
// Set to periodic trigger CMP mode
{
DebugP_log("ERROR: Failed to set operating mode\r\n");
return;
}

◆ endat3_get_operating_mode()

int32_t endat3_get_operating_mode ( endat3_handle  handle,
uint8_t *  opmode 
)

Get current operating mode.

Retrieves the current firmware operating mode.

Parameters
handleEnDAT3 handle
opmodePointer to store operating mode (0 = periodic CMP, 1 = host trigger, 2 = periodic CAP)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or opmode is NULL

◆ endat3_config_iep_cap_event()

int32_t endat3_config_iep_cap_event ( endat3_handle  handle,
uint8_t  event_num 
)

Configure IEP CAP event number in PRU DMEM.

Parameters
handleEnDAT3 handle
event_numCAP event number (0-7) to use for periodic triggering
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL or event_num > 7
Note
This only updates the DMEM configuration. The operating mode must be set to ENDAT3_OPMODE_PERIODIC_CAP separately via endat3_set_operating_mode(). This function does NOT configure IEP hardware registers.

◆ endat3_config_iep_cmp_event()

int32_t endat3_config_iep_cmp_event ( endat3_handle  handle,
uint8_t  event_num 
)

Configure IEP CMP event number in PRU DMEM.

Parameters
handleEnDAT3 handle
event_numCMP event number (0-15) to use for periodic triggering
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL or event_num > 15
Note
This only updates the DMEM configuration. The operating mode must be set to ENDAT3_OPMODE_PERIODIC_CMP separately via endat3_set_operating_mode(). This function does NOT configure IEP hardware registers.

◆ endat3_release_start_trigger()

int32_t endat3_release_start_trigger ( endat3_handle  handle)

Release start trigger to firmware.

Signals the firmware to begin processing by setting the start_trigger flag. The firmware will process the command based on the current operating mode:

  • In host mode: processes the command immediately
  • In periodic mode: waits for the next IEP CMP/CAP event
Parameters
handleEnDAT3 handle
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL CRITICAL: Check return value - if this fails, command will never be processed by firmware
// Release trigger to firmware
{
DebugP_log("ERROR: Failed to release start trigger\r\n");
return;
}

◆ endat3_clear_start_trigger()

int32_t endat3_clear_start_trigger ( endat3_handle  handle)

Clear start trigger flag.

Clears the start_trigger flag after the firmware has processed the command. This prepares the interface for the next command.

Parameters
handleEnDAT3 handle
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle is NULL
Note
Check return value to ensure trigger was cleared properly

◆ endat3_get_start_trigger_status()

int32_t endat3_get_start_trigger_status ( endat3_handle  handle,
uint8_t *  trigger_status 
)

Get current start trigger status.

Retrieves the current state of the start_trigger flag.

Parameters
handleEnDAT3 handle
trigger_statusPointer to store trigger status (1 if set, 0 if cleared)
Returns
ENDAT3_SUCCESS (0) on success ENDAT3_ERR_INVALID_INPUT (-1) if handle or trigger_status is NULL
endat3_get_error_description
const char * endat3_get_error_description(endat3_error_code error_code)
Get error description string.
LPH_STATUS_IDLE
@ LPH_STATUS_IDLE
Definition: endat3_drv.h:279
ENDAT3_ERR_UNKNOWN
@ ENDAT3_ERR_UNKNOWN
Definition: endat3_drv.h:393
ENDAT3_BGREQ_READ
@ ENDAT3_BGREQ_READ
Definition: endat3_drv.h:292
ENDAT3_OPMODE_HOST_TRIGGER
#define ENDAT3_OPMODE_HOST_TRIGGER
EnDat3 Operation Mode: Host trigger.
Definition: endat3_drv.h:138
ENDAT3_RESET_HARD
#define ENDAT3_RESET_HARD
Definition: endat3_drv.h:244
ENDAT3_HPF_STATUS_F
@ ENDAT3_HPF_STATUS_F
Definition: endat3_drv.h:363
endat3_set_foreground_op_code
int32_t endat3_set_foreground_op_code(endat3_handle handle, uint32_t opcode)
Set foreground operation code.
endat3_get_error_code
int32_t endat3_get_error_code(endat3_handle handle, endat3_error_code *error_code)
Extract error code from HPF or LPF.
endat3_lph_status
endat3_lph_status
Low Priority Header status values.
Definition: endat3_drv.h:278
endat3_get_hpf_status
int32_t endat3_get_hpf_status(endat3_handle handle, uint8_t *status)
Get HPF status byte.
endat3_set_bg_data
int32_t endat3_set_bg_data(endat3_handle handle, uint8_t index, uint32_t data)
Set background data word.
endat3_set_operating_mode
int32_t endat3_set_operating_mode(endat3_handle handle, uint8_t opmode)
Set operating mode (host trigger or periodic trigger)
ENDAT3_SUCCESS
#define ENDAT3_SUCCESS
Definition: endat3_drv.h:153
endat3_hpf
High Priority Frame structure.
Definition: endat3_drv.h:543
ENDAT3_REQ_DATA0
@ ENDAT3_REQ_DATA0
Definition: endat3_drv.h:308
endat3_set_background_op_code
int32_t endat3_set_background_op_code(endat3_handle handle, uint32_t opcode)
Set background operation code.
ENDAT3_OPMODE_PERIODIC_CMP
#define ENDAT3_OPMODE_PERIODIC_CMP
EnDat3 Operation Mode: Periodic trigger with CMP event.
Definition: endat3_drv.h:130
endat3_get_hpf_data
int32_t endat3_get_hpf_data(endat3_handle handle, uint8_t *data)
Get HPF data array.
LPH_STATUS_BUSY
@ LPH_STATUS_BUSY
Definition: endat3_drv.h:282
endat3_error_code
endat3_error_code
EnDat3 Error Codes.
Definition: endat3_drv.h:391
endat3_release_start_trigger
int32_t endat3_release_start_trigger(endat3_handle handle)
Release start trigger to firmware.
endat3_get_hpf_data_64_bit
int32_t endat3_get_hpf_data_64_bit(endat3_handle handle, uint64_t *data)
Get HPF data as 64-bit value.
endat3_get_error_action
const char * endat3_get_error_action(endat3_error_code error_code)
Get recommended action for error code.
endat3_get_propagation_time
int32_t endat3_get_propagation_time(endat3_handle handle, uint32_t *prop_time)
Get propagation time.
endat3_get_lpf_data
int32_t endat3_get_lpf_data(endat3_handle handle, uint8_t index, uint8_t *data)
Get LPF data array for specific frame.
endat3_get_lph_state
int32_t endat3_get_lph_state(endat3_handle handle, endat3_lph_status *state)
Get LPH communication state.
endat3_get_hpf_frame
int32_t endat3_get_hpf_frame(endat3_handle handle, endat3_hpf *hpf)
Get complete HPF structure.