0

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?

2

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.

  • If it's functionally SPI, why are they calling it SSI? Aren't those very different things? – Cerin Aug 21 '18 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 Aug 21 '18 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)? – jose can u c Aug 21 '18 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 Aug 21 '18 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 Aug 21 '18 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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