HPM SDK
HPMicro Software Development Kit
ESC driver APIs

ESC driver APIs. More...

Data Structures

struct  esc_eeprom_clock_config_t
 

Enumerations

enum  { status_esc_eeprom_ack_error = ((uint32_t)( status_group_esc )*1000U + (uint32_t)( 0 )) , status_esc_eeprom_checksum_error = ((uint32_t)( status_group_esc )*1000U + (uint32_t)( 1 )) }
 ESC error codes. More...
 
enum  esc_latch_source_t { latch_source_from_ntm = 0 , latch_source_from_trigger_mux = 1 }
 
enum  esc_eeprom_cmd_t { esc_eeprom_idle_cmd = 0 , esc_eeprom_read_cmd = 1 , esc_eeprom_write_cmd = 2 , esc_eeprom_reload_cmd = 4 }
 
enum  esc_ctrl_signal_function_t {
  esc_ctrl_signal_func_alt_nmii_link0 = 0 , esc_ctrl_signal_func_alt_nmii_link1 = 1 , esc_ctrl_signal_func_alt_nmii_link2 = 2 , esc_ctrl_signal_func_alt_link_act0 = 3 ,
  esc_ctrl_signal_func_alt_link_act1 = 4 , esc_ctrl_signal_func_alt_link_act2 = 5 , esc_ctrl_signal_func_alt_led_run = 6 , esc_ctrl_signal_func_alt_led_err = 7 ,
  esc_ctrl_signal_func_alt_reset_out = 8
}
 

Functions

static void esc_core_enable_clock (ESC_Type *ptr, bool enable)
 ESC peripheral clock. More...
 
static void esc_phy_enable_clock (ESC_Type *ptr, bool enable)
 ESC PHY clock. More...
 
static void esc_config_eeprom_and_clock (ESC_Type *ptr, esc_eeprom_clock_config_t *config)
 ESC config eeprom attributes(emulation and size) and peripheral clock. More...
 
static void esc_config_ctrl_signal_function (ESC_Type *ptr, uint8_t index, esc_ctrl_signal_function_t func, bool invert)
 ESC assign specific function to CTRL signal. More...
 
static void esc_config_nmii_link_source (ESC_Type *ptr, bool link0_from_io, bool link1_from_io, bool link2_from_io)
 ESC config nmii_link signal source. More...
 
static void esc_config_reset_source (ESC_Type *ptr, bool reset_from_ecat_core)
 ESC config reset signal source. More...
 
static void esc_pdi_reset (ESC_Type *ptr)
 ESC generate reset signal to ESC_RESET interrupt and RESET_OUT pin. More...
 
static void esc_set_phy_offset (ESC_Type *ptr, uint8_t offset)
 ESC set phy offset. More...
 
static void esc_enable_pdi_access_mii_management (ESC_Type *ptr)
 ESC enable PDI to access MII management. More...
 
static void esc_disable_pdi_access_mii_management (ESC_Type *ptr)
 ESC disable PDI to access MII management. More...
 
hpm_stat_t esc_mdio_read (ESC_Type *ptr, uint8_t phy_addr, uint8_t reg_addr, uint16_t *data)
 ESC read PHY register via ESC MII Management Interface. More...
 
hpm_stat_t esc_mdio_write (ESC_Type *ptr, uint8_t phy_addr, uint8_t reg_addr, uint16_t data)
 ESc write PHY register via ESC MII Management Interface. More...
 
hpm_stat_t esc_check_eeprom_loading (ESC_Type *ptr)
 ESC check eeprom loading data status. More...
 
static uint8_t esc_get_eeprom_cmd (ESC_Type *ptr)
 ESC get eeprom cmd, this using in eeprom emulation function. More...
 
static void esc_eeprom_emulation_ack (ESC_Type *ptr, esc_eeprom_cmd_t cmd, bool ack_err, bool crc_err)
 ESC ack eeprom cmd in eeprom emualtion function. More...
 
static uint32_t esc_get_eeprom_byte_address (ESC_Type *ptr)
 ESC get eeprom byte address. More...
 
static uint32_t esc_get_eeprom_word_address (ESC_Type *ptr)
 ESC get eeprom word(2 bytes) address. More...
 
static uint64_t esc_read_eeprom_data (ESC_Type *ptr)
 ESC read eeprom data from register, this function is using in eeprom emulation function. More...
 
static void esc_write_eeprom_data (ESC_Type *ptr, uint64_t data)
 ESC write eeprom data to register, this function is using in eeprom emulation function. More...
 
static void esc_config_latch0_source (ESC_Type *ptr, bool latch0_from_ntm)
 ESC config latch0 signal source. More...
 
static void esc_config_latch1_source (ESC_Type *ptr, bool latch0_from_trigmux)
 ESC config latch1 signal source. More...
 

Detailed Description

ESC driver APIs.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include <drivers/inc/hpm_esc_drv.h>

ESC error codes.

Enumerator
status_esc_eeprom_ack_error 

ESC EEPROM ack error

status_esc_eeprom_checksum_error 

ESC EEPROM checksum error

◆ esc_ctrl_signal_function_t

#include <drivers/inc/hpm_esc_drv.h>

Enumerator
esc_ctrl_signal_func_alt_nmii_link0 
esc_ctrl_signal_func_alt_nmii_link1 
esc_ctrl_signal_func_alt_nmii_link2 
esc_ctrl_signal_func_alt_link_act0 
esc_ctrl_signal_func_alt_link_act1 
esc_ctrl_signal_func_alt_link_act2 
esc_ctrl_signal_func_alt_led_run 
esc_ctrl_signal_func_alt_led_err 
esc_ctrl_signal_func_alt_reset_out 

◆ esc_eeprom_cmd_t

#include <drivers/inc/hpm_esc_drv.h>

Enumerator
esc_eeprom_idle_cmd 
esc_eeprom_read_cmd 
esc_eeprom_write_cmd 
esc_eeprom_reload_cmd 

◆ esc_latch_source_t

#include <drivers/inc/hpm_esc_drv.h>

Enumerator
latch_source_from_ntm 
latch_source_from_trigger_mux 

Function Documentation

◆ esc_check_eeprom_loading()

hpm_stat_t esc_check_eeprom_loading ( ESC_Type ptr)

#include <drivers/inc/hpm_esc_drv.h>

ESC check eeprom loading data status.

Note
EtherCAT communication is possible even if the EEPROM is blank
Parameters
[in]ptrESC base address.
Return values
status_successloding data successfully and correctlly.
status_esc_eeprom_ack_errorloding data checksum error(eeprom blank).
status_esc_eeprom_checksum_errorno ack error.
status_timeoutloding data timeout.

◆ esc_config_ctrl_signal_function()

static void esc_config_ctrl_signal_function ( ESC_Type ptr,
uint8_t  index,
esc_ctrl_signal_function_t  func,
bool  invert 
)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC assign specific function to CTRL signal.

Parameters
[in]ptrESC base address
[in]indexCTRL signal index(0-8)
[in]funcspecific function
[in]invertinvert signal

◆ esc_config_eeprom_and_clock()

static void esc_config_eeprom_and_clock ( ESC_Type ptr,
esc_eeprom_clock_config_t config 
)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC config eeprom attributes(emulation and size) and peripheral clock.

Parameters
[in]ptrESC base address
[in]configesc_eeprom_clock_config_t

◆ esc_config_latch0_source()

static void esc_config_latch0_source ( ESC_Type ptr,
bool  latch0_from_ntm 
)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC config latch0 signal source.

Parameters
[in]ptrESC base address
[in]latch0_from_ntmtrue for signal from ntm system, false for signal from IO

◆ esc_config_latch1_source()

static void esc_config_latch1_source ( ESC_Type ptr,
bool  latch0_from_trigmux 
)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC config latch1 signal source.

Parameters
[in]ptrESC base address
[in]latch0_from_trigmuxtrue for signal from trigmux system, false for signal from IO

◆ esc_config_nmii_link_source()

static void esc_config_nmii_link_source ( ESC_Type ptr,
bool  link0_from_io,
bool  link1_from_io,
bool  link2_from_io 
)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC config nmii_link signal source.

Parameters
[in]ptrESC base address
[in]link0_from_iotrue for signal from configured IO; false for signal from register(GPR_CFG2) value
[in]link1_from_iotrue for signal from configured IO; false for signal from register(GPR_CFG2) value
[in]link2_from_iotrue for signal from configured IO; false for signal from register(GPR_CFG2) value

◆ esc_config_reset_source()

static void esc_config_reset_source ( ESC_Type ptr,
bool  reset_from_ecat_core 
)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC config reset signal source.

Parameters
[in]ptrESC base address
[in]reset_from_ecat_coretrue for reset signal from ecat core; false for reset signal from register(GPR_CFG1) value

◆ esc_core_enable_clock()

static void esc_core_enable_clock ( ESC_Type ptr,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC peripheral clock.

Parameters
[in]ptrESC base address
[in]enableSet true to enable or false to disable

◆ esc_disable_pdi_access_mii_management()

static void esc_disable_pdi_access_mii_management ( ESC_Type ptr)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC disable PDI to access MII management.

Parameters
[in]ptrESC base address

◆ esc_eeprom_emulation_ack()

static void esc_eeprom_emulation_ack ( ESC_Type ptr,
esc_eeprom_cmd_t  cmd,
bool  ack_err,
bool  crc_err 
)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC ack eeprom cmd in eeprom emualtion function.

Parameters
[in]ptrESC base address
[in]cmdesc_eeprom_cmd_t
[in]ack_erreeprom ack error occurrred
[in]crc_erreeprom checksum error occurrred

◆ esc_enable_pdi_access_mii_management()

static void esc_enable_pdi_access_mii_management ( ESC_Type ptr)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC enable PDI to access MII management.

Parameters
[in]ptrESC base address

◆ esc_get_eeprom_byte_address()

static uint32_t esc_get_eeprom_byte_address ( ESC_Type ptr)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC get eeprom byte address.

Parameters
[in]ptrESC base address
Returns
byte address

◆ esc_get_eeprom_cmd()

static uint8_t esc_get_eeprom_cmd ( ESC_Type ptr)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC get eeprom cmd, this using in eeprom emulation function.

Parameters
[in]ptrESC base address
Returns
uint8_t esc_eeprom_cmd_t.

◆ esc_get_eeprom_word_address()

static uint32_t esc_get_eeprom_word_address ( ESC_Type ptr)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC get eeprom word(2 bytes) address.

Parameters
[in]ptrESC base address
Returns
word address

◆ esc_mdio_read()

hpm_stat_t esc_mdio_read ( ESC_Type ptr,
uint8_t  phy_addr,
uint8_t  reg_addr,
uint16_t *  data 
)

#include <drivers/inc/hpm_esc_drv.h>

ESC read PHY register via ESC MII Management Interface.

Parameters
[in]ptrESC base address
[in]phy_addrPHY address.
[in]reg_addrRegister address.
[in]dataPHY data returned.

◆ esc_mdio_write()

hpm_stat_t esc_mdio_write ( ESC_Type ptr,
uint8_t  phy_addr,
uint8_t  reg_addr,
uint16_t  data 
)

#include <drivers/inc/hpm_esc_drv.h>

ESc write PHY register via ESC MII Management Interface.

Parameters
[in]ptrESC base address
[in]phy_addrPHY address.
[in]reg_addrRegister address.
[in]dataWrite to PHY register.

◆ esc_pdi_reset()

static void esc_pdi_reset ( ESC_Type ptr)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC generate reset signal to ESC_RESET interrupt and RESET_OUT pin.

Note
the reset signal source should be configured in esc_config_reset_source before
Parameters
[in]ptrESC base address

◆ esc_phy_enable_clock()

static void esc_phy_enable_clock ( ESC_Type ptr,
bool  enable 
)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC PHY clock.

Parameters
[in]ptrESC base address
[in]enableSet true to enable or false to disable

< enable PHY 25M refck

< disable PHY 25M refck

◆ esc_read_eeprom_data()

static uint64_t esc_read_eeprom_data ( ESC_Type ptr)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC read eeprom data from register, this function is using in eeprom emulation function.

Parameters
[in]ptrESC base address
Returns
eeprom data

◆ esc_set_phy_offset()

static void esc_set_phy_offset ( ESC_Type ptr,
uint8_t  offset 
)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC set phy offset.

Parameters
[in]ptrESC base address
[in]offsetPHY register offset

◆ esc_write_eeprom_data()

static void esc_write_eeprom_data ( ESC_Type ptr,
uint64_t  data 
)
inlinestatic

#include <drivers/inc/hpm_esc_drv.h>

ESC write eeprom data to register, this function is using in eeprom emulation function.

Parameters
[in]ptrESC base address
[in]dataeeprom data