7i96S mesa_modbus encoder count interference

More
2 years 5 months ago - 2 years 5 months ago #301468 by somuchforfree
Hello,

we have set up an MPG jog wheel on the encoder on our 7i96S' TB2 pins 7 - 11 which works really well except it sometimes "misses" 1 or 2 increments of a full rotation but other than that it's been a real pleasure to use after getting it set up...

Yesterday we wanted to add Modbus to read the spindle load from our VFD. So we got an Arduino and an RS485 transceiver board out, wrote a little sketch to read an analog input, tested it with a USB - RS485 adapter, worked beautifully, so far, so good.
Flashed the 7i96sd_pktv2.bin, compiled our own little mesa_modbus component reading one value, didn't get it to work at first, so we tried the 7i96sd_pkt.bin, didn't make much of a difference. So we got the scope out and eventually fixed several small mistakes including but not limited to slave address 0 instead of 1 and swapping A/B on the RS485 transceiver... maybe it was a little too late in the night early in the morning for ambitious projects ;)
One scale component and a little fiddling around in the HAL later and we got a working spindle load indicator.

So we home the machine and the machine starts jogging on its own. A peek into halshow tells us that the encoder count is rapidly decreasing and going into large negative numbers. At first I thought I fried something while doing late night wiring hack jobs but just by disabling our mesa_modbus component, the spook was gone and we could reliably jog the machine without any problems.

Going out on a few limbs here, could the mesa_modbus component somehow write into a memory region where the encoder stores info on its count?



P. S. Andy, thank you for your work on the mesa_modbus component! Surprisingly quick setup and much less of a pain than expected :) We might write up a little tutorial once we got the whole thing working.
Last edit: 2 years 5 months ago by somuchforfree. Reason: spelling

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

More
2 years 5 months ago #301477 by PCW
Is it possibly just noise related?
that is, what happens if you set:

setp hm2_7i96s.0.encoder.00.filter true
setp hm2_7i96s.0.encoder.sample-frequency 100000

 
The following user(s) said Thank You: somuchforfree

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

More
2 years 5 months ago #301483 by somuchforfree
Thanks for the quick reply! Will test and report back but enabling/disabling the mesa_modbus was the only thing we changed, nothing else. Wiring stayed the same.

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

More
2 years 5 months ago #301485 by PCW
There reason I suspected electrical interference/ too fast encoder filter settings
is that you said the MPG missed counts and that the encoder appears to count,

 (a memory overlap would not be likely to count (slew) but rather have crazy numbers)
 

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

More
2 years 5 months ago #301492 by somuchforfree
I re-enabled the mesa_modbus component.
The encoder seems to jump on every update. update-rate 1 Hz will jump every second, 0.5 once every two seconds, etc...

If I set the update-hz in the HAL to anything but 0, it will jump around. Changing it in halshow to 0 or a different value doesn't help, it will change the rate at which it's jumping but it will never stop.

If I set the update-hz in the HAL to 0 or leave it unset, it jumps around at first, but I can set it to something else and it won't jump around. Setting it back to 0 makes it jump again.

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

More
2 years 5 months ago - 2 years 5 months ago #301493 by somuchforfree
Actually I think found a fix for our problem.

Putting the setp for the update-hz after the loadrt scale count=2 makes it work. Moving it up one line so it's right before it makes it break.
Code:
loadrt spindle-load ports=hm2_7i96s.0.pktuart.0 setp spindle-load.00.address 1 setp spindle-load.00.baudrate 9600 setp spindle-load.00.rxdelay 255 setp spindle-load.00.txdelay 10 addf spindle-load.00 servo-thread loadrt scale count=2 setp spindle-load.00.update-hz 10
Last edit: 2 years 5 months ago by somuchforfree. Reason: added snippet

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

Time to create page: 0.072 seconds
Powered by Kunena Forum