- build_bladerf.sh
- bladerf.tcl
Make sure quartus_sh is in your path and run:
$ cd hdl/quartus ; ./build_bladerf.sh
Should generate the appropriate Qsys synthesis files as well
as build the FPGA image.
Current FPGA image fails timing due to clock constraints
feeding into the SignalTap block.
This commit adds UART packet protocol support for the Si5338 on the Nios 2.
Since the Si5338 sits on an I2C bus, the Nios firmware intializes the I2C core
as well.
This commit replaces support for the 15KLE board in favor of the pre-production
40KLE board. Commits from this point on are not guranteed and are likely to not
work with the prototype boards.
Enabling debug_line_speed causes the FPGA to toggle RX and TX DMA pins that go
the FX3 so that it can determine the maximum read and write speeds. The FPGA
does this without driving the GPIF bus.
These variables control if an RX or TX transaction can occur (can_perform_*) due
to FIFO requirements being met. Should_perform_* determines if it is fair for
that particular operation to execute, ie. it is not fair to the RX queue if the
TX queue uses the GPIF bus twice in a row if the RX queue has data pending.
However, if there is no RX data pending, it is fair for the TX queue to use two
subsequent GPIF bus time slots.
This commit includes massive changes to the firmware running on the Nios 2 core
in the FPGA. The Nios 2 core will respond to UART requests sent to it from the
FX3 and it will turn them into SPI, I2C, and GPIO reads and writes based on the
uart "packet".
The UART protocol employed by the FX3 and Nios 2 Core is as follows:
Byte 0) "Magic" byte is 'N'
Byte 1) Indicates the direction and intended device of each subsequent
operation. Count is number of struct uart_cmd data structures that
will be transferred.
// | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |$
// | dir | dev | cnt |$
Byte 2..N) The following byte pairs are struct uart_cmd, which consist of
addresses and values;
struct uart_cmd {$
unsigned char addr;$
unsigned char data;$
};$
As an example, if you are looking to write 0xC0 to register 0x30 on the Si5338,
the UART packet you would have to send would have to look like this:
Byte 0) 'N'
Byte 1) UART_PKT_MODE_DIR_WRITE | UART_PKT_DEV_SI5338 | 0x01;$
Byte 2) 0x30$
Byte 3) 0xC0$
The RX fifo is a 32bit, 1024 element, dual clock domain FIFO.
The TX fifo is a 32bit, 4096 element, dual clock domain FIFO.
These values are the lowest values worked across all of the performance tests.
This should include everything needed to build the FSK bridge example from scratch.
1) Open existing hdl/quartus/bladerf.qsf project in Quartus
a) Generate the Nios core
i) Tools -> QSys -> File -> Open -> navigate to ./hdl/fpga/ip/altera/nios_system/nios_system.qsys
ii) After opening qsys file, go to Generation tab, click the "Generate" button
b) Compile the embedded Nios image
i) Tools -> Nios II Software Build Tools for Eclipse
I) File -> Import -> General -> Existing Projects into Workspace -> Next
-> Browse to checkout root directory -> check both lms_spi_controller and lms_spi_controller_bsp
-> Finish
II) right click lms_spi_controller_bsp -> NIOS II -> Generate BSP
III) right click lms_spi_controller -> Build
IV) right click lms_spi_controller -> Make Targets -> Build... -> select mem_init_generate -> Build
c) Synthesize FPGA image
i) Processing -> Start Compilation
2) Compile driver and user mode applications
a) cd linux/kernel ; make ; inmod bladeRF.ko
b) cd ../apps; make
c) To program the fpga execute ./simple_load c4images/blink.rbf
i) Load bladerf.rbf from the quartus output_files directory
3) Use bladeRF's UART as an FSK bridge!
NB. The firmware upgrade utility does work, only use it on valid .img files.