Commit graph

50 commits

Author SHA1 Message Date
jynik
3b12e400a2 Update README
Fixed typo in README
2013-06-15 21:53:00 -04:00
Robert Ghilduta
f8e78fba46 libbladeRF: driver: add host software support for GPIO over UART bridge 2013-06-09 23:03:28 -07:00
Robert Ghilduta
3843d1909e libbladeRF: add FPGA programming support 2013-06-09 23:03:27 -07:00
Robert Ghilduta
5c41729ac3 libbladeRF: add support for LMS6002D
This commit introduces LMS library support for controlling the LimeMicro
LMS6002D transceiver. The LMS library functions were originally developed by
bpadalino.
2013-06-04 20:22:59 -07:00
Robert Ghilduta
b49d9fe7d2 cli: make the cli app be conditionally compiled to be interactive 2013-06-09 22:58:35 -07:00
jon
2f9dc744a2 cli: Initial skeleton of CLI program 2013-06-09 22:58:34 -07:00
jon
c2e3c54422 apps: Added hooks to build without 'make install'-ing libbladeRF 2013-06-09 22:58:33 -07:00
jon
7f22b26f7d libbladeRF/apps: Moving cli build to apps/
This is the first commit in a set of upcoming changes that will
move functionality from simple_load and upgrade_firmware into the
libbladeRF library and provide access to these routines through a
bladeRF cli.

Don't merge from jon-dev until I get this straightened out, or
you'll be left with something possibly unusable...
2013-06-09 22:58:32 -07:00
jon
aad9e99bfb libbladeRF: 'make install' now prints what it's executing to install 2013-06-09 22:58:31 -07:00
Robert Ghilduta
e467bdf85a libbladeRF: add Si5338 support
This commit introduces support for controlling the on-board programmable PLL and
clock distribution Si5338 chip.
2013-06-04 20:42:06 -07:00
jon
cbad06a5a1 libbladeRF: More lib renaming & fixes for tempoarary (un)install targets 2013-06-09 22:58:18 -07:00
jon
7ccd37aa7d libbladeRF: header and lib renamed to libbladeRF. Minor fixes added.
Fixed bladerf_get_device_list return value for condition where no
devices are attached. (Now returns 0, previously returned -1).

Also added a missing catch of a malloc failure and now return appropriate
error value.
2013-06-09 22:58:17 -07:00
Robert Ghilduta
dc187e0640 FX3 Firmware: Supports Command-line build (GNU make, linux)
The build for Windows + Eclipse is likely now broken. Fixing this
is a TODO item on my list...
2013-06-09 22:58:10 -07:00
jon
5a7b8a253d libbladeRF: Makefile now creates and installs libbladerf.pc 2013-06-09 22:58:06 -07:00
jon
2807d5d3fe libbladeRF: Added header inclusion guards and cplusplus check. Fixed 'make uninstall' 2013-06-09 22:58:05 -07:00
jon
95c2c3db70 libbladeRF: Added stubs for fetching FPGA version info. 2013-06-09 22:58:05 -07:00
jon
ca35519b34 libbladeRF: Added calls to fetch some device info, and did a bit of cleanup. 2013-06-09 22:58:04 -07:00
jon
52a3d834ea libbladeRF: Removed duplicate bladerf_flash_firmware() from header and erroneous #include 2013-06-09 22:58:03 -07:00
jon
bffd52e1f5 libbladeRF: Implemented bladerf_get_device_list(). Removed missing logo from Doxygen
With these changes, the cli can be used to probe for attached bladeRF
devices on the system, assuming the user has r/w on the /dev/bladeRF
nodes.
2013-06-09 22:58:02 -07:00
jon
9773679fd2 libbladeRF: Added cli program to build for testing and debugging 2013-06-09 22:58:01 -07:00
jon
709d2d0fdc libbladeRF: Changed default include path to include ../../common
This will make things slightly less of a pain in the butt for the
time being. Someone remind me to fix this later.
2013-06-09 22:58:00 -07:00
jon
ff772abcf4 libbladeRF: Move bladerf_stats to public header, added fn to obtain these. 2013-06-09 22:57:59 -07:00
jon
99f12fadd3 libbladerRF: [Non-functional] Added stubs for libbladerf.
Jon's TODO items in the following commits will include:
 - Implementing the init/deinit functions
 - Implementing the device info and programming functions
 - Integrating ../app items into this lib
 - Adding libbladerf support to gr-osmosdr
2013-06-09 22:57:58 -07:00
Robert Ghilduta
c4df843dff hdl: nios: add UART-packet support for GPIO control
This commit introduces support for controlling the GPIO controller via the
FX3<->FPGA UART bridge.
2013-06-09 22:57:53 -07:00
Robert Ghilduta
2d3e1308e9 hdl: add GPIO controller to NiOS
The GPIO controller will allow the driver and usermode applications to control
the RX and TX RF switches, and the LMS control pins.
2013-06-09 22:57:42 -07:00
Brian Padalino
d6f30c22d3 hdl: added two convenience build scripts
- 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.
2013-06-09 22:45:31 -07:00
Robert Ghilduta
cf789f1dda hdl: minor BSP path fixup 2013-06-09 22:40:34 -07:00
Robert Ghilduta
a1ef2ab5ac fx3 firmware: clear out DMA buffers
This commit clears DMA buffers and reset endpoints whenever RX or TX are
disabled.
2013-06-02 23:57:38 -07:00
Robert Ghilduta
22cccf485a fx3_firmware: add GPIO_LED and GPIO_ID
GPIO_ID tells the FX3 which FPGA is attached, this is useful in case the
firmware is accidentally completely reflashed.
2013-06-02 23:57:38 -07:00
Robert Ghilduta
3ea5a05ea9 fx3 firmware: minor performance tweaks
NB: changing dmaMultiConfig.size changes the number of bytes that are sent to
the FPGA in each GPIF transaction.
2013-06-02 23:57:37 -07:00
Robert Ghilduta
42e9d4b878 fx3 firmware: enable 32bit GPIF firmware_v0.2
Due to an unconfirmed bug in the SDK's support for the GPIF II, it is not
xpossible to switch a 16bit GPIF over to 32bit funtionality once the FX3
enumerates. As a temporary work around, the firmware now uses a 32bit GPIF bus
when loading the Cyclone 4. This introduces some issues with headless execution
because enabling 32bit mode disables the SPI peripheral, which is how the FX3
communicates with the SPI flash. Conversely, in headless mode the unit has no
need to enter 32bit mode because it is not connected via USB3.0, therefore
during headless mode the bladeRF can choose to configure the GPIF 2 into 16bit
mode.
2013-06-02 23:57:36 -07:00
Robert Ghilduta
552d779567 linux driver: add support for writing to the LMS, Si5388, and the VCTCXO
This commit adds the ioctls necessary to configure the LMS, Si5338, and VCTCXO.
The FX3's second endpoint is configured to receive and transmit things over
UART. At the other end of the UART is the Nios II core in the FPGA. The Nios
core simply parses the read or write operation and sends it to the appropriate
device.

NB: At least a 16byte URB has to be sent to the FX3 for it to send data on UART
due to a minimum buffer count enforced by the GPIF's DMA controller.

The UART packet format 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$

Before sending this packet to the second endpoint, the packet would have to be
zero padded to the nearest 16 byte boundary.
2013-06-02 23:57:36 -07:00
Robert Ghilduta
10040ef56c linux driver: add RX and TX buffering
This commit adds RX and TX functionality for the bladeRF. The driver uses a ring
buffer of URBs that are allocated when the driver probe()s each bladeRF. At the
moment the driver allocates 1024 4KB URB buffers for RX and TX, meaning that
each bladeRF requires at least 8MB of RAM. The total number of allocated URBs
(NUM_DATA_URB) can be lowered when operating at USB 2.0, but the number should
be a power of 2 for the ring buffer to work.

Test read/write speeds of 320MB/s were observed with this driver on an Intel xHCI.
2013-06-02 23:57:35 -07:00
Robert Ghilduta
a16a9525c7 new USB ID
The OpenMoko project has given us a PID within their VID.

The new USB ID is:
VID 0x1d50
PID 0x6066
2013-06-02 23:57:35 -07:00
Robert Ghilduta
2c260ee6b0 hdl: add Si5338 support to the nios core
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.
2013-06-02 23:57:34 -07:00
Robert Ghilduta
398f37b159 hdl: update BSP build scripts
After Qsys modification a BSP update is necessary to ensure that the Nios 2
firmware builds correctly.
2013-06-02 23:57:34 -07:00
Brian Padalino
f83e2a1bb1 hdl: nios: enable I2C controller
This commit ties the I2C controller to the Nios 2 Core and updates the system
pinout.
2013-06-02 23:14:09 -07:00
Brian Padalino
221efe1030 hdl: add I2C controller to qsys project
This commit adds I2C controller functionality to the Nios 2 Core.
2013-06-02 23:14:09 -07:00
Brian Padalino
282e34258d quartus: add IPX file
The IPX file tells Qsys where to look for the Avalon compatible I2C controller
core.
2013-06-02 23:14:08 -07:00
Brian Padalino
11815a4404 hdl: add Avalon compatible I2C controller from OpenCores
This is a direct copy from the "I2C controller core" OpenCore project found at
http://opencores.org/project,i2c
2013-06-02 23:14:07 -07:00
Brian Padalino
8c110bb98b hdl: change from 15KLE to 40KLE part
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.
2013-06-02 23:14:06 -07:00
Robert Ghilduta
964d5ac777 hdl: add TX FIFOs and additional queueing controls
This commit expands on the previous commit and adds the TX FIFOs.

This commit also upgrades the repostiory to Quartus 12.1 along the way.
2013-06-02 23:14:05 -07:00
Robert Ghilduta
184a30d279 hdl: add TX path
This commit adds the HDL state mechanie necessary to perform TX transactions.
2013-06-02 22:28:42 -07:00
Robert Ghilduta
22f27cf949 hdl: add debug utility to conduct line speed testing of bladeRF
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.
2013-06-02 22:28:38 -07:00
Robert Ghilduta
d0f3c12d7b hdl: add can and should RX/TX
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.
2013-06-02 22:28:00 -07:00
Robert Ghilduta
9cd4329dc1 fx3: UART-SPI bridge baud rate change
115200 is the "slowest" fast speed we'll use, it should be able to go higher
however the Nios 2 Core has to be tweaked.
2013-06-02 22:27:54 -07:00
Robert Ghilduta
b93bb45be0 hdl: nios: add RF RX, and Nios 2 core as SPI master
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$
2013-06-02 22:18:16 -07:00
Robert Ghilduta
edce472b54 hdl: add GPIF and RX/TX signaltap STP file
This can be used to look at the GPIF bus and all of the state machine logic that
goes along with it.
2013-06-02 22:12:29 -07:00
Robert Ghilduta
0d72b6158a hdl: add RX and TX fifos
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.
2013-06-02 22:11:34 -07:00
Nuand
ce7d8a7ab2 FSK bridge example firmware_v0.1
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.
2013-02-18 20:11:39 -08:00