This commit introduces LMS library support for controlling the LimeMicro
LMS6002D transceiver. The LMS library functions were originally developed by
bpadalino.
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...
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.
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
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.
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.
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.