AM263Px Motor Control SDK  2025.00.00
APIs for BiSS-C Encoder

Introduction

Here is the list of APIs used for BiSS-C encoder communication protocol

Validation Strategy
BiSS-C driver APIs use following validation approach:
  • Handle validation: All public APIs validate the handle parameter for NULL
  • Array bounds checking: APIs with array parameters or index parameters perform bounds validation
  • Internal structure validation: Each API validates the internal structure pointers it accesses (e.g., attrs, priv, pruicss_xchg, pruicss_handle) for NULL before dereferencing

Functions

void bissc_params_init (bissc_params *params)
 Initialize the parameters data structure with defaults. More...
 
bissc_handle bissc_init (uint32_t index, const bissc_params *bissc_params)
 Initialize a BiSS-C instance. More...
 
void bissc_deinit (bissc_handle handle)
 De-initialize a BiSS-C instance. More...
 
int32_t bissc_command_process (bissc_handle handle)
 Send the BiSS-C command and wait till firmware acknowledges. More...
 
int32_t bissc_command_send (bissc_handle handle)
 Trigger sending the BiSS-C command in PRU. More...
 
int32_t bissc_command_wait (bissc_handle handle)
 Wait till PRU finishes BiSS-C transaction. More...
 
int32_t bissc_get_pos (bissc_handle handle)
 Get single cycle BiSS-C position data. More...
 
int32_t bissc_config_clock (bissc_handle handle, bissc_clk_cfg *clk_cfg)
 Configure BiSS-C clock configuration into PRU-ICSS register, enable load share (if needed), and indicate firmware to measure the delay again. More...
 
int32_t bissc_config_channel (bissc_handle handle, uint8_t mask, uint8_t total_channels)
 Select channel to be used by BiSS-C receiver. More...
 
int32_t bissc_wait_for_fw_initialization (bissc_handle handle, uint32_t loop_count)
 Wait for BiSS-C receiver firmware to initialize. More...
 
int32_t bissc_hw_init (bissc_handle handle)
 Initialize BiSS-C hardware interface. More...
 
int32_t bissc_update_max_proc_delay (bissc_handle handle)
 Update maximum processing delay value. More...
 
int32_t bissc_wait_measure_proc_delay (bissc_handle handle, uint32_t loop_count)
 Wait for BiSS-C receiver firmware to measure processing time. More...
 
int32_t bissc_set_default_initialization (bissc_handle handle)
 Set default configuration parameters for BiSS-C receiver firmware. More...
 
int32_t bissc_update_data_len (bissc_handle handle, uint32_t single_turn_len[], uint32_t multi_turn_len[], uint32_t ch_num)
 Update data length with encoder bit width for BiSS-C receiver firmware. More...
 
int32_t bissc_set_ctrl_cmd_and_process (bissc_handle handle, uint32_t ctrl_cmd[])
 Set control command and process the ctrl communication read/write. More...
 
int32_t bissc_get_enc_proc_delay (bissc_handle handle)
 Get measured processing delay of individual channel. More...
 
int32_t bissc_calc_clock (bissc_handle handle, bissc_clk_cfg *clk_cfg)
 Calculate Rx and Tx divisors for given frequency. More...
 
int32_t bissc_config_periodic_trigger_cmp_mode (bissc_handle handle)
 Configure periodic trigger operation mode using IEP compare event. More...
 
int32_t bissc_config_host_trigger (bissc_handle handle)
 Configure host trigger operation mode. More...
 
uint32_t bissc_generate_ctrl_cmd (bissc_handle handle, uint8_t ls_ch, uint8_t ctrl_write_status, uint32_t ctrl_reg_address, uint32_t ctrl_reg_data, uint32_t ctrl_enc_id)
 Generate control communication Hex equivalent command. More...
 
uint32_t bissc_get_current_channel (bissc_handle handle, uint32_t ch_idx)
 Retrieves the current channel in use. More...
 
uint32_t bissc_get_total_channels (bissc_handle handle)
 Retrieves total number of channels configured. More...
 
int32_t bissc_clear_data_len (bissc_handle handle)
 Clears all the encoder resolution parameters. More...
 
int32_t bissc_update_clock_freq (bissc_handle handle, uint32_t frequency)
 Update the operating baud rate as specified by the user. More...
 
int32_t bissc_clock_config (bissc_handle handle, uint32_t frequency, uint32_t loop_count)
 Configure BiSS-C clock frequency. More...
 
int32_t bissc_enable_safety (bissc_handle handle, uint32_t enc_num, uint32_t ch_num)
 Enable Safety for connected BiSS-C encoder. More...
 
int32_t bissc_disable_safety (bissc_handle handle)
 Disable Safety for connected BiSS-C encoder. More...
 
const bissc_attrsbissc_get_attrs (bissc_handle handle)
 Get pointer to BiSS-C attributes structure. More...
 
bissc_privbissc_get_priv (bissc_handle handle)
 Get pointer to BiSS-C private data structure. More...
 
int32_t bissc_set_encoder_timeout (bissc_handle handle, uint32_t ch_num, uint32_t encoder_timeout)
 Set encoder timeout value for a specific channel. More...
 
uint32_t bissc_get_encoder_timeout (bissc_handle handle, uint32_t ch_num)
 Get encoder timeout value for a specific channel. More...
 
int32_t bissc_config_periodic_trigger_cap_mode (bissc_handle handle)
 Configure periodic trigger CAP mode. More...
 
int32_t bissc_config_iep_cap_event (bissc_handle handle, uint8_t channel, uint8_t event_num)
 Configure IEP CAP event for periodic trigger (DMEM configuration only) More...
 
int32_t bissc_config_iep_cmp_event (bissc_handle handle, uint8_t channel, uint8_t event_num)
 Configure IEP CMP event for periodic trigger (DMEM configuration only) More...
 

Function Documentation

◆ bissc_params_init()

void bissc_params_init ( bissc_params params)

Initialize the parameters data structure with defaults.

This function copies default BiSS-C parameters from gBisscDefaultParams to the provided params structure.

Parameters
[out]paramsInitialized parameters
Note
On NULL params, function returns without performing any operation

◆ bissc_init()

bissc_handle bissc_init ( uint32_t  index,
const bissc_params bissc_params 
)

Initialize a BiSS-C instance.

This function initializes a BiSS-C instance by setting up the firmware interface and configuring hardware based on SysConfig parameters.

This function internally calls the following APIs:

Parameters
[in]indexIndex of BiSS-C handle to use in the gBisscHandle array
[in]bissc_paramsPointer to structure containing BiSS-C parameters
Return values
handlePointer to initialized bissc_handle instance
NULLOn validation failure (invalid index, NULL params, NULL priv/attrs, invalid pruicss_handle, failed hardware initialization)

◆ bissc_deinit()

void bissc_deinit ( bissc_handle  handle)

De-initialize a BiSS-C instance.

This function de-initializes the BiSS-C instance by marking the handle as closed (is_open = 0). It does not free memory or disable PRU cores.

Parameters
[in]handleBiSS-C handle
Note
On NULL handle or NULL priv, function returns without performing any operation

◆ bissc_command_process()

int32_t bissc_command_process ( bissc_handle  handle)

Send the BiSS-C command and wait till firmware acknowledges.

This function processes a BiSS-C command transaction. The behavior differs based on the operating mode:

Host Trigger Mode:

Periodic Trigger Mode (CMP or CAP):

In periodic modes, the PRU firmware automatically initiates BiSS-C transactions based on IEP timer events, so explicit command sending by the host is not required.

Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSOn successful completion
SystemP_TIMEOUTOn timeout waiting for firmware acknowledgment (propagated from bissc_command_wait)
SystemP_FAILUREOn validation failure (NULL handle or invalid internal structures)

◆ bissc_command_send()

int32_t bissc_command_send ( bissc_handle  handle)

Trigger sending the BiSS-C command in PRU.

This function sets the cycle_trigger flag(s) in the PRU-ICSS exchange structure to initiate a BiSS-C transaction. In load share mode, it sets individual trigger flags for each enabled channel. In non-load share mode, it sets a single trigger flag.

Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation failure

◆ bissc_command_wait()

int32_t bissc_command_wait ( bissc_handle  handle)

Wait till PRU finishes BiSS-C transaction.

This function polls the cycle_trigger flag(s) in PRU-ICSS exchange structure to detect when the PRU firmware has completed the BiSS-C transaction. It adds a delay between poll iterations to prevent excessive CPU usage, and implements a timeout mechanism.

This function internally calls:

Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSOn successful completion
SystemP_TIMEOUTOn timeout (configured via bissc_params.max_wait_loop_count before calling bissc_init, default: 5ms)
SystemP_FAILUREOn validation failure (NULL handle or invalid internal structures)

◆ bissc_get_pos()

int32_t bissc_get_pos ( bissc_handle  handle)

Get single cycle BiSS-C position data.

This function internally calls the following APIs:

  • bissc_command_process : Send command and wait for firmware acknowledgment After successful command processing, this function extracts position data, error/warning bits, CRC values, and calculates angle and number of turns from the raw data received from the encoder.
Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSOn successful position data retrieval
SystemP_TIMEOUTOn timeout waiting for firmware acknowledgment (propagated from bissc_command_process)
SystemP_FAILUREOn validation failure (NULL handle or invalid internal structures)

◆ bissc_config_clock()

int32_t bissc_config_clock ( bissc_handle  handle,
bissc_clk_cfg clk_cfg 
)

Configure BiSS-C clock configuration into PRU-ICSS register, enable load share (if needed), and indicate firmware to measure the delay again.

This function configures the PRU-ICSS clock registers based on the provided clock configuration structure. After clock configuration, it conditionally calls:

  • bissc_enable_load_share_mode (internal) : Enable load share mode (if load sharing is enabled)
Parameters
[in]handleBiSS-C handle
[in]clk_cfgpointer to structure containing clock configuration data
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation or hardware access failure

◆ bissc_config_channel()

int32_t bissc_config_channel ( bissc_handle  handle,
uint8_t  mask,
uint8_t  total_channels 
)

Select channel to be used by BiSS-C receiver.

This function configures the channel mask in PRU firmware and builds an internal channel array mapping enabled channels to their indices. For example, if channels 0 and 2 are enabled, priv->channel[] will be {0, 2}. This mapping is used throughout the driver for channel operations.

Parameters
[in]handleBiSS-C handle
[in]maskchannel mask (bit 0=CH0, bit 1=CH1, bit 2=CH2)
[in]total_channelstotal number of channels in use
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation failure

◆ bissc_wait_for_fw_initialization()

int32_t bissc_wait_for_fw_initialization ( bissc_handle  handle,
uint32_t  loop_count 
)

Wait for BiSS-C receiver firmware to initialize.

This function polls the firmware initialization status flags in the PRU-ICSS exchange structure to detect when PRU firmware has completed initialization. It checks the status flags based on the channel mask to ensure all enabled channels are initialized.

In load share mode: Checks status for all channels specified in channel_mask (1-7). In non-load share mode: Checks only status[0] regardless of channel configuration.

The function returns immediately when initialization is detected, or after loop_count iterations if initialization does not complete (timeout).

Timeout calculation: Total timeout will be approximately loop_count × fw_wait_delay_us microseconds Example: loop_count=5000 with default fw_wait_delay_us=1000µs gives 5 seconds

This function internally calls:

Parameters
[in]handleBiSS-C handle
[in]loop_countMaximum number of polling iterations before timeout
Return values
SystemP_SUCCESSWhen all specified channels are initialized
SystemP_TIMEOUTOn timeout (loop_count iterations exhausted before initialization completed)
SystemP_FAILUREOn validation failure (NULL handle, invalid internal structures, or invalid channel_mask in load share mode)

◆ bissc_hw_init()

int32_t bissc_hw_init ( bissc_handle  handle)

Initialize BiSS-C hardware interface.

This function internally calls the following APIs:

  • bissc_calc_clock : Calculate Rx and Tx divisors for the configured frequency
  • bissc_config_endat_mode (internal) : Configure the receiver for EnDat mode
  • bissc_config_clock : Configure the PRU-ICSS clock registers
  • bissc_config_clr_cfg0 (internal) : Clear the channel specific frame size configuration registers
Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation or hardware initialization failure

◆ bissc_update_max_proc_delay()

int32_t bissc_update_max_proc_delay ( bissc_handle  handle)

Update maximum processing delay value.

This function sets the maximum encoder processing delay value in the PRU-ICSS exchange structure based on the configured baud rate.

Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation failure

◆ bissc_wait_measure_proc_delay()

int32_t bissc_wait_measure_proc_delay ( bissc_handle  handle,
uint32_t  loop_count 
)

Wait for BiSS-C receiver firmware to measure processing time.

This function polls the measure_proc_delay flag in PRU-ICSS exchange structure to detect when firmware has completed encoder processing delay measurement.

This function internally calls:

Parameters
[in]handleBiSS-C handle
[in]loop_countMaximum number of polling iterations before timeout
Return values
SystemP_SUCCESSWhen measurement completes successfully
SystemP_TIMEOUTOn timeout (loop_count iterations exhausted before measurement completed)
SystemP_FAILUREOn validation failure (NULL handle or invalid internal structures)

◆ bissc_set_default_initialization()

int32_t bissc_set_default_initialization ( bissc_handle  handle)

Set default configuration parameters for BiSS-C receiver firmware.

This function internally calls the following APIs:

Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation failure

◆ bissc_update_data_len()

int32_t bissc_update_data_len ( bissc_handle  handle,
uint32_t  single_turn_len[],
uint32_t  multi_turn_len[],
uint32_t  ch_num 
)

Update data length with encoder bit width for BiSS-C receiver firmware.

This function configures encoder resolution parameters for a specific channel. It updates the PRU firmware with single-turn and multi-turn bit lengths for each encoder in the daisy chain, calculates total data length including CRC bits, and stores these values in both the private structure and PRU-ICSS exchange memory for firmware access.

Validation Strategy: This function uses a two-phase approach to ensure atomic configuration:

  • Phase 1 (Validation): All encoder configurations are validated against frame size constraints without modifying any driver state
  • Phase 2 (Configuration): Only after all validations pass, the driver state and PRU-ICSS exchange memory are updated

This ensures that if any encoder configuration is invalid, the driver remains in its previous valid state rather than being left partially configured.

Frame Size Constraints: This function validates that the total frame size does not exceed 64 bits:

  • Without Safety: Position Data + E/W(2) + CRC(6) <= 64 bits Therefore: single_turn + multi_turn <= 56 bits
  • With Safety: Position Data + E/W(2) + sign-of-life(6) + safety CRC(16) <= 64 bits Therefore: single_turn + multi_turn <= 40 bits
Parameters
[in]handleBiSS-C handle
[in]single_turn_lenEncoder's single turn resolution array
[in]multi_turn_lenEncoder's multi turn resolution array
[in]ch_numchannel number(index) in use
Return values
SystemP_SUCCESSon success
SystemP_FAILUREon validation failure (NULL parameters, invalid ch_num, or frame size exceeds 64 bits)
Note
The single_turn_len and multi_turn_len arrays must contain BISSC_NUM_ENCODERS_IN_DAISY_CHAIN_MAX elements. Passing arrays with fewer elements will result in undefined behavior.

◆ bissc_set_ctrl_cmd_and_process()

int32_t bissc_set_ctrl_cmd_and_process ( bissc_handle  handle,
uint32_t  ctrl_cmd[] 
)

Set control command and process the ctrl communication read/write.

This function sends control commands to the encoder and polls for completion. It sets the ctrl_cmd and ctrl_cmd_status fields in PRU-ICSS exchange structure, then polls until firmware completes the control communication transaction. A delay configured via bissc_params.fw_wait_delay_us (before calling bissc_init) (default: 1000 microseconds) is used between poll iterations and after control communication stop bits to ensure proper timing for encoder control communication protocol compliance. After completion, it reads back the control data from the encoder response.

This function internally calls the following APIs:

  • bissc_command_process : Send command and wait for firmware acknowledgment (called multiple times)
  • ClockP_usleep(): Delay between poll iterations and after stop bits
Parameters
[in]handleBiSS-C handle
[in]ctrl_cmdHex equivalent of control command array (per channel)
Return values
SystemP_SUCCESSOn successful control communication completion
SystemP_TIMEOUTOn timeout waiting for firmware acknowledgment (propagated from bissc_command_process)
SystemP_FAILUREOn validation failure (NULL handle, NULL ctrl_cmd array, or invalid internal structures)
Note
The ctrl_cmd array must contain BISSC_NUM_CH_PER_SLICE_MAX elements. Passing an array with fewer elements will result in undefined behavior.

◆ bissc_get_enc_proc_delay()

int32_t bissc_get_enc_proc_delay ( bissc_handle  handle)

Get measured processing delay of individual channel.

This function copies the encoder processing delay values measured by the PRU firmware from the PRU-ICSS exchange structure to the driver's private structure.

Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation failure

◆ bissc_calc_clock()

int32_t bissc_calc_clock ( bissc_handle  handle,
bissc_clk_cfg clk_cfg 
)

Calculate Rx and Tx divisors for given frequency.

This function calculates the Tx and Rx clock divisors required to achieve the configured baud rate from either core clock or UART clock source. It also sets the FIFO bit index for oversampling and determines valid baud rates based on the clock source and divisor limits. Returns error if the requested frequency cannot be achieved with available clock sources.

Parameters
[in]handleBiSS-C handle
[out]clk_cfgpointer to structure to store calculated clock configuration
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on failure

◆ bissc_config_periodic_trigger_cmp_mode()

int32_t bissc_config_periodic_trigger_cmp_mode ( bissc_handle  handle)

Configure periodic trigger operation mode using IEP compare event.

Configures the BiSS-C firmware to use IEP CMP (compare) events for periodic triggering. Position data is sampled automatically when IEP counter reaches the configured CMP event compare value.

Configuration requirements:

  • IEP hardware CMP registers must be configured separately
  • Use bissc_config_iep_cmp_event to set event number in firmware. This function is called inside bissc_init by default.
  • CMP event range: 0-15
Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation failure

◆ bissc_config_host_trigger()

int32_t bissc_config_host_trigger ( bissc_handle  handle)

Configure host trigger operation mode.

This function sets the operation mode to BISSC_OPMODE_HOST_TRIGGER in the PRU-ICSS exchange structure. In this mode, position data is retrieved only when explicitly triggered by the host via bissc_command_send.

Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation failure

◆ bissc_generate_ctrl_cmd()

uint32_t bissc_generate_ctrl_cmd ( bissc_handle  handle,
uint8_t  ls_ch,
uint8_t  ctrl_write_status,
uint32_t  ctrl_reg_address,
uint32_t  ctrl_reg_data,
uint32_t  ctrl_enc_id 
)

Generate control communication Hex equivalent command.

This function generates a control communication command according to BiSS-C protocol.

        This function internally calls the following APIs:
        - bissc_calc_ctrl_crc (internal) : Calculate 4-bit CRC values for command and data portions
Parameters
[in]handleBiSS-C handle
[in]ls_chchannel in use for load share
[in]ctrl_write_statusstatus for control communication write access
  • 0: Read access
  • 1: Write access
[in]ctrl_reg_addressaddress of encoder's register for control communication access (7-bit: 0x00-0x7F)
[in]ctrl_reg_datadata to write in encoder's register in control communication (8-bit: 0x00-0xFF)
[in]ctrl_enc_idID of encoder based on it's place in daisy chain (3-bit: 0x0-0x7)
Return values
ctrl_cmdHex equivalent control communication 32 bit command
0On NULL handle, invalid ls_ch (>= BISSC_NUM_CH_PER_SLICE_MAX), invalid ctrl_write_status (> 1), invalid ctrl_reg_address (> BISSC_REG_ADDR_MASK), invalid ctrl_reg_data (> BISSC_REG_DATA_MASK), or invalid ctrl_enc_id (> BISSC_ENC_ID_MASK)

◆ bissc_get_current_channel()

uint32_t bissc_get_current_channel ( bissc_handle  handle,
uint32_t  ch_idx 
)

Retrieves the current channel in use.

This function returns the physical channel number at the specified index in the internal channel array. For example, if channels 0 and 2 are enabled, ch_idx=0 returns 0, ch_idx=1 returns 2.

Parameters
[in]handleBiSS-C handle
[in]ch_idxindex into the channel array
Return values
channel[ch_idx]physical channel number (0, 1, or 2)
0On NULL handle or invalid ch_idx (>= BISSC_NUM_CH_PER_SLICE_MAX)

◆ bissc_get_total_channels()

uint32_t bissc_get_total_channels ( bissc_handle  handle)

Retrieves total number of channels configured.

This function returns the total number of enabled channels from the attrs structure.

Parameters
[in]handleBiSS-C handle
Return values
total_channelstotal number of channels configured (1-3)
0On NULL handle or NULL attrs

◆ bissc_clear_data_len()

int32_t bissc_clear_data_len ( bissc_handle  handle)

Clears all the encoder resolution parameters.

This function resets all encoder resolution data to zero in the private structure, including num_encoders, single_turn_len, multi_turn_len, and data_len arrays for all channels. This is typically called before reconfiguring encoder parameters.

Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation failure

◆ bissc_update_clock_freq()

int32_t bissc_update_clock_freq ( bissc_handle  handle,
uint32_t  frequency 
)

Update the operating baud rate as specified by the user.

This function updates the baud_rate field in the private structure with the specified frequency value. This value is used later by bissc_calc_clock() to calculate appropriate clock divisors.

Parameters
[in]handleBiSS-C handle
[in]frequencyFrequency in MHz (valid values: 1, 2, 5, 8, 10)
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation or invalid frequency

◆ bissc_clock_config()

int32_t bissc_clock_config ( bissc_handle  handle,
uint32_t  frequency,
uint32_t  loop_count 
)

Configure BiSS-C clock frequency.

This function updates the clock frequency, recalculates clock divisors, reinitializes the hardware with new clock settings, and waits for the firmware to complete encoder processing delay measurement.

This function internally calls the following APIs:

Parameters
[in]handleBiSS-C handle
[in]frequencyDesired clock frequency in MHz (valid values: 1/2/5/8/10)
[in]loop_countloop_count used when calling bissc_wait_measure_proc_delay
Return values
SystemP_SUCCESSOn successful clock configuration and delay measurement
SystemP_TIMEOUTOn timeout during delay measurement (propagated from bissc_wait_measure_proc_delay)
SystemP_FAILUREOn validation failure (NULL handle, invalid frequency, or clock calculation failure)

◆ bissc_enable_safety()

int32_t bissc_enable_safety ( bissc_handle  handle,
uint32_t  enc_num,
uint32_t  ch_num 
)

Enable Safety for connected BiSS-C encoder.

This function enables safety mode for a specific encoder on a specific channel. It sets the has_safety flag in both the private structure and the PRU-ICSS exchange structure. When safety is enabled, the encoder provides additional CRC and error checking per the BiSS-C safety specification.

Parameters
[in]handleBiSS-C handle
[in]enc_numencoder number(index) in daisy chain
[in]ch_numchannel number(index)
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation failure

◆ bissc_disable_safety()

int32_t bissc_disable_safety ( bissc_handle  handle)

Disable Safety for connected BiSS-C encoder.

This function disables safety mode for all encoders on all channels by clearing the has_safety flags in both the private structure and the PRU-ICSS exchange structure.

Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation failure

◆ bissc_get_attrs()

const bissc_attrs* bissc_get_attrs ( bissc_handle  handle)

Get pointer to BiSS-C attributes structure.

This function provides access to the read-only attributes structure containing configuration parameters set during initialization, such as PRU-ICSS instance, channel configuration, load share settings, and clock configuration. Returns NULL if handle is invalid.

Parameters
[in]handleBiSS-C handle
Return values
attrsPointer to const bissc_attrs structure, NULL if handle is invalid

◆ bissc_get_priv()

bissc_priv* bissc_get_priv ( bissc_handle  handle)

Get pointer to BiSS-C private data structure.

This function provides access to the private data structure containing runtime state information, encoder parameters, processing delays, and pointers to PRU-ICSS resources. This function should be used with caution. Returns NULL if handle is invalid.

Parameters
[in]handleBiSS-C handle
Return values
privPointer to bissc_priv structure, NULL if handle is invalid

◆ bissc_set_encoder_timeout()

int32_t bissc_set_encoder_timeout ( bissc_handle  handle,
uint32_t  ch_num,
uint32_t  encoder_timeout 
)

Set encoder timeout value for a specific channel.

This function allows setting the encoder timeout value in PRU cycles for a specific channel. This parameter decides how long the clock signal is stretched according to polarity of CDM bit during control communication.

Parameters
[in]handleBiSS-C handle
[in]ch_numChannel number (0-2 for ch0, ch1, ch2). Used in load share mode, ignored in single PRU mode (always uses index 0).
[in]encoder_timeoutTimeout value in PRU cycles
Return values
SystemP_SUCCESSOn success
SystemP_FAILUREOn validation failure (NULL handle or invalid ch_num)

◆ bissc_get_encoder_timeout()

uint32_t bissc_get_encoder_timeout ( bissc_handle  handle,
uint32_t  ch_num 
)

Get encoder timeout value for a specific channel.

This function retrieves the current encoder timeout value in PRU cycles for a specific channel. This parameter decides how long the clock signal is stretched according to polarity of CDM bit during control communication.

Parameters
[in]handleBiSS-C handle
[in]ch_numChannel number (0-2 for ch0, ch1, ch2). Used in load share mode, ignored in single PRU mode (always uses index 0).
Return values
encoder_timeoutCurrent timeout value in PRU cycles
0On validation failure (NULL handle or invalid ch_num)

◆ bissc_config_periodic_trigger_cap_mode()

int32_t bissc_config_periodic_trigger_cap_mode ( bissc_handle  handle)

Configure periodic trigger CAP mode.

Configures the BiSS-C firmware to use IEP CAP (capture) events for periodic triggering. Position data is sampled automatically when an external signal triggers the IEP capture event.

Configuration requirements:

  • IEP hardware CAP registers must be configured separately
  • External signal to IEP capture input should be configured
  • Use bissc_config_iep_cap_event to set event number in firmware. This function is called inside bissc_init by default.
  • CAP event range: 0-7
Parameters
[in]handleBiSS-C handle
Return values
SystemP_SUCCESSon success, SystemP_FAILURE on validation failure

◆ bissc_config_iep_cap_event()

int32_t bissc_config_iep_cap_event ( bissc_handle  handle,
uint8_t  channel,
uint8_t  event_num 
)

Configure IEP CAP event for periodic trigger (DMEM configuration only)

This function configures the IEP capture event information in PRU shared memory (DMEM) for firmware access. It writes the capture register address and event number to trigger_params structure. This function does NOT configure IEP hardware registers.

Parameters
[in]handleBiSS-C handle
[in]channelChannel number (0-2 for ch0, ch1, ch2). Used in load share mode, ignored in single PRU mode (always uses index 0).
[in]event_numIEP CAP event number (valid range: 0-7)
Return values
SystemP_SUCCESSon success, SystemP_FAILURE otherwise
Note
This function only configures firmware DMEM, not IEP hardware. Application must separately configure IEP CAP hardware registers.

◆ bissc_config_iep_cmp_event()

int32_t bissc_config_iep_cmp_event ( bissc_handle  handle,
uint8_t  channel,
uint8_t  event_num 
)

Configure IEP CMP event for periodic trigger (DMEM configuration only)

This function configures the IEP compare event information in PRU shared memory (DMEM) for firmware access. It writes the event number to trigger_params structure. This function does NOT configure IEP hardware registers.

Parameters
[in]handleBiSS-C handle
[in]channelChannel number (0-2 for ch0, ch1, ch2). Used in load share mode, ignored in single PRU mode (always uses index 0).
[in]event_numIEP CMP event number (valid range: 0-15)
Return values
SystemP_SUCCESSon success, SystemP_FAILURE otherwise
Note
This function only configures firmware DMEM, not IEP hardware. Application must separately configure IEP CMP hardware registers.