Novena/Fpga

From Studio Kousagi Wiki
Revision as of 08:40, 27 March 2014 by Xobs (talk | contribs) (Created page with "Novena contains an LX45 attached to several buses, namely EIM, SPI, and I2C. It is configured by writing a .bit file over SPI. ==Development== For development, it is common to...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Novena contains an LX45 attached to several buses, namely EIM, SPI, and I2C. It is configured by writing a .bit file over SPI.

Development

For development, it is common to directly bitbang the hardware. Given a bitstream file "novena_fpga.bit", configure the FPGA by running:

sudo rmmod kosagi-fpga-driver
echo 135 | sudo tee /sys/class/gpio/export 2> /dev/null
echo out | sudo tee /sys/class/gpio/gpio135/direction 2> /dev/null
# Flip reset
echo 0 | sudo tee /sys/class/gpio/gpio135/value 2> /dev/null
echo 1 | sudo tee /sys/class/gpio/gpio135/value 2> /dev/null
sudo dd if=novena_fpga.bit of=/dev/spidev2.0 bs=128
# Turn on FPGA clock
sudo ./devmem2 0x020c8160 w 0x00000D2B

Production

For production, wrap everything up in a kernel module. An example of a driver is at https://github.com/xobs/novena-scope-drivers/blob/master/kernel/kosagi-fpga-kernel.c