Read Industrial Serial Encoder w/ Manchester Encoded Output

Thread Starter

mcardoso

Joined May 19, 2020
221
Hi All,

I am working on getting an industrial robot running and one of my challenges is converting the serial encoder data into a different serial format my servo drives can understand. This is a big project but I'd like to ask a simplified question about reading this data.

Problem Statement: I'd like to read the output of this Tamagawa TS5643N151 serial encoder into a microprocessor (I'll start with an Arduino Mega, but likely move to something more powerful for the final implementation), decode the packets, and output the data on another serial port.

Attached is the encoder specification, an image of the captured serial data, an image of the decoded serial data, and a picture of the robot for fun.

I've decoded the data by hand on some worksheets quite easily, but I haven't programmed a micro in a good number of years, and I've never worked with manchester encoded serial. The serial data is presented in two packets, and the payloads need to be combined. The payload consists of:
  1. Single Turn Data (First 11 bits of packet 1, LSB) - The absolute angle of the encoder shaft
  2. Multi Turn Data (Last 4 bits of packet 1 and first 9 bits of packet 2, LSB) - The integer count of revolutions since counter reset
  3. Status Flags (Last 6 bits of packet 2)
  4. CRC - Some sort of polynomial 3 bit CRC. I do not know how this is calculated. There is one for each packet.

Questions:
  1. Can an Arduino read serial packets with Manchester encoding? I think yes since there are some libraries, although they seem to expect a predetermined packet format that looks different from what I have.
  2. What is the baudrate I should use for the serial port? I got confused with baud and bit rate, especially with manchester encoding.
  3. How is a 3 bit CRC calculated? Can I figure out which polynomial is used from my example below?
  4. Is there any good sample code for what I'm trying to do?

1645108262424.png

SDS00003.jpg

1645108062926.png

image083.jpg
 

Attachments

Thread Starter

mcardoso

Joined May 19, 2020
221
Well you were very correct. I've been able to figure out some of this info since my last post.

Can an Arduino read serial packets with Manchester encoding? I think yes since there are some libraries, although they seem to expect a predetermined packet format that looks different from what I have.
Yes, there are manchester libraries, but they have a fixed packet format and a limited number of available baud rates. Max is 57600 baud.

What is the baudrate I should use for the serial port? I got confused with baud and bit rate, especially with manchester encoding.
This serial stream is 2Mbps or 1 Mbaud. Yikes!

How is a 3 bit CRC calculated? Can I figure out which polynomial is used from my example below?
This is a 3 bit polynomial CRC on an 18 bit data field. Specifically this is a X^3 +X +1 (also known as a 1011) polynomial.

Is there any good sample code for what I'm trying to do?
Not really...


So I didn't quite put two and two together, but the bit rate is 2MHz. It's funny how you can be so zoomed in on a scope that you just miss how fast this stuff is coming in. An Arduino running at 16MHz just has no hope of keeping up with that.

So my new question is, what kind of micro or FPGA would be appropriate at receiving 2 serial streams (#1 is manchester @ 2Mbps, #2 is NRZ encoding at 2.5Mbps) and tracking one quadrature encoder signal at 680kHz (1.47us per count). Serial signal 1 would need to be parsed, CRC verified, and saved to memory. Serial signal 2 would need to be parsed, CRC verified, and a response packet formulated from data in memory.

I've worked with Arduino and STM32 (on a Nucleo MBed development board), but not much else, so I'm a bit in the dark here. Is this a task more appropriate for a higher end micro, or should I be starting to think FPGA?
 
Top