This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Tiva C Series + SSI rotary encoder

Hi, everyone. I'm really new to microcontrollers and now I am trying get into it. Unfortunately, I have to do it in no  time.

I have a task to receive and save to pc the data from IMU and 2 rotary encoders which have SSI output (binary format)
Encoders datasheet: http://www.avagotech.com/docs/AV02-0188EN   

And I have several questions:
I chose https://estore.ti.com/Sensor-Hub-BoosterPack-and-Tiva-C-Series-TM4C123G-LaunchPad-Bundle-P4538.aspx this as the main board + IMU. Does this booster pack returns Euler angles or quaternions or rough data only? Is this board suitable for this task?
 
I tried to find any info which may be useful for a newbie about SSI encoders connection, but failed. Do I need any extra peripheral to connect such an encoder or Tiva launchpad is enough? Where can I find a pin drawing just to know where to connect? And finally are there any code examples how to retrieve data from such encoders via SSI?
And the last question - what is the max cable length that can be used to connect encoders? 

Thanks a lot!
Best regards, Stanislav. 

  • Stas,

    The board returns rough data only. Our Sensorlib software library has functions to compute Euler angles and quaternions. The Launchpad TivaWare software has an example of this in the examples\boards\ek-tm4c123gxl-boostxl-senshub\compdcm_mpu9150 folder in the TivaWare directory.

    In general you would not need extra peripherals to connect a SSI peripheral to the Launchpad. Unfortunately, your encoders run at 5V. The Tiva chip on the Launchpad only outputs 3.3V level signals, so they are not compatible without additional circuitry.

    You can find pin drawings in the Launchpad user guide. There are no encoder specific SSI examples, but a general example of how to configure SSI can be found in the examples\peripherals\ssi folder in the TivaWare directory. The maximum cable length would depend on your desired data rate and the electrical properties of your cable.

  • Thanks for the fast response!

    Is it possible to use this encoder with pwm output instead?http://www.bourns.com/data/global/pdfs/EMS22P.pdf      
     

  • Yes, that encoder can be run off a 3.3V supply. However, it uses PWM output, not SPI, so you'd have to implement the suggested filter circuit and attach it to an ADC pin on the microcontroller.

  • void EF_void_RotaryEncoder_Init ()
    {
        /* D7 for Signal A */
        EF_S8_t_DIO_InitPin (SIGNAL_A_PORT , SIGNAL_A_PIN , INPUT);
    	//when make it pull up , increase for ever !!!!!!!!!
    //    GPIOPadConfigSet (SIGNAL_A_GPIO_BASE, SIGNAL_A_GPIO_PIN, GPIO_STRENGTH_2MA , GPIO_PIN_TYPE_STD_WPU);
        /* D6 for Signal B */
        EF_S8_t_DIO_InitPin (SIGNAL_B_PORT , SIGNAL_B_PIN , INPUT);
    		//when make it pull up , increase for ever !!!!!!!!!
    //    GPIOPadConfigSet (SIGNAL_B_GPIO_BASE, SIGNAL_B_GPIO_PIN, GPIO_STRENGTH_2MA , GPIO_PIN_TYPE_STD_WPU);
    //    /* Enable Interrupt in D7 pin (Signal A)*/
        GPIOIntTypeSet(SIGNAL_A_GPIO_BASE, SIGNAL_A_GPIO_PIN, GPIO_FALLING_EDGE);
        GPIOIntEnable(SIGNAL_A_GPIO_BASE, SIGNAL_A_GPIO_PIN);
        IntEnable(INT_GPIOD);
        IntMasterEnable();
    }
    
    void Encoder_Operation_ISR()
    {
        //Clear interrupt flag. Since we only enabled on this is enough
        GPIOIntClear(SIGNAL_A_GPIO_BASE, SIGNAL_A_GPIO_PIN);
             if ( EF_S8_DIO_CheckPin(SIGNAL_B_PORT, SIGNAL_B_PIN) == FALSE )
             {
                 /* A = 1 when B = 1 ===>  Decrement */
                 Encoder_Counter--;
             }
             else
             {
                 /* A = 1 when B = 0 ===>  Increment */
                   Encoder_Counter++;
             }
    		 UARTprintf("Counter: %d \n" , (int) Encoder_Counter);
    }
    

    I worked with sample rotary encoder with 5 pins like this:

    I used a sample code with tiva and connected encoder with parallel capacitor 10nf and series resistance 10k as they Say.

    and this code worked well with atmega

    but with tiva ,not worked well , I don't know the reason... Can you help me ?

    and if i Connected the Cap. parallel near the rotary pin is better than in the result of connecting the Cap. near to the tiva, but all are bad reading

    and this is the code:

  • I removed the capacitor and it was better more and more than the two mentioned cases. but it wasn't very good.