SSI ABS Encoder

More
06 May 2021 09:15 - 06 May 2021 09:29 #208080 by nhanpham
SSI ABS Encoder was created by nhanpham
hi everyone,

I have 1 ssi abs encoder 12 bit.
i connected it to mesa board and got data.
my encoder is single turn, binary code, with 4096 res/rev.
loadrt hm2_eth board_ip="10.10.10.10" config="ssi_chan_0=steps%4bzencoder%12e num_encoders=1 num_pwmgens=0 num_stepgens=4  enable_raw" 
setp hm2_7i80.0.dpll.02.timer-us -120
setp hm2_7i80.0.ssi.00.frequency-khz 300
setp hm2_7i80.0.ssi.00.timer-number 2
setp hm2_7i80.0.ssi.00.zencoder.scale 535
setp hm2_7i80.0.ssi.00.zencoder.counts-per-rev 4096
net z-pos-fbss <= hm2_7i80.0.ssi.00.zencoder.position
net z-pos-rawcountsww <= hm2_7i80.0.ssi.00.zencoder.rawcounts
net J2pos => joint.2.motor-pos-fb
The data is incorrect when i restart linuxcnc

Exam: my data is 0-3072 then it restores correctly
but if my data is 3073-4096 then whenit recovers negative numbers from -1024 ->-1
It's abs encoder
can you help me check it, pls?

thank you very much
Last edit: 06 May 2021 09:29 by nhanpham.

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

More
06 May 2021 10:34 #208085 by andypugh
Replied by andypugh on topic SSI ABS Encoder
It sounds like the encoder wrap handling is going wrong.

Does the encoder actually do more than one revolution in use? If not then you could try setting the "m" (multi-turn) flag in the config string.

The code that handles absolute encoders is actually re-used smart-serial code:
github.com/LinuxCNC/linuxcnc/blob/master...mot2/sserial.c#L1980

I am a bit surprised that the wrap happens at 3072, though. I would expect it at 2048.
The following user(s) said Thank You: nhanpham

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

More
06 May 2021 11:32 - 06 May 2021 11:33 #208090 by nhanpham
Replied by nhanpham on topic SSI ABS Encoder

It sounds like the encoder wrap handling is going wrong.

Does the encoder actually do more than one revolution in use? If not then you could try setting the "m" (multi-turn) flag in the config string.

The code that handles absolute encoders is actually re-used smart-serial code:
github.com/LinuxCNC/linuxcnc/blob/master...mot2/sserial.c#L1980

I am a bit surprised that the wrap happens at 3072, though. I would expect it at 2048.


Yes, it happens at 3072, about 1/4 one revolution.
my encoder is sigle-turn. I tried setting the 'm' code but it doesn't help.
Last edit: 06 May 2021 11:33 by nhanpham.

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

More
06 May 2021 11:36 - 06 May 2021 11:46 #208091 by nhanpham
Replied by nhanpham on topic SSI ABS Encoder

It sounds like the encoder wrap handling is going wrong.

Does the encoder actually do more than one revolution in use? If not then you could try setting the "m" (multi-turn) flag in the config string.

The code that handles absolute encoders is actually re-used smart-serial code:
github.com/LinuxCNC/linuxcnc/blob/master...mot2/sserial.c#L1980

I am a bit surprised that the wrap happens at 3072, though. I would expect it at 2048.

loadrt hm2_eth board_ip = "10.10.10.10" config = "ssi_chan_0 = steps% 4bzencoder% 12e num_encoders = 1 num_pwmgens = 0 num_stepgens = 4 enable_raw" 
setp hm2_7i80.0.dpll.02.timer-us -120
setp hm2_7i80.0.ssi.00.frequency-khz 300
setp hm2_7i80.0.ssi.00.timer-number 2
setp hm2_7i80.0.ssi.00.zencoder.scale 535
#setp hm2_7i80.0.ssi.00.zencoder.index-enable 0
setp hm2_7i80.0.ssi.00.zencoder.counts-per-rev 4095
net z-pos-fbss <= hm2_7i80.0.ssi.00.zencoder.position
#net z-pos-fb => joint.2.motor-pos-fb
net z-pos-rawcountsww <= hm2_7i80.0.ssi.00.zencoder.rawcounts
net J2pos => joint.2.motor-pos-fb

is My setting correct?
Last edit: 06 May 2021 11:46 by nhanpham.

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

More
06 May 2021 12:56 #208097 by andypugh
Replied by andypugh on topic SSI ABS Encoder
counts-per-rev should probably be 4096. But that isn't the problem.

Setting it to a much larger number might be an interesting experiment, though.

Is there any way to see the raw data from the encoder? if no-wrap is active then the driver doesn't do very much with the data that comes back. Is it possible that what you see is the actual numbers from the encoder?

I think you can use "enable_raw" in the loadrt hostmot2 line of the hal and peek at the actual register values on the FPGA.

linuxcnc.org/docs/2.8/html/man/man9/hostmot2.9.html#Raw%20Mode

I have attached the hostmot2 register map so that you know where to look.
Attachments:

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

More
06 May 2021 13:01 #208099 by andypugh
Replied by andypugh on topic SSI ABS Encoder
Specifically this bit..
SSI Data Register0, right justifed. Writes to this location will start a
read cycle for the specific SSI interface addressed 

0x6900 SSI data register0 channel 0
0x6904 SSI data register0 channel 1
0x6908 SSI data register0 channel 2
0x690C SSI data register0 channel 3
...

0x6A00 SSI data register1 channel 0
0x6A04 SSI data register1 channel 1
0x6A08 SSI data register1 channel 2
0x6A0C SSI data register1 channel 3

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

More
06 May 2021 13:29 #208105 by nhanpham
Replied by nhanpham on topic SSI ABS Encoder

counts-per-rev should probably be 4096. But that isn't the problem.

Setting it to a much larger number might be an interesting experiment, though.

Is there any way to see the raw data from the encoder? if no-wrap is active then the driver doesn't do very much with the data that comes back. Is it possible that what you see is the actual numbers from the encoder?

I think you can use "enable_raw" in the loadrt hostmot2 line of the hal and peek at the actual register values on the FPGA.

linuxcnc.org/docs/2.8/html/man/man9/hostmot2.9.html#Raw%20Mode

I have attached the hostmot2 register map so that you know where to look.


i have used an oscilloscope to see data. it returns a correct value from 0->4095

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

More
06 May 2021 13:39 - 06 May 2021 13:42 #208106 by PCW
Replied by PCW on topic SSI ABS Encoder
Sounds like the data is corrupted/shifted
inverted clock maybe?

Andys raw read suggestion is good

For debugging, its important to see what the FPGA reads
Last edit: 06 May 2021 13:42 by PCW.

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

More
06 May 2021 14:01 #208112 by nhanpham
Replied by nhanpham on topic SSI ABS Encoder

Specifically this bit..
SSI Data Register0, right justifed. Writes to this location will start a
read cycle for the specific SSI interface addressed 

0x6900 SSI data register0 channel 0
0x6904 SSI data register0 channel 1
0x6908 SSI data register0 channel 2
0x690C SSI data register0 channel 3
...

0x6A00 SSI data register1 channel 0
0x6A04 SSI data register1 channel 1
0x6A08 SSI data register1 channel 2
0x6A0C SSI data register1 channel 3


Is it correct?
setp hm2_7i80.0.raw.read_address 0x6900 
show pin hm2_7i80.0.read_data

The values return from 0x0000000->0x0000ffff for 0->4096

thank you for your helping

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

More
06 May 2021 14:14 #208116 by PCW
Replied by PCW on topic SSI ABS Encoder
What does hm2_7i80.0.ssi.00.zencoder.rawcounts
show?

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

Time to create page: 0.095 seconds
Powered by Kunena Forum