BiSS Interface Demo

The purpose of this app is showing the use of the BiSS Interface Module with Position Feedback Module. For that, it implements a simple app that reads the output of an BiSS sensor and shows over XScope the read velocity and position. It also displays the status of the BiSS sensor for debugging.

  • Min. Nr. of cores: 2
  • Min. Nr. of tiles: 1

Quick How-to

  1. Assemble your SOMANET device.
  2. Wire up your device. Check how at your specific hardware documentation. Connect your sensor, power supply cable, and XTAG. Power up!
  3. Set up your XMOS development tools.
  4. Download and import in your workspace the SOMANET Motor Control Library and its dependencies.
  5. Open the main.xc within the app. Include the board-support file according to your device. Also set the appropriate target in your Makefile.

Important

Make sure the SOMANET Motor Control Library supports your SOMANET device. For that, check the Hardware compatibility section of the library.

  1. Again in your main.xc, set the configuration for the Position feedback Service and you sensor.

    on tile[IFM_TILE]:
    /* Position feedback service */
    {
        PositionFeedbackConfig position_feedback_config;
        position_feedback_config.sensor_type = BISS_SENSOR;
        position_feedback_config.resolution  = BISS_SENSOR_RESOLUTION;
        position_feedback_config.polarity    = NORMAL_POLARITY;
        position_feedback_config.velocity_compute_period = BISS_SENSOR_VELOCITY_COMPUTE_PERIOD;
        position_feedback_config.pole_pairs  = POLE_PAIRS;
        position_feedback_config.ifm_usec    = IFM_TILE_USEC;
        position_feedback_config.max_ticks   = SENSOR_MAX_TICKS;
        position_feedback_config.offset      = 0;
        position_feedback_config.sensor_function = SENSOR_FUNCTION_COMMUTATION_AND_MOTION_CONTROL;
    
        position_feedback_config.biss_config.multiturn_resolution = BISS_MULTITURN_RESOLUTION;
        position_feedback_config.biss_config.filling_bits = BISS_FILLING_BITS;
        position_feedback_config.biss_config.crc_poly = BISS_CRC_POLY;
        position_feedback_config.biss_config.clock_frequency = BISS_CLOCK_FREQUENCY;
        position_feedback_config.biss_config.timeout = BISS_TIMEOUT;
        position_feedback_config.biss_config.busy = BISS_BUSY;
        position_feedback_config.biss_config.clock_port_config = BISS_CLOCK_PORT;
        position_feedback_config.biss_config.data_port_number = BISS_DATA_PORT_NUMBER;
    
        position_feedback_service(qei_hall_port_1, qei_hall_port_2, hall_enc_select_port, spi_ports, null, null, null, null,
                position_feedback_config, i_shared_memory[0], i_position_feedback,
                null, null, null);
    }
    
  2. In parallel, the position/velocity and others status info are displayed with XScope.

    on tile[APP_TILE]:
    {
        timer t;
        unsigned int start_time, end_time;
        int count = 0;
        int real_count = 0;
        unsigned int angle = 0;
        int velocity = 0;
        unsigned int position = 0;
        unsigned int status = 0;
    
        while(1) {
    
            /* get position from BiSS Encoder */
            { count, position, status } = i_position_feedback.get_position();
    
            t :> start_time;
            /* get angle and velocity from BiSS Encoder */
            angle = i_position_feedback.get_angle();
            velocity = i_position_feedback.get_velocity();
            t :> end_time;
    
    
            if (!isnull(i_shared_memory)) {
                UpstreamControlData upstream_control_data = i_shared_memory.read();
                angle = upstream_control_data.angle;
                count = upstream_control_data.position;
                velocity = upstream_control_data.velocity;
            }
    
            xscope_int(COUNT, count);                           //absolute count
            xscope_int(REAL_COUNT, real_count);                 //real internal absolute count
            xscope_int(POSITION, position);                     //singleturn position
            xscope_int(ANGLE, angle);                           //electrical angle
            xscope_int(VELOCITY, velocity);                     //velocity in rpm
            xscope_int(ERROR_BIT, (status&0b10) * 500);         //error bit, should be 0
            xscope_int(WARNING_BIT, (status&0b01) * 1000);      //warning bit, should be 0
            xscope_int(TIME, (end_time-start_time)/USEC_STD);   //time to get the data in microseconds
            xscope_int(CRC_ERROR, (status>>2)*1000);            //number of CRC errors, should be 0
    
            delay_milliseconds(1);
        }
    }
    
  3. Run the application enabling XScope.

See also

Did everything go well? If you need further support please check out our forum.