Sanyo Denki ABS encoder

More
12 Apr 2023 16:22 #268906 by PVal
Sanyo Denki ABS encoder was created by PVal
I'm planning to retrofit an old OTC-Daihen 6-axis robot with LinuxCNC, this robot is equipped with Sanyo Denki servo motors.
I have acquired Sanyo Denki servoamps (RS1) for each axis and for Mesa hardware I have 5i20+7i48+7i44+7i73.

These servoamps can output encoder data in different formats, serial and pulse. As I need absolute position information I would like to use serial data. For serial data there are three different options; Binary code (9.2ms), ASCII (16.7ms) and encoder signal direct output (21.6us). (Page 210 from RS-1 instruction manual)
So for robot application I would choose the fastest option ->encoder signal direct output.

What would be the best way to read this encoder? i.e. how to send 18bit request and then listen for encoder response. 

Specification for these battery-backup multiturn absolute encoders:
Single turn resolution= 17bit
Multiturn count= 16bit
Half-duplex RS-485, NRZ code, Asynchronous.
Baud rate is 2.5MBd, LSB is transferred first.
One request frame and three response fields.
Frames have 16 data bits + 1 start + 1 stop bit = 18 bits. 

I found a detailed description of this encoder protocol from here:
www.mikrocontroller.net/attachment/58813...B_PA035-017BM001.pdf

Different request codes are described in page 13, interesting requests would be absolute full data request CDF0 or Absolute lower 24-bit data request CDF1.
In page 14 there is an example of CDF1 (absolute lower 24-bit data request):
Start SC FC EA CC CRC Stop
0 010 00 000 10000 001 1

Encoder response would include three fields: Information field, data field 0 and data field 1.
Information field:
Start SC EA CC 0 ES Stop
0 001 000 10000 0 ES0 ES1 ES2 ES3 1
Data field 0:
Start D0[0:15]=ABS[0:15] Stop
Data field 1:
Start D1[0:7]=ABS[16:23] D1[8:15]=CRC[0:7] Stop

Encoder data would be interpreted as:
ABS[0:16]=ST[0:16]
ABS[17:32]=MT[0:15]
ABS[33:39]="0000000"

I have tried to study fanucabs, uart, pktuart, ssi and biss but I would really need some advice on how to move forward with this.  
User ExcessiveO has modified fanucabs for RS-485, but I would assume that there are some hurdles to overcome for modifying code for these encoders.
I also found sigma5enc.vhd from hostmot2-firmware that could be modified for this purpose, but I couldn't find any documentation or drivers for that from LCNC-side.

Any help is highly appreciated.

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

More
13 Apr 2023 11:39 #268966 by andypugh
Replied by andypugh on topic Sanyo Denki ABS encoder
You might be able to use PktUART, and I just updated the manpages for that yesterday: github.com/LinuxCNC/linuxcnc/blob/2.9/do...3/hm2_pktuart.3.adoc

Do you believe that the sigma5enc.vhd would work for your encoders? If so then it would make sense to add support for that module to the linuxCNC driver. That should just require some adjustments to one of the existing absolute encoder drivers.

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

More
15 Apr 2023 08:31 - 15 Apr 2023 08:33 #269070 by PVal
Replied by PVal on topic Sanyo Denki ABS encoder
I have had some problems creating bitfile for my setup. I have tried to make file with 6xPktUART 6PWM SS, but apparently this will not fit to 5i20. I also tried to make bitfile with only 6xPktUART, but it won't fit. When I reduce the number of PktUarts to 1 (just for testing) I get error message:- The specification "TSLowToMed" is invalid because its TO- The specification "TSMedToLow" is invalid because itsSo I have had no luck in testing PktUart approach. I'm using Xilinx 9.2 for creating bit files.Out of the box sigma5enc is not going to work, because it includes HDLC encoding and manchester coding that are not used in this Sanyo Denki protocol.Maybe completely new .vhd file would need  to be written? I have no background in coding, but here's what I have tried to do. I made a new vhd-file "sanmotionenc.vhd" based on sigma5enc. See attached file sanmotionenc.txt. There could be some peculiarities, but bare with me. The first goal for me would be just to send correct bitstream to amplifier. I made also adjustment to idromconst and idromtools files for replacing parts with sigma to sanmotionenc. Then I created bitfile with 6xPWM 6xsanmotionenc SS. For the next steps I would need some guidance, what kind of adjustments should be done for existing absolute encoder drivers?   

File Attachment:

File Name: sanmotione...4-15.txt
File Size:12 KB
Attachments:
Last edit: 15 Apr 2023 08:33 by PVal. Reason: Attachment

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

More
15 Apr 2023 09:05 #269076 by andypugh
Replied by andypugh on topic Sanyo Denki ABS encoder
Have you tried contacting Mesa and asking for advice? It's possible that they have something that might help. Or at least will know how many PktUART can squeeze onto a 5i20. (Surprised those are still available to be honest)

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

More
15 Apr 2023 09:27 #269079 by PVal
Replied by PVal on topic Sanyo Denki ABS encoder
Not yet, I'll have to do that.
This 5i20 is already quite old. I got it for my small milling machine conversion, from steppers to servo, but my mill is still equipped with steppers...

I'm also open to hardware suggestions, would for example 7i80HD-25 make sense for this kind of project?

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

More
15 Apr 2023 09:38 #269081 by andypugh
Replied by andypugh on topic Sanyo Denki ABS encoder
For a mix of PktUART / Abs Encoder and (probably) Smart Serial I think I would be looking at the 7i94: store.mesanet.com/index.php?route=produc...83_85&product_id=324

Note that the HD cards (and presumably the 7i94) have individual Tx enable for each serial port when connected to a 7i44 but the DB25 cards (due to pin count limits) only offer Tx enable on a single channel (7). This matters for PktUART and probably matters for the Sanyo Denki protocol too.

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

More
20 Apr 2023 18:35 #269499 by PVal
Replied by PVal on topic Sanyo Denki ABS encoder
Response from Mesa was that I shouldn't use PktUART because:
"1. You dont need or want  a buffered interface (it also wastes space as
you noticed)
2. The position request should be sent automatically _before_ the nominal
read time (this is what the Fanuc,SSI and BISS interfaces do)"

For Sanyo Denki protocol a specific module should be created (similar as fanuc) accompanied by the driver code to support this.

So I'm going to check that if I can re-use fanuc code for sending the request (16bit data instead of pulse request) and after that try to figure out how to read data back from amplifier.

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

More
12 May 2023 15:45 #271233 by andypugh
Replied by andypugh on topic Sanyo Denki ABS encoder
Did you make any progress with this?

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

More
13 May 2023 17:07 - 13 May 2023 17:08 #271293 by PVal
Replied by PVal on topic Sanyo Denki ABS encoder
I have made modifications to fanucabs and after quite many iterations I was able to send the request string out. (Picture shows tx and tx_en signals, measured directly from 5i20.) This happened just yesterday so I haven't had time to test it with actual amplifier. Next I will send the request string to amplifier and hopefully get a response back. After that I'll have to find out how the amplifier response is read and converted to position data.
 
Attachments:
Last edit: 13 May 2023 17:08 by PVal.

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

More
15 May 2023 12:13 #271395 by andypugh
Replied by andypugh on topic Sanyo Denki ABS encoder
I don't know if it helps, but the STMBL drives can interpret Sanyo-Denki encoders. Perhaps you can learn something from that code?

github.com/rene-dev/stmbl/blob/master/src/comps/encs.c

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

Time to create page: 0.123 seconds
Powered by Kunena Forum