Fanuc encoders

More
1 year 3 weeks ago #335956 by mark-v-d
Fanuc encoders was created by mark-v-d
I've recently bought a Harrison Alpha 330 with a broken computer. I am
going to convert this lathe to linuxcnc using my own motor drives.
 
Since this lathe was using a Fanuc controller and I could not find
sufficient information about the Fanuc encoder protocol, I decided to
try to reverse engineer the protocol. And it seems I have succeeded and
would like to share what I have learnt about the protocol, in case anyone
else wants to re-use their Fanuc encoders.
 
The motors present are beta1/3000 or A06B-0031-B077 (X-axis) and
beta2/3000 or A06B-0032-B077 (Z-axis)
 
First of all the code can be found in
github.com/mark-v-d/motor_control/tree/fanuc
 
Both the file software/xmc4400/src/encoder.cpp and
software/xmc4400/src/crc_lut.h should contain all
the information necessary.
 
/* Fanuc***********************************************************/
   Datarate is 1024kb/s. Send a positive pulse on REQ (pin-5) of 7..9us
   to get a response.  The response is 4 frames of 1 start bit, 16 data
   bits and 1 stop bit.  After the 4th frame the CRC is transmitted,
   without a preceding startbit.  The way to capture it, is to change
   the word length of the 4th frame to 16+1+5 bits.
 
    1st status
        0xe000  3-msb changes, reason unknown
        0x0100  index seen
        0x0005  always there so-far.
    2nd 16-bit counter within revolution
    3rd revolution counter
    4th absolute
        0x8000  Always set?
        0x03fc  Commutation angle? After index the same as 2nd>>4
    5th 5-bit CRC
 

Please Log in or Create an account to join the conversation.

More
1 year 3 weeks ago #335997 by andypugh
Replied by andypugh on topic Fanuc encoders
Is this the serial protocol, or the 4-bit gray code?

I think that _some_ Fanuc serial protocols are supported by Hostmot2:
linuxcnc.org/docs/stable/html/man/man9/h...html#Fanuc%20encoder

Please Log in or Create an account to join the conversation.

More
1 year 3 weeks ago #336008 by jmelson
Replied by jmelson on topic Fanuc encoders

Is this the serial protocol, or the 4-bit gray code?

I think that _some_ Fanuc serial protocols are supported by Hostmot2:
linuxcnc.org/docs/stable/html/man/man9/h...html#Fanuc%20encoder
 
Mark's message gives the details of the serial protocol.  I don't know why he had to duplicate the effort, I have already deciphered these encoders and have a protocol converter product.  But, now, Fanuc has a "High speed" encoder line that is incompatible with the older ones.
Jon

Please Log in or Create an account to join the conversation.

More
1 year 3 weeks ago #336014 by mark-v-d
Replied by mark-v-d on topic Fanuc encoders
It could very well be the same, but I'm not sure. This is for the beta and not the alpha series of Fanuc. Like I said, I could not find the details of the protocol anywhere, but that could also mean I did not look in the right place.

Please Log in or Create an account to join the conversation.

More
1 year 3 weeks ago #336024 by mark-v-d
Replied by mark-v-d on topic Fanuc encoders
I've verified the vhdl and c code, and hostmot2 is indeed dealing with
the same protocol.

But at least now you know how to interpret the CRC, because that is not
done in hostmot2.

And I have learned where the batt_fail bit is (not that there is one on
the incremental encoder) They also don't seem to know what the purpose of
those 3 changing bits is. Maybe I'll figure that one out eventually.

Please Log in or Create an account to join the conversation.

More
1 year 3 weeks ago #336027 by jmelson
Replied by jmelson on topic Fanuc encoders

It could very well be the same, but I'm not sure. This is for the beta and not the alpha series of Fanuc. Like I said, I could not find the details of the protocol anywhere, but that could also mean I did not look in the right place.
 
I never found any document on the data format, but I managed to insert a pulse and get the encoder to send data.  Then, I looked at it on a scope, and created an FPGA to read the data and send it to a computer via the parallel port.  I then spun the encoder by hand and wrote programs to extract the data.  The hardest thing to crack was the CRC.  I took some of the extracted data, and ran it through a program that tried many different CRC polynomials until I got a zero result from every data pattern.  Then, I coded that up in VHDL and put it into my converter product.
Your description looks JUST like what I deciphered.

One note,  There are absolute and incremental versions of these encoders, at least on the older Alpha series.  The absolute ones have extra data at the end that provides a 10-bit resolution absolute position immediately at power-on.  The incremental encoders power-up assuming rotary position zero, and then the position count jumps when they pass the index position.  So, you can't get any reliable commutation out of them without battery backup.
Jon

Please Log in or Create an account to join the conversation.

Moderators: PCW, jmelson
Time to create page: 0.066 seconds
Powered by Kunena Forum