AN 669: Drive-On-Chip Design Example for Cyclone V Devices

ID 683466
Date 5/15/2022
Document Table of Contents

8.3. Defining a New Motor or Encoder Type

  1. To use a different motor type or position feedback encoder with the Drive-On-Chip Designs, declare a new motor type array of type motor_t in motor_types.c.
  2. Provide C source code for the three functions encoder_init_fn, encoder_service_fn and encoder_read_position_fn if none of the existing functions are suitable.
  3. Use the functions provided with the design as templates to write your own functions.
  4. Initially, use the gain constants from an existing motor type and then determine new values when you first run the motor by following a standard PI controller tuning process.
    Refer to the declaration of tamagawa_resolver software source file as an example.
  5. Edit the declaration of the motors[] array in demo_cfg.c to use your motor.
    The default motors[] definition for the Tandem Motion-Power 48 V Board is two Tamagawa motors with resolvers:
    motor_t * motors[] = {&tamagawa_resolver[1], &tamagawa_resolver[1], NULL, NULL};
    The resolver interface on the Tandem Motion-Power 48 V board converts the resolver output into quadrature equivalent or Hall equivalent encoder signals. The design supports a maximum of two axes so the third and fourth elements of the motors[] array are set to NULL for clarity.