spi-fpga-driver icon indicating copy to clipboard operation
spi-fpga-driver copied to clipboard

stepper noise

Open dagrende opened this issue 7 years ago • 5 comments

At last, 1.5years after getting spi-fpga-driver running, I have time to set up my heavy mill with it. It works, but produces a terrible noise when running. There is a lot of inertia in the machine, so any timing issue may make the machine miss a step and lose precision. I hear interference sound when jogging the axes. Do I have a mis-configuration?

I use the verilog code unchanged, but with alternate pin assignments for the fpga board I use.

I attached my config files with .txt appended to the name to make github accept the files as attachments. The files are not complete with all homing config etc.

Regards, Dag

pluto_mm.ini.txt pluto_pinout.hal.txt

dagrende avatar May 08 '17 18:05 dagrende

I forgot to say that I run it on a RaspberryPi 2, and a 50MHz Altera Max II epm570t100c5n fpga.

dagrende avatar May 09 '17 11:05 dagrende

@dagrende Hi Dag,

some questions about your setup:

Do you use level shifter between the cpld and your stepper driver? How long is the spi cable?

And please verify which pin of the cpld is connected with the output of the oscillator. As I remember in your case it was pin 64 in the .pin file. In my case it's pin 12. Maybe you should change it.

Regards Matsche

tinkercnc avatar May 15 '17 12:05 tinkercnc

Hi!

  • I use one level shifter 74LVC245 from 3.3 to 5V for outputs (step, dir), and one from 5V to 3.3V for inputs (home switches).
  • SPI from RPI to CPLD using 20 cm patch cables
  • I doubt that pin 12 (GCLK0) is different from pin 64 (GCLK3) they seem to be equivalent and accessible to the whole CPLD (http://www.mouser.com/ds/2/612/max2_mii5v1-1098992.pdf page 2-17).

I use card http://www.elecfreaks.com/store/images/Dev_CPLD_EPM240_mini_01.jpg and the on-board 50MHz clock is hard-wired to pin 64 http://www.elecfreaks.com/store/images/product_images/Dev%20platform/FPGA/Dev_CPLD_EPM240_mini_02.jpg

When I jog quite slowly, the stepper pulses makes a small pause or short acceleration sometimes. It is like the RPI couldn't feed the SPI constantly. Its the same in both directions. I have varied the times in

setp pluto-step-rpspi.stepgen.steplen 20000 setp pluto-step-rpspi.stepgen.stepspace 20000 setp pluto-step-rpspi.stepgen.dirtime 20000

and there are differences, but I haven't had time to do it systematically. I may look at the pulses on my scope. I have tried a BBB with the same level shifters, and it runs smooth and stable using the built in RTU for pulse generation. But the BBB has too many problems to be a good alternative (slow user interface, keyboard delays, reset on startup problems, strange connectors, ...). This should indicate that the level shifter specs is not the problem here.

/Dag

dagrende avatar May 16 '17 05:05 dagrende

@dagrende Ok, next questions. :)

Which kernel do you use? (uname -a) Is the spidev driver disabled? (no /dev/spixxx device) And please post your kernel cmdline.

matsche

tinkercnc avatar May 16 '17 17:05 tinkercnc

uname -a Linux machinekit 3.18.11-rt5+ #45 SMP PREEMPT RT Thu Apr 9 17:56:25 SGT 2015 armv7l GNU/Linux

cat /boot/cmdline.txt dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0 dwc_otg.nak_holdoff=0 root=/dev/mmcblk0p2 rw rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 elevator=noop

But I had no /dev/spidev! I edited /boot/config.txt and uncommented device_tree_param=spi=on but no spidev. I changed it to dtparam=spi=on no change. I noted that lsmod showed no spi_bcm2708. So I did sudo modprobe spi_bcw2708 Now I got /dev/spidev0.0 and /dev/spidev0.1. I tested machinekit but there was no hearable difference. And no spidev after reboot.

Any hints?

Maybe the machine works properly. But when I jog there are still some hickups from time to time, that sounds like timing issues that may make the steppers miss steps.

/Dag

dagrende avatar May 19 '17 18:05 dagrende