1

I'm trying to interface with version RM08S of this rotary encoder using an Arduino Mega. The sensor supports a "Synchro serial interface (SSI), single ended" interface. I'm unfamiliar with this protocol.

Despite the name, it doesn't appear to match the description of the formal SSI or RS-422 specification, since that requires two wires for differential clock and data lines, whereas this sensor only has a single wire for each. This makes it sound more like IIC, but without the bus-like functionality.

Googling finds very few results on interfacing the Arduino to SSI devices, much less any standard libraries. This forum thread asks a similar question, but doesn't seem to resolve the issue.

Since there's just a clock and data line, would reading from this be as simple as toggling clock, and then reading the 10-bits of data from the data line, sequentially with each clock tick, accounting for whatever bits are used to pad the packet?

1
  • On my RM08 is an RS422 Interface connected. Can i just connect Data+ to Miso and CLK+ to SCK? @Majenko
    – TobiMiller
    Commented Nov 13, 2020 at 8:44

1 Answer 1

3

It's just SPI.

SPI.begin();
SPI.setDataMode(SPI_MODE2);

// ...

uint8_t h = SPI.transfer(0x00);
uint8_t l = SPI.transfer(0x00);
delayMicroseconds(20); // Indicate EOT
uint16_t v = (h << 8) | l;
v >>= 4; // for 12 bit resolution, 5 for 11 bit, 6 for 10 bit etc.

For 8 bit resolution or less you only need one SPI.transfer, and subtract 8 from the right-shift amount.

Wiring is simple: clock to SCK (52 or ICSP 3) and data to MISO (50 or ICSP 1).

The timing diagrams in the datasheet (page 5) describe it all in detail.

5
  • If it's functionally SPI, why are they calling it SSI? Aren't those very different things?
    – Cerin
    Commented Aug 21, 2018 at 16:15
  • It's almost SPI. Close enough to work. There is no CS pin, and timing is more critical, so they can't really call it SPI. It's a serial interface, and it's synchronous.
    – Majenko
    Commented Aug 21, 2018 at 16:17
  • The datasheet notes that the clock should start high, and after a falling-edge, the sensor value is latched, and on the next rising edge, you get the MSB. For SPI, doesn't clock start low, so you won't get the MSB until the 2nd cycle (2nd bit)? Commented Aug 21, 2018 at 17:46
  • @josecanuc It depends on the "mode" of SPI. You may need to issue an SPI.setDataMode(...) to set SPI into the right phase / polarity.
    – Majenko
    Commented Aug 21, 2018 at 17:48
  • @josecanuc Thanks for pointing it out, by the way. I have added the right mode call to the example above. It looks like SPI_MODE2 should do it (Polarity = 1, Phase = 0)
    – Majenko
    Commented Aug 21, 2018 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.