bdring / Grbl_Esp32

A port of Grbl CNC Firmware for ESP32
GNU General Public License v3.0
1.71k stars 532 forks source link

FPGA cnc control #858

Open hstarmans opened 3 years ago

hstarmans commented 3 years ago

Hey all,

I am working on controlling motors with a FPGA. You can see my working setup here . The video is not the greatest but it shows where I am at. Code for the FPGA core can be found here FPGAG. I have tried to made the code as readable as possible and separate it into logical units. You can also virtually test the core using test virtual. The code is written in python and gets converted to verilog/vhdl using nmigen. Yosys/Nextpnr translate the code to the ICE FPGA chip. FPGAs offer a lot of advantages. The motors are sampled at 1 MHz and the maximum pulse frequency is 500 KHz. This can, however, be changed. The max I can reach now is probably 25 MHz. I am mainly interested in FPGAs as I am building a laser scanner. Which brings me to your project.. you should probably start thinking about using FPGAs and put it on the road map somewhere. It is quite a paradigm shift from most embedded projects around micro-controllers, C++ and assembly. My board can be found online, I also found someone, sensile; who developed a board with a newer FPGA chip and a microcontroller see photo and his repo here .

The software consists out of the following elements;

I did not implement Bezier curves as there are no hardware multipliers on the ice chip I use. Bezier might have an advantage as you send over real positions and as such it might be easier to correct for errors. The advantage of polynomial is that there is more direct link with speed and acceleration. My current focus is on getting a laser scanner working with this framework. For this specific application there is no need to have a GCode parser. I hope at least you find some inspiration or better direction for steps to take next from my code.

Best,

Rik

MitchBradley commented 3 years ago

You probably already know this but Raspberry Pi 4 has an FPGA that drives the GPIOs. That might make a nice deployment platform.

hstarmans commented 3 years ago

Mitch, I am not aware of a FPGA already present on the Raspberry pi 4. I know a Zynqberry exists, which is similar to a Raspberry which does have a FPGA on the board.

MitchBradley commented 3 years ago

It seems like that announcement about an FPGA on the Pi 4 was an April's Fools joke. https://www.mickmake.com/post/the-raspberry-pi-4-has-landed-a-sneak-peak-prototype-review/ Looks like I got fooled. The [April Fools] tag was omitted in the early posts. The joke seems to have been pretty elaborate based on the FPGA programming tools shown in the directory listings.

atlaste commented 3 years ago

The more serious MESA cards for LinuxCNC do have FPGA support.

chenleigang commented 2 years ago

This is a very good project. Although I can't understand it, I still like it very much

hstarmans commented 2 years ago

thank @chenleigang, I am actually replacing my motors with PCB motors. This will make the tech a lot cheaper and more accessible. I am working on replacing the raspberry pi with a ESP32. So this would also make it easier to integrate it with even this esp32 project.