The last weeks, I have been doing experiments to see if I can replace the programmable realtime unit on the Beaglebone with a FPGA. On the Beaglebone, there are two programmable real time units, which are very similar to micro-controllers, running at 200 MHZ with 8K byte memory per core and 12K byte shared between them. At the moment, I use one PRU and one memory of 8K byte which acts as a ring buffer.

There are some challenges with the current design. I am locked into the AM335x processor which runs at 1 GHz and is single core. The latest Raspberry 4 runs at 1.5 GHz and is quad core.

If I am able to build an extension for the Raspberry it would not be hard to use the scanner with other boards, e.g. the edge TPU or the NVidia nano.

When I started this project, I actually tried to do this with the Spartan 6 FPGA, using the Xula-LX25.

In the end, I managed to get something to work by writing the laser data to a sdram and then reading this data from the sdram. This was all written in MyHDL, see Github.

MyHDL is converted to verilog and this can then be converted to a bitstream by the Xilinx Ise.

In my latest experiments, I used the IceZero with the ICE40HX4K and Migen. The oscillator on the Icezero runs at 100 MHz and the ICE40HX4k has 81920 bits of memory. In practice, the memory is larger as the Icestorm toolchain is able to program the ICE40HX4k as a ICE40HX8k.

The ICE40HX8k is a lot less powerful than the Spartan 6. It has 1/6 of the SRAM memory and 1/3 of the LUT. The main advantage for me is the open source icestorm toolchain which runs on linux.

My current setup works as follows. Data is streamed to the FPGA via SPI and stored on the FPGA using the internal SRAM. The sram is used as a buffer before the data is placed on the substrate with the laser. My code can be found here, especially look at the spimemmap example.

I did some experiments on the Raspberry 3 using Python and Spidev and I am able to get data rates up to 25 megabit per second.

In my current laser head, the scan line is 8 mm long and a pixel is 10 micrometers. So there are roughly 800 pixels per line, i.e 100 byte per line. At 20.000 RPM * 4 (facets)/ 60 = 1333 lines per second. This implies 133 kB/s or 1 megabit per second, much less than 25 megabit per second.

Another problem, I am still working on is balancing the prism. I hope to report some progress on that soon.

What might be of interest is that MIT recently released a press statement in which they show that they are working with lasers and ultrasound. The technology is very similar to my previous blog post. The only difference is that they use a laser to detect the vibrations.

Another interesting was one by blog the drive. There apparently is a Dutch startup which use lasers to clean railway tracks.