Commit graph

1,791 commits

Author SHA1 Message Date
Jon Szymaniak
44af654b12 bladeRF-cli: Added print/set support for VCTCXO tamer 2015-12-14 15:29:59 -05:00
Jon Szymaniak
9cdfbedd5d libbladeRF: Adding VCTCXO tamer mode selection support 2015-12-14 15:29:59 -05:00
Jon Szymaniak
9f72b2e98c hdl, nios: Bumped FPGA version to v0.5.0 fpga_v0.5.0
Updated minor revision to denote added functionality and host <-> FPGA
interface additions (e.g., an 8x8 packet ID) for VCTCXO tamer.
2015-12-14 15:29:59 -05:00
Jon Szymaniak
8fba7b0a9b hdl: Updated CHANGELOG to reflect previous updates 2015-12-14 15:29:59 -05:00
Jon Szymaniak
77b8e019f4 nios: Added VCTCXO tamer mode access via 8x8 packet ID 0x02 2015-12-14 15:29:59 -05:00
Jon Szymaniak
94f0671612 nios: Added mode readback function for VCTCXO tamer 2015-12-14 15:29:59 -05:00
Jon Szymaniak
c9d768ba85 nios: Keep VCTCXO tamer ISR disabled until 1PPS/10MHz mode is set 2015-12-14 15:29:59 -05:00
Jon Szymaniak
42bf68f217 nios: Default VCTCXO tamer to be disabled 2015-12-14 15:29:59 -05:00
Jon Szymaniak
ed1146aa9e nios: Use bladerf_vctcxo_tamer_mode enum 2015-12-14 15:29:59 -05:00
Jon Szymaniak
7af3de8280 libbladeRF: Added bladerf_vctcxo_tamer_mode enumeration
This enumeration will be used to control the upcoming VCTCXO tamer
module in the FPGA.
2015-12-14 15:29:59 -05:00
Brian Glod
56c6f9c080 hdl: Fixed tune reference MUX select inputs and
The tune reference MUX select inputs were connected to a version of the
tune mode signal synchronized to the tune_ref clock domain. This was an
oversight that would cause a 2-3 second delay after resetting the
counters when tuning against a 1PPS reference (because the synchronizer
block contains two flops clocked at 1 Hz). This was corrected and the
MUX now uses the system-synchronous tune_mode signal from the control
register in the Avalon-MM interface.

Renamed the tune_mode signals to include the clock domain (prefixed with
tune_ref_*).

Added ability for the Avalon-MM master to read back the control register
contents.

Updated tcxopps.stp SignalTap file with new signal names.
2015-12-14 15:29:59 -05:00
Brian Glod
16c0b854fc hdl: Updating VCTCXO Tamer SignalTap file to reflect current signal names 2015-12-14 15:29:59 -05:00
Brian Glod
6b482c8666 nios: Changed VCTCXO Tuner slope to signed integer
The slope should never go negative, but this is safer.
2015-12-14 15:29:59 -05:00
Brian Glod
4a9065c2b1 hdl: Reversed error calculation and added pulse width option to 10 MHz pulse gen
Error count calculation corrected to read "count - target" instead of
"target - count".

Added configuration for the width of the 1PPS pulse generated by the 10 MHz
reference (if using 10 MHz as a reference). Currently this is set to
1e3 x 10 MHz cycles, or 100 us.
2015-12-14 15:29:59 -05:00
Brian Glod
493cfda881 hdl: Fixed reversed bit order on error_valid signal. 2015-12-14 15:29:59 -05:00
Brian Glod
0b224c6fcc nios: Changed VCTCXO Tamer reset bits
There is no reason to have individual reset control bits for each counter.
Consolidating to one reset for all PPS counters.
2015-12-14 15:29:59 -05:00
Brian Glod
4c7e38d05b hdl: Fixed clock domain crossing issues 2015-12-14 15:29:59 -05:00
Brian Glod
272aae2a27 hdl: Added clock constraint for VCTCXO tuning reference 2015-12-14 15:29:59 -05:00
Brian Glod
9f926b0c84 nios: VCTCXO Tamer updated to report error counts instead of raw counts
- Updated NIOS code to comply with new VCTCXO Tamer reporting mechanisms.
- Using more #defines to define addresses and register bits.
- General cleanup.
2015-12-14 15:29:59 -05:00
Brian Glod
75a283ed29 hdl: VCTCXO Tamer updated to report error counts instead of raw counts
- Now using pulse generator module instead of a process.
- When resetting the PPS counters, the reset holdoff time is now using
  the VCTCXO clock instead of the NIOS system clock. The slower clock
  will make timing closure easier and there are fewer bits required.
  It may also have less variance between platforms (assuming the
  VCTCXO remains 38.4 MHz).
- General cleanup and tweaks
2015-12-14 15:29:59 -05:00
Brian Glod
8b6a3e3d9d hdl: Adding pulse_gen.vhd
Takes a signal that may be static for many clock cycles and turns
it into a single-cycle pulse.
2015-12-14 15:29:59 -05:00
Brian Glod
d07b946726 hdl: fixed references to ppscal (renamed to vctcxo_tamer)
Project builds.
2015-12-14 15:29:59 -05:00
Brian Glod
60961310b4 hdl: Renamed ppscal IP to vctcxo_tamer 2015-12-14 15:29:59 -05:00
Brian Glod
f51e861a9f hdl: VCTCXO tuning - added support for 10 MHz reference
Renamed references to 'tcxo' to 'vctcxo' to be more accurate.
2015-12-14 15:29:59 -05:00
Brian Glod
61e39621e8 nios: updated PPS calibration routine to use new PPS helper functions
Now using new devices.c helper functions: 'ppscal_reset_counters( false )'
and 'ppscal_enable_isr( true )' after processing the interrupt and
tweaking the VCTCXO Trim DAC. The new PPS Calibration ISR handles disabling
interrupts and clearing the existing counters so it does not need to happen
at the application level.
2015-12-14 15:29:59 -05:00
Brian Glod
ea8e0b284d nios: Added PPS calibration helper functions and modified ppscal_isr()
Added ppscal_reset_counters(bool), which allows application code to reset
the PPS calibration counters without having to know the register address
to do so.

Changed the ppscal_enable_isr(bool) function from being statically defined
and declared in devices.c to being declared in devices.h for use by application
code.

Modified the ppscal_isr() function to disable future interrupts from the PPS
calibration module, clear existing interrupts, and reset the PPS counters.
It is the job of the application to re-enable interrupts and to take the
counters out of reset.
2015-12-14 15:29:59 -05:00
Brian Glod
8e71e0e8f2 hdl: Added reset delay to give time for the trim DAC to settle before counting
When adjusting the trim DAC, there is a worst-case delay of 800 us when
transitioning from the minimum output to the maximum output supported
by the VCTCXO. This commit adds an 800 us delay between releasing the reset
and allowing the TCXO clock counter to increment.
2015-12-14 15:29:58 -05:00
Brian Glod
724c4f8d26 hdl: Removed reference to file that no longer exists in simulation script
dacxo_tb.vhd no longer exists. It was created temporarily during initial
testing.
2015-12-14 15:29:58 -05:00
Brian Glod
14780ed2a4 nios: Implemented coarse and fine tune algorithm for VCTCXO tuning from 1PPS
Coarse algorithm rails the trim DAC to the min and max voltage supported by
the VCTCXO and creates a line based on the two points (x,y)=(error,DAC_count).
The slope is counts/Hz and the y-intercept is the DAC count with a theoretical
error of 0 Hz. After tuning the the y-intercept, a fine tuning method is used
in which the error is multiplied by a scaled version of the slope based on
the precision of the error (1s, 10s, 100s).

hdl: Changed the 10s error tolerance from 3 to 4.
2015-12-14 15:29:58 -05:00
Brian Glod
4923e72e79 nios: Working baseline for VCTCXO tuning via PPS signal
Changed ppscal functions to use signed 64-bit integers (int64_t vs. uint64_t)
to be able to discern which direction the trim DAC needs to be adjusted.

Added a global variable to cache the trim DAC setting. This variable shall
only be updated during a call to 'devices.c:vctcxo_trim_dac_write()' and
is used by the VCTCXO tuning alorithm to make adjustments to the trim DAC
without having to read from the DAC.

Fixed bug in ppscal_read() that would only read the 1 second counter
regardless of the address passed into the function.

VCTCXO tuning algorithm in the main program loop actually does something
useful and is able to (over a very long period of time) tune the VCTCXO
to within 10 PPB. A proper PID-type algorithm should be implemented.
2015-12-14 15:29:58 -05:00
Brian Glod
2112d4cd6c hdl: Updated testbench to use part models.
Added a VCTCXO model and a 16-bit DAC model for the bladeRF.
The mm_driver.vhd has a more reasonable frequency adjust state.
Simulations will need to be tweaked because they take way too
long. Perhaps best to not use the device models because the changes
are too small to see over a reasonable simulation time.
2015-12-14 15:29:58 -05:00
Brian Glod
58efb99aba hdl: Fixed PPS count interrupts
Interrupts used to fire every second if any of the three counters were off
target. Now, an interrupt will fire only when a new valid count appears
and the associated count value is off target. For example, if the 1 second
count is within the acceptable range, but the 10 second count is not, the
interrupt will only fire at 10 second intervals when the 10 second count
is updated.

Interrupts can only be cleared by the host processor by clearing the bit
specified in the memory map.

Error tolerance is now a 64-bit signed number as opposed to a 'natural',
which is limited to 32 bits.
2015-12-14 15:29:58 -05:00
Brian Glod
fac2339a7a nios: Updated comments for ppscal addresses. 2015-12-14 15:29:58 -05:00
Brian Glod
4ff17d311b gitignore: Added modelsim compiled libraries, transcripts, and waveforms
**/modelsim/transcript
**/modelsim/vsim.wlf
**/modelsim/work/
**/modelsim/nuand/
2015-12-14 15:29:58 -05:00
Brian Glod
67eeb00f97 hdl: Initial checkin of TCXO tuning via 1PPS 2015-12-14 15:29:58 -05:00
Jon Szymaniak
33578a26e4 libbladeRF: Fixed check for invalid enum value in sync_init() (CID1343277) 2015-12-14 14:27:31 -05:00
Jon Szymaniak
5a0e973c0b bladeRF-cli: Address CID1320428 (unchecked return value)
This is intentional.
2015-12-14 14:24:47 -05:00
Nick "Darkfiber" Wolff
327dce57b1 host: Minimal build fixes for FreeBSD
Work still needs to be done to troubleshoot libusb issues.
2015-12-14 11:36:15 -05:00
Jon Szymaniak
f255b9ceea matlab: Removed extraneous loopback assignment 2015-12-13 12:31:46 -05:00
Jon Szymaniak
c7148b5031 matlab: Added methods for LMS6 DC cal routines 2015-12-12 21:18:56 -05:00
Jon Szymaniak
9b143d2d03 host/misc: Fixed incorrect clamping in save_sc16q11.m script 2015-12-10 16:07:44 -05:00
Jon Szymaniak
b3d268b0bc matlab: Ensure TX DAC is returned to 0+0j for tx.stop()
Waiting `num_buffers` worth of samples through this should
be more than sufficient to achieve this.
2015-12-10 15:09:52 -05:00
Jon Szymaniak
15278332f8 matlab: Added FPGA RX mux mode support 2015-12-10 14:38:55 -05:00
Jon Szymaniak
7416fb5ae1 bladeRF-cli: Added print/set rx_mux
This addition allows users to inspect and control the
state of the FPGA RX FIFO input mux.
2015-12-09 23:35:23 -05:00
Mathieu Rene
0d55229719 libbladeRF: Added helper function for setting the FPGA's rx_mux
This function provides simpler access to the FPGA's RX mux,
whose settings are controlled by FX3 <-> FPGA GPIOs.
2015-12-09 23:31:16 -05:00
Mathieu Rene
2f766e455d hdl: Add a dcfifo for clock domain synchronization in digital loopback mode 2015-12-09 18:46:17 -05:00
Jon Szymaniak
ea898fb7ae matlab: Added bladeRF.calibrate function 2015-12-08 23:03:28 -05:00
Jon Szymaniak
976bd1a174 matlab: List any functions not found in the library 2015-12-07 11:37:46 -05:00
Jon Szymaniak
2f2dd15876 matlab: Fixed items that caused warnings in 2015b
- varargout must be a cell
- Initial values in StringSets must match exactly, even though
  our accessors are case-insensitive.
2015-12-07 11:34:25 -05:00
Jon Szymaniak
19c7f7c3a3 libbladeRF_test: Added state output to test_open 2015-11-30 16:55:50 -05:00