commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r7464 - in usrp2/trunk/firmware: apps lib


From: eb
Subject: [Commit-gnuradio] r7464 - in usrp2/trunk/firmware: apps lib
Date: Fri, 18 Jan 2008 13:53:03 -0700 (MST)

Author: eb
Date: 2008-01-18 13:53:02 -0700 (Fri, 18 Jan 2008)
New Revision: 7464

Added:
   usrp2/trunk/firmware/apps/test_lsdac.c
Removed:
   usrp2/trunk/firmware/apps/ramp_lsdac.c
Modified:
   usrp2/trunk/firmware/apps/
   usrp2/trunk/firmware/apps/Makefile.am
   usrp2/trunk/firmware/lib/ad9777.h
   usrp2/trunk/firmware/lib/lsdac.c
   usrp2/trunk/firmware/lib/lsdac.h
   usrp2/trunk/firmware/lib/spi.c
Log:
Changed lsdac interface from 16-bit to 12-bit.  Doc fixes.



Property changes on: usrp2/trunk/firmware/apps
___________________________________________________________________
Name: svn:ignore
   - *-stamp
*.a
*.bin
*.dump
*.log
*.rom
*.map
.deps
Makefile
Makefile.in
aclocal.m4
autom4te.cache
blink_leds
blink_leds2
build
compile
config.h
config.h.in
config.log
config.status
configure
depcomp
eth_test
gen_eth_packets
ibs_rx_test
ibs_tx_test
install-sh
libtool
ltmain.sh
missing
py-compile
rcv_eth_packets
run_tests.sh
stamp-h1
test1
test_phy_comm
timer_test
buf_ram_test
buf_ram_zero
hello
test_printf
test_spi
test_i2c
gen_pause_frames
test_serdes
rx_only
tx_only
tx_standalone
tx_drop
tx_drop2
tx_drop_rate_limited
ramp_lsdac

   + *-stamp
*.a
*.bin
*.dump
*.log
*.rom
*.map
.deps
Makefile
Makefile.in
aclocal.m4
autom4te.cache
blink_leds
blink_leds2
build
compile
config.h
config.h.in
config.log
config.status
configure
depcomp
eth_test
gen_eth_packets
ibs_rx_test
ibs_tx_test
install-sh
libtool
ltmain.sh
missing
py-compile
rcv_eth_packets
run_tests.sh
stamp-h1
test1
test_phy_comm
timer_test
buf_ram_test
buf_ram_zero
hello
test_printf
test_spi
test_i2c
gen_pause_frames
test_serdes
rx_only
tx_only
tx_standalone
tx_drop
tx_drop2
tx_drop_rate_limited
test_lsdac
test_lsadc



Modified: usrp2/trunk/firmware/apps/Makefile.am
===================================================================
--- usrp2/trunk/firmware/apps/Makefile.am       2008-01-18 20:00:11 UTC (rev 
7463)
+++ usrp2/trunk/firmware/apps/Makefile.am       2008-01-18 20:53:02 UTC (rev 
7464)
@@ -27,14 +27,14 @@
        hello \
        ibs_rx_test \
        ibs_tx_test \
-       ramp_lsdac \
        rcv_eth_packets \
        rx_only \
        test1 \
        test_i2c \
        test_phy_comm \
+       test_lsdac \
+       test_serdes \
        timer_test \
-       test_serdes \
        tx_drop \
        tx_drop_rate_limited \
        tx_drop2 \

Deleted: usrp2/trunk/firmware/apps/ramp_lsdac.c

Copied: usrp2/trunk/firmware/apps/test_lsdac.c (from rev 7456, 
usrp2/trunk/firmware/apps/ramp_lsdac.c)
===================================================================
--- usrp2/trunk/firmware/apps/test_lsdac.c                              (rev 0)
+++ usrp2/trunk/firmware/apps/test_lsdac.c      2008-01-18 20:53:02 UTC (rev 
7464)
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <lsdac.h>
+#include <u2_init.h>
+#include <nonstdio.h>
+#include <hal_io.h>
+
+int
+main(void)
+{
+  u2_init();
+
+  puts("\ntest_lsdac");
+
+  unsigned int up_counter = 0;
+  unsigned int dn_counter = 0;
+
+  while(1){
+    unsigned int v;
+    v = up_counter;
+    lsdac_write_rx(0, v << 0);
+    lsdac_write_rx(1, v << 1);
+    lsdac_write_rx(2, v << 2);
+    lsdac_write_rx(3, v << 3);
+
+    v = dn_counter;
+    lsdac_write_tx(0, v << 0);
+    lsdac_write_tx(1, v << 1);
+    lsdac_write_tx(2, v << 2);
+    lsdac_write_tx(3, v << 3);
+    up_counter++;
+    dn_counter--;
+  }
+}

Modified: usrp2/trunk/firmware/lib/ad9777.h
===================================================================
--- usrp2/trunk/firmware/lib/ad9777.h   2008-01-18 20:00:11 UTC (rev 7463)
+++ usrp2/trunk/firmware/lib/ad9777.h   2008-01-18 20:53:02 UTC (rev 7464)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2008 Free Software Foundation, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,8 +21,11 @@
 #include <stdint.h>
 #include "ad9777_regs.h"
 
+/*
+ * Analog Devices AD9777 16-bit, 160 MS/s, Dual Interpolating TxDAC
+ */
+
 void ad9777_write_reg(int regno, uint8_t value);
 int  ad9777_read_reg(int regno);
 
-
 #endif /* INCLUDED_AD9777_H */

Modified: usrp2/trunk/firmware/lib/lsdac.c
===================================================================
--- usrp2/trunk/firmware/lib/lsdac.c    2008-01-18 20:00:11 UTC (rev 7463)
+++ usrp2/trunk/firmware/lib/lsdac.c    2008-01-18 20:53:02 UTC (rev 7464)
@@ -32,16 +32,20 @@
 #define        CMD_WR_LDAC_CFG      CMD(6)   // write LDAC config reg
 #define        CMD_WR_INT_REF_CFG   CMD(7)   // write internal ref cfg reg 
(AD5623R only)
 
+
+//#define SPI_SS_DEBUG SPI_SS_TX_DB
+#define SPI_SS_DEBUG 0
+
 inline static void
 _write_rx(uint32_t v)
 {
-  spi_transact(SPI_TXONLY, SPI_SS_RX_DAC, v, 24, 1);
+  spi_transact(SPI_TXONLY, SPI_SS_RX_DAC | SPI_SS_DEBUG, v, 24, 1);
 }
 
 inline static void
 _write_tx(uint32_t v)
 {
-  spi_transact(SPI_TXONLY, SPI_SS_TX_DAC, v, 24, 1);
+  spi_transact(SPI_TXONLY, SPI_SS_TX_DAC | SPI_SS_DEBUG, v, 24, 1);
 }
 
 void 
@@ -54,11 +58,11 @@
 void
 lsdac_write_rx(int which_dac, int value)
 {
-  _write_rx(CMD_WR_UP_DAC_N | ((which_dac & 0x7) << 16) | (value & 0xffff));
+  _write_rx(CMD_WR_UP_DAC_N | ((which_dac & 0x7) << 16) | ((value << 4) & 
0xffff));
 }
 
 void
 lsdac_write_tx(int which_dac, int value)
 {
-  _write_tx(CMD_WR_UP_DAC_N | ((which_dac & 0x7) << 16) | (value & 0xffff));
+  _write_tx(CMD_WR_UP_DAC_N | ((which_dac & 0x7) << 16) | ((value << 4) & 
0xffff));
 }

Modified: usrp2/trunk/firmware/lib/lsdac.h
===================================================================
--- usrp2/trunk/firmware/lib/lsdac.h    2008-01-18 20:00:11 UTC (rev 7463)
+++ usrp2/trunk/firmware/lib/lsdac.h    2008-01-18 20:53:02 UTC (rev 7464)
@@ -28,7 +28,7 @@
 /*!
  * \brief Write one of the low-speed Rx daughterboard DACs.
  * \param which_dac in [0, 3]
- * \param unsigned 16-bit value (really 12-bits, low 4 bits ignored)
+ * \param unsigned 12-bit value in [0, 4095]
  *
  * value maps linearly to output voltage from 0 to 3.3V
  */
@@ -37,7 +37,7 @@
 /*!
  * \brief Write one of the low-speed Tx daughterboard DACs.
  * \param which_dac in [0, 3]
- * \param unsigned 16-bit value (really 12-bits, low 4 bits ignored)
+ * \param unsigned 12-bit value in [0, 4095]
  *
  * value maps linearly to output voltage from 0 to 3.3V
  */

Modified: usrp2/trunk/firmware/lib/spi.c
===================================================================
--- usrp2/trunk/firmware/lib/spi.c      2008-01-18 20:00:11 UTC (rev 7463)
+++ usrp2/trunk/firmware/lib/spi.c      2008-01-18 20:53:02 UTC (rev 7464)
@@ -24,7 +24,7 @@
   /*
    * f_sclk = f_wb / ((div + 1) * 2)
    */
-  spi_regs->div = 0;   // 0 = Div by 2 (50 MHz); 1 = Div-by-4 (25 MHz)
+  spi_regs->div = 1;  // 0 = Div by 2 (25 MHz); 1 = Div-by-4 (12.5 MHz)
 }
 
 void





reply via email to

[Prev in Thread] Current Thread [Next in Thread]