Library to handle the X-NUCLEO-IHM01A1 Motor Control Expansion Board based on the L6474 component.
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Dependents: Stepper_Matlab_Control SunTracker_BLE Stepper_Matlab_Control MemsMotorControl ... more
Fork of X_NUCLEO_IHM01A1 by
Motor Control Library
Introduction
Library to handle the X-NUCLEO-IHM01A1 Motor Control Expansion Board based on the the L6474 component.
Daisy-Chain Configuration
This board can be stacked up to three times so that the L6474 components will be connected in daisy-chain configuration. For this purpose, some resistors must be correctly connected on the boards as depicted here below:
Platform compatibility
- NUCLEO boards have been tested with the default configuration provided by the HelloWorld_IHM01A1 example.
- LPCXpresso11U68 board has been tested with the following patch:
- to connect with a wire from the LPCX’s
D4
pin to the IHM01A1’sD9
pin; - to initialize the pwm PinName variable with
D4
rather thanD9
.
- to connect with a wire from the LPCX’s
- FRDM-K64F board has been tested with the following patch:
- to connect with a wire from the FRDM’s
D4
pin to the IHM01A1’sD8
pin; - to initialize the standby_reset PinName variable with
D4
rather thanD8
.
- to connect with a wire from the FRDM’s
Example Applications
- HelloWorld_IHM01A1
- HelloWorld_IHM01A1_2Motors
- MotorControl_IHM01A1
- MemsMotorControl
- MemsMotorControl_IHM01A1_IKS01A2
Diff: Components/l6474/l6474.h
- Revision:
- 18:2d6ab2b93685
- Parent:
- 8:42e0b00b1e4d
- Child:
- 22:ed3a6990a6eb
--- a/Components/l6474/l6474.h Mon Jan 04 15:54:07 2016 +0000 +++ b/Components/l6474/l6474.h Wed Jan 13 14:35:59 2016 +0000 @@ -435,6 +435,70 @@ * @} */ +/** @defgroup Motor_Driver_Initialization_Structure + * @{ + */ +/// Motor driver initialization structure definition +typedef struct +{ + /* Acceleration rate in step/s2. Range: (0..+inf). */ + int acceleration_step_s2; + + /* Deceleration rate in step/s2. Range: (0..+inf). */ + int deceleration_step_s2; + + /* Maximum speed in step/s. Range: (30..10000]. */ + int maximum_speed_step_s; + + /* Minimum speed in step/s. Range: [30..10000). */ + int minimum_speed_step_s; + + /* Torque regulation current in mA. Range: 31.25mA to 4000mA. */ + float torque_regulation_current_mA; + + /* Overcurrent threshold (OCD_TH register). */ + L6474_OCD_TH_t overcurrent_threshold; + + /* Overcurrent shutwdown (OC_SD field of CONFIG register). */ + L6474_CONFIG_OC_SD_t overcurrent_shutwdown; + + /* Torque regulation method (EN_TQREG field of CONFIG register). */ + L6474_CONFIG_EN_TQREG_t torque_regulation_method; + + /* Step selection (STEP_SEL field of STEP_MODE register). */ + L6474_STEP_SEL_t step_selection; + + /* Sync selection (SYNC_SEL field of STEP_MODE register). */ + L6474_SYNC_SEL_t sync_selection; + + /* Fall time value (T_FAST field of T_FAST register). Range: 2us to 32us. */ + L6474_FAST_STEP_t fall_time; + + /* Maximum fast decay time (T_OFF field of T_FAST register). Range: 2us to 32us. */ + L6474_TOFF_FAST_t maximum_fast_decay_time; + + /* Minimum ON time in us (TON_MIN register). Range: 0.5us to 64us. */ + float minimum_ON_time_us; + + /* Minimum OFF time in us (TOFF_MIN register). Range: 0.5us to 64us. */ + float minimum_OFF_time_us; + + /* Target Swicthing Period (field TOFF of CONFIG register). */ + L6474_CONFIG_TOFF_t target_swicthing_period; + + /* Slew rate (POW_SR field of CONFIG register). */ + L6474_CONFIG_POW_SR_t slew_rate; + + /* Clock setting (OSC_CLK_SEL field of CONFIG register). */ + L6474_CONFIG_OSC_MGMT_t clock; + + /* Alarm (ALARM_EN register). */ + int alarm; +} L6474_InitTypeDef; +/** + * @} + */ + /** * @brief L6474 driver data structure definition */ @@ -448,11 +512,14 @@ bool isrFlag; // = FALSE; /// L6474 Device Paramaters structure deviceParams_t devicePrm; //[MAX_NUMBER_OF_DEVICES]; - uint8_t numberOfDevices; - uint8_t deviceInstance; + uint8_t number_of_devices; + uint8_t device_instance; uint8_t spiTxBursts[L6474_CMD_ARG_MAX_NB_BYTES][MAX_NUMBER_OF_DEVICES]; uint8_t spiRxBursts[L6474_CMD_ARG_MAX_NB_BYTES][MAX_NUMBER_OF_DEVICES]; } L6474_DrvDataTypeDef; +/** + * @} + */ /* Exported functions --------------------------------------------------------*/