Hello list,
I'm currently working on a firmware app for USRP2 which aims to send a
signal in a standalone manner. I'm using the the following function. The
serial interface returns, that it seems to work by outputting infinity
"Done"s. But on the spectrum analyzer I didn't see anything, except the
local oscillator.
Did I set the wrong flags/timestamp?
Do I have to care about the channel variable?
Did I initialize the buffer in the correct way?
============================
#define DSP_TX_BUF_0 4 // cpu -> dsp tx
static void SEND_DATA () {
putstr("Waiting for the buffer pool.\n");
while((buffer_pool_status->status & BPS_IDLE(DSP_TX_BUF_0)) == 0)
;
putstr("Buffer pool idles. Filling buffer.\n");
// fill buffer
uint32_t *p = buffer_ram(DSP_TX_BUF_0);
uint32_t i;
uint32_t sample = (3200 << 16) | 0;
for (i = 0; i < BP_NLINES; i++) {
p[i] = sample;
}
// 1) 32-bit: word0 (flags, etc)
p[0] = 0 | U2P_TX_IMMEDIATE | U2P_TX_START_OF_BURST |
U2P_TX_END_OF_BURST;
// 2) 32-bit: fpga timestamp (time of tx)
p[1] = -1;
putstr("Filled buffer. Start sending\n");
bp_clear_buf(DSP_TX_BUF_0);
// first xfer
bp_send_from_buf(DSP_TX_BUF_0, PORT_DSP, 1, 0, BP_LAST_LINE);
while(1) {
// fire it off
bp_send_from_buf(DSP_TX_BUF_0, PORT_DSP, 1, 0, BP_LAST_LINE);
// wait for xfer to complete
while ((buffer_pool_status->status &
(BPS_DONE(DSP_TX_BUF_0) | BPS_ERROR(DSP_TX_BUF_0)))
== 0)
;
putstr("Done.\n");
bp_clear_buf(DSP_TX_BUF_0);
}
}
============================
I'm using the USRP2 with the daughterboard RFX2400. The antenna is
connected to the "TX/RX" connector. The settings concerning frequency,
interp, ... are set according:
============================
double freq = 2400e6;
unsigned int interpolate = 4;
unsigned int scale_i = 1;
unsigned int scale_q = 1;
struct tune_result result;
printf("\nTune Request:\n");
u2_fxpt_freq_t tune_freq = U2_DOUBLE_TO_FXPT_FREQ(freq);
printf(" freq: %u\n", u2_fxpt_freq_round_to_uint(tune_freq));
bool tune_ok = db_tune(tx_dboard, tune_freq, &result);
int interp = interpolate;
int hb1 = 0;
int hb2 = 0;
if (!(interp & 1)){
hb2 = 1;
interp = interp >> 1;
}
if (!(interp & 1)){
hb1 = 1;
interp = interp >> 1;
}
if (interp < MIN_CIC_INTERP || interp > MAX_CIC_INTERP)
printf("Variable interp %d out of range",interp);
else {
dsp_tx_regs->interp_rate = (hb1<<9) | (hb2<<8) | interp;
printf("Interp: %d, register %d\n", interpolate, (hb1<<9) |
(hb2<<8) | interp);
}
unsigned int scale_iq = (scale_i << 16) | scale_q;
dsp_tx_regs->scale_iq = scale_iq;
SEND_DATA();
============================
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio