Writing code to enable stepper motor drivers to be used

Hi,

I am a total newbie on FPGA, I have purchased a Logi-PI and an Arduino CNC board and want to initially implement 4 x NCOs to control the stepper motors, with the Raspberry Pi handling all the high level stuff and the FPGA doing all the time critical control.

Initially I will use DRV8825 StepSticks with the CNC board to learn more about FPGA and once that is working I need to migrate to TMC2130 SilentStepSticks which require SPI to set up each of these individually.

So far I have tried a number of the Apps from the repo and they all work, I have also watched quite a number of youtube videos and am very slowly learning how VHDL / Verilog work, it has been a long time since I played around at the gate level!

Ideally the NCO can generate a pulse duration that can be set, rather than a duty cycle.

I will also need to consider how an end-stop for a stepper motor would interact with the NCO to freeze the STEP pulse generation (could be a simple AND gate on the output of the NCO).

Has anyone done this before (don't want to reinvent the wheel) and/or does anyone have any pointers / advice / code that I can try to increase my understanding of how to achieve this.

Note:  I am a contributor to the http://www.smoothieware.org project and in the long term want to port Smoothie to Raspberry Pi + Logo-Pi + customer driver board.

Cheers
Douglas

Comments

  • Hi Snuffles. 

    Sounds like a nice project.  In terms of interacting between the FPGA and Rpi I would recommend getting familiar with the logi-wishbone project.  It is the simplest way to communicate expand the use of many number of peripherals such as your stepper drivers.  You can examine the code to see how you "wrap"  and address your peripherals to send and receive commands. 

    It sounds like you will be using external discrete drivers, but in case you are interested hamster has some code and is a great resource if you have specific questions to the implementation. 
    http://hamsterworks.co.nz/mediawiki/index.php/Stepper

    Hope this helps. 



  • Hi,

    I have worked my way through some of the logo-wishbone project and it looks nice and simple.

    Mikes work is very interesting (and a fellow Kiwi :-) ), and I will contact him via email.

    Also, does anyone use cores from Opencores.org where there are several NCO implementations? I intent to will try some of those (and SPI and lots of other good stuff).

    I also came across Kactus2 https://sourceforge.net/projects/kactus2/?source=navbar , search for this on youtube for Kactus2 as IMHO the tool looks which looks very interesting, could this be used with Logi-Pi, if so how would one set it up so it knows about the Logi-Pi set up?

    Lastly, I was very interested in the Skeleton tool, is it possible to add your own components (SPI, NCO, etc)?

    Cheers
    Douglas
Sign In or Register to comment.