Encoders setup

More
06 Aug 2016 21:46 - 06 Aug 2016 23:14 #78419 by barsam
Encoders setup was created by barsam
Hello Everyone.

This is my first post at the forum as I am new to the world of linuxcnc.
Lately I converted an Optimum BF20 to CNC and while I had setup everything to work with Mach3, as this is the software I have used for my other CNC machines, I decided that it was time to try linuxcnc for this one.
Since all the electronics were already there, I decided just to swap the smoothstepper with a Mesa 7i80 board.
So the setup at the moment is: 7i80 as a controller, PMDX-126 as a breakout board, and a C53 from CNC4PC as an encoder’s board.
I have used the C53 for my CNC router and I am very happy with it, so that is why I got this one again.
For encoders I have used some self-made boards using the AS5311 IC and magnetic strips.
So far I have managed to make a custom firmware for the mesa board to use the existing boards and the PDMX-126 seems to be fully functional. But after straggling for couple of days, I was not able to get a feedback from the encoders board.
I have checked everything related to hardware and all looks fine. The encoder board is pulsing at the controller side (checked with oscilloscope), so the problem is either the firmware of 7i80 or the setup of linuxcnc.
I have run out of ideas and since this HAL setup thing is totally new to me, I will need some help from experts.
Attached I have the VHD file (changed to txt extension) of my custom firmware and the HAL file of the linuxcnc setup.


File Attachment:

File Name: BF20.hal
File Size:14 KB


File Attachment:

File Name: PIN_PDMX_C53_68.txt
File Size:12 KB
Attachments:
Last edit: 06 Aug 2016 23:14 by barsam.

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

More
06 Aug 2016 23:46 #78421 by PCW
Replied by PCW on topic Encoders setup
Sounds like a wiring issue of some kind, i would check that the encoder a,b,index pins change as expected
if you ground the FPGA pins (they have pullups so will be high if not driven)

encoder channel 0's pins should be named:

hm2_7i80.0.encoder.00.input-a
hm2_7i80.0.encoder.00.input-b
hm2_7i80.0.encoder.00.input-index

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

More
07 Aug 2016 21:07 #78460 by barsam
Replied by barsam on topic Encoders setup
Thank you for your replay.
As I mentioned on my first post, I had checked all the connections and everything was fine. Never the less, I re-checked today and I confirmed, using a digital logic analyser this time, that the signals are getting to the connector of the 7i80 board. Of course I should mention that the check was done while the connector was not connected to the 7i80 board. Checking the signals while the connector is plug, is king of difficult without un-mounting the board.
One thing I don't understand though is what do you mean by saying;

“encoder channel 0's pins should be named:

hm2_7i80.0.encoder.00.input-a
hm2_7i80.0.encoder.00.input-b
hm2_7i80.0.encoder.00.input-index”?

I can see that these are pins in the HAL configuration, but should I mention them somewhere in the HAL file?

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

More
07 Aug 2016 23:10 - 07 Aug 2016 23:10 #78465 by PCW
Replied by PCW on topic Encoders setup
No, but if you use LinuxCNC "watch" menu and ground the appropriate DB25 pins, you can check that your encoder inputs are in the expected places
Last edit: 07 Aug 2016 23:10 by PCW.

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

More
09 Aug 2016 09:03 #78513 by andypugh
Replied by andypugh on topic Encoders setup

One thing I don't understand though is what do you mean by saying;
“encoder channel 0's pins should be named:

hm2_7i80.0.encoder.00.input-a
hm2_7i80.0.encoder.00.input-b
hm2_7i80.0.encoder.00.input-index”?

I can see that these are pins in the HAL configuration, but should I mention them somewhere in the HAL file?


No, you don't use them in HAL, but you should be able to watch them with Halscope:
linuxcnc.org/docs/2.7/html/hal/tutorial....ec:tutorial-halscope

You should also be able to watch the hm2_7i80.0.encoder,00.counts HAL pin in Halscope and see if there is any activity there.

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

More
09 Aug 2016 09:42 #78517 by barsam
Replied by barsam on topic Encoders setup
I finally managed to find the cause of the problem.
The C53 board has pull-up resistors for all the input signals, which in combination with the pull-up resistors of the Mesa board are blocking the signals.
I removed all the resistors from the C53 board and the signals are now passing.
Of course I am faced with a different issue now. The position of the encoder is not consistent with the stepper position. And it is not because of the scale. Going back and forth, it seems like the position of the encoder is different every time.
I am not sure if this is because of noise, missed pulses, or misaligned encoders.

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

More
09 Aug 2016 10:40 - 09 Aug 2016 10:41 #78518 by andypugh
Replied by andypugh on topic Encoders setup
There is a HAL pin that reports quadrature error.

github.com/LinuxCNC/linuxcnc/blob/master...tmot2/encoder.c#L503

You could try enabling that to see if the encoder pulses are consistent.

(I gave a link to the source-code because the pins do not seem to be mentioned in the documentation)
Last edit: 09 Aug 2016 10:41 by andypugh.

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

More
09 Aug 2016 15:33 - 09 Aug 2016 15:34 #78534 by PCW
Replied by PCW on topic Encoders setup
The additional weak (4.7K) pullups on the 7I80 inputs will not hurt anything.
it sounds like the (probably much stiffer) pullups on the C53 board encoder outputs
were not powered. I suspect they need a 5V power source (pin 26?)
Last edit: 09 Aug 2016 15:34 by PCW.

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

More
11 Aug 2016 16:36 - 11 Aug 2016 16:37 #78630 by barsam
Replied by barsam on topic Encoders setup
The signal issue was indeed the pull-up resistors, and after speaking also with Arturo from CNC4PC he confirmed that these resistors are there for the Smoothstepper, as it is not IEEE1284 compatible. As for the power, it is not an issue because it has a separate power supply path in case pin 26 cannot be used (the case of mesa board).
But although the electrical part is resolved and the signals are passing to 7i80 the problem of missed counts still exists. Yesterday and today I went to whole lot of trouble replacing the encoders with some rotary encoders I have because I was convinced that the DIY encoders are not working properly, only to find out that the problem is not the encoders.
It was a lot of surprise for me to find out that the problem is actually the count frequency. When I reduce the jog speed to 50mm/min the count is as it should be. At 100mm/min counts are starting to be missed.
I am pretty sure it is not the encoder board, as I have the exact same one on my CNC router with a smoothstepper and I can get up to 6000mm/min without loosing a single count from the encoders. Of course someone would ask how many counts per unit for each encoder…
The ones on the CNC router have a 400counts per mm and the ones I tested on the other setup are 512 per unit, so no big difference there.
I can not believe that the setup I have with the 7i80 as a controller can not handle these kind of speeds, even an arduino nano can…
So I am sure I have done something wrong with the configuration of linuxcnc.
Any idea? So that I can close this issue once for all.
Last edit: 11 Aug 2016 16:37 by barsam.

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

More
11 Aug 2016 16:52 #78631 by PCW
Replied by PCW on topic Encoders setup
The 7I80- can count encoder counts up to about 25 MHz (filter off) so its not likely
to be the issue.

If you removed the breakout board pullups you now only have
the fairly weak 4.7K pullups on the 7I80 so this _will_ limit your
maximum count rate. (for the BOBs stated 10 MHz count rate
you would need close to 300 Ohm pullups)

Count errors may also be because of signal integrity issues so you might try
enabling the encoder filter and/or lowering the encoder sample rate

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

Time to create page: 0.100 seconds
Powered by Kunena Forum