Fixed transmit timing out.
This commit is contained in:
parent
4af73374f1
commit
2d955b2bc1
6 changed files with 93 additions and 17 deletions
|
|
@ -165,7 +165,7 @@ void NuandGPIOReconfigure(CyBool_t fullGpif, CyBool_t warm)
|
|||
gpioConfig.driveHighEn = CyFalse;
|
||||
} else {
|
||||
// output config
|
||||
gpioConfig.outValue = CyFalse;
|
||||
gpioConfig.outValue = CyTrue;
|
||||
gpioConfig.driveLowEn = CyTrue;
|
||||
gpioConfig.driveHighEn = CyTrue;
|
||||
gpioConfig.inputEn = CyFalse;
|
||||
|
|
|
|||
|
|
@ -233,10 +233,6 @@ static void NuandRFLinkStart(void)
|
|||
CyFxAppErrorHandler(apiRetStatus);
|
||||
}
|
||||
|
||||
// strobe the RESET pin to the FPGA
|
||||
CyU3PGpioSetValue(GPIO_SYS_RST, CyTrue);
|
||||
CyU3PGpioSetValue(GPIO_SYS_RST, CyFalse);
|
||||
|
||||
/* Start the state machine. */
|
||||
apiRetStatus = CyU3PGpifSMStart(RFLINK_START, RFLINK_ALPHA_START);
|
||||
if (apiRetStatus != CY_U3P_SUCCESS) {
|
||||
|
|
@ -353,6 +349,10 @@ static void NuandRFLinkStart(void)
|
|||
UartBridgeStart();
|
||||
glAppMode = MODE_RF_CONFIG;
|
||||
|
||||
// strobe the RESET pin to the FPGA
|
||||
CyU3PGpioSetValue(GPIO_SYS_RST, CyTrue);
|
||||
CyU3PGpioSetValue(GPIO_SYS_RST, CyFalse);
|
||||
|
||||
}
|
||||
|
||||
/* This function stops the slave FIFO loop application. This shall be called
|
||||
|
|
@ -363,6 +363,8 @@ static void NuandRFLinkStop (void)
|
|||
CyU3PEpConfig_t epCfg;
|
||||
CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
|
||||
|
||||
CyU3PGpioSetValue(GPIO_SYS_RST, CyTrue);
|
||||
|
||||
/* Flush endpoint memory buffers */
|
||||
CyU3PUsbFlushEp(BLADE_RF_SAMPLE_EP_PRODUCER);
|
||||
CyU3PUsbFlushEp(BLADE_RF_SAMPLE_EP_CONSUMER);
|
||||
|
|
|
|||
52
hdl/fpga/ip/nuand/synthesis/signal_generator.vhd
Normal file
52
hdl/fpga/ip/nuand/synthesis/signal_generator.vhd
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
library ieee;
|
||||
use ieee.std_logic_1164.all ;
|
||||
use ieee.numeric_std.all ;
|
||||
|
||||
entity signal_generator is
|
||||
port (
|
||||
clock : in std_logic ;
|
||||
reset : in std_logic ;
|
||||
enable : in std_logic ;
|
||||
|
||||
mode : in std_logic ;
|
||||
|
||||
sample_i : out signed(11 downto 0) ;
|
||||
sample_q : out signed(11 downto 0) ;
|
||||
sample_valid : buffer std_logic
|
||||
) ;
|
||||
end entity ;
|
||||
|
||||
architecture arch of signal_generator is
|
||||
|
||||
begin
|
||||
|
||||
counter : process(clock, reset)
|
||||
variable tock : std_logic ;
|
||||
variable count : natural range 0 to 2047 ;
|
||||
begin
|
||||
if( reset = '1' ) then
|
||||
count := 0 ;
|
||||
tock := '0' ;
|
||||
sample_i <= (others =>'0') ;
|
||||
sample_q <= (others =>'0') ;
|
||||
sample_valid <= '0' ;
|
||||
elsif( rising_edge(clock) ) then
|
||||
sample_i <= to_signed( count, sample_i'length) ;
|
||||
sample_q <= to_signed(-count, sample_q'length) ;
|
||||
if( enable = '1' ) then
|
||||
sample_valid <= not sample_valid ;
|
||||
else
|
||||
sample_valid <= '0' ;
|
||||
end if ;
|
||||
|
||||
if( sample_valid = '1' ) then
|
||||
if( count < 2047 ) then
|
||||
count := count + 1 ;
|
||||
else
|
||||
count := 0 ;
|
||||
end if ;
|
||||
end if ;
|
||||
end if ;
|
||||
end process ;
|
||||
|
||||
end architecture ;
|
||||
|
|
@ -11,6 +11,7 @@ set_global_assignment -name QIP_FILE [file normalize [file join $here ../../ip/a
|
|||
set_global_assignment -name QIP_FILE [file normalize [file join $here ../../ip/altera/nios_system/software/lms_spi_controller/mem_init/meminit.qip]]
|
||||
|
||||
# Implementation details
|
||||
set_global_assignment -name VHDL_FILE [file normalize [file join $here ../../ip/nuand/synthesis/signal_generator.vhd]]
|
||||
set_global_assignment -name VHDL_FILE [file normalize [file join $here ../../ip/nuand/synthesis/synchronizer.vhd]]
|
||||
set_global_assignment -name VHDL_FILE [file normalize [file join $here ../../ip/nuand/synthesis/reset_synchronizer.vhd]]
|
||||
set_global_assignment -name VHDL_FILE [file normalize [file join $here ../../ip/nuand/synthesis/fifo_reader.vhd]]
|
||||
|
|
|
|||
|
|
@ -110,6 +110,10 @@ architecture hosted_bladerf of bladerf is
|
|||
signal rx_sample_q : signed(11 downto 0) ;
|
||||
signal rx_sample_valid : std_logic ;
|
||||
|
||||
signal rx_gen_i : signed(11 downto 0) ;
|
||||
signal rx_gen_q : signed(11 downto 0) ;
|
||||
signal rx_gen_valid : std_logic ;
|
||||
|
||||
signal tx_sample_i : signed(15 downto 0) ;
|
||||
signal tx_sample_q : signed(15 downto 0) ;
|
||||
signal tx_sample_valid : std_logic ;
|
||||
|
|
@ -146,7 +150,7 @@ begin
|
|||
generic map (
|
||||
RESET_LEVEL => '0'
|
||||
) port map (
|
||||
reset => sys_rst_sync,
|
||||
reset => '0',
|
||||
clock => fx3_pclk,
|
||||
async => nios_gpio(7),
|
||||
sync => usb_speed
|
||||
|
|
@ -297,9 +301,9 @@ begin
|
|||
fifo_data => rx_sample_fifo.wdata,
|
||||
fifo_write => rx_sample_fifo.wreq,
|
||||
|
||||
in_i => resize(rx_sample_i,16),
|
||||
in_q => resize(rx_sample_q,16),
|
||||
in_valid => rx_sample_valid,
|
||||
in_i => resize(rx_gen_i,16),
|
||||
in_q => resize(rx_gen_q,16),
|
||||
in_valid => rx_gen_valid,
|
||||
|
||||
overflow_led => rx_overflow_led,
|
||||
overflow_count => rx_overflow_count,
|
||||
|
|
@ -354,6 +358,19 @@ begin
|
|||
tx_lms_enable => open
|
||||
) ;
|
||||
|
||||
U_rx_siggen : entity work.signal_generator
|
||||
port map (
|
||||
clock => rx_clock,
|
||||
reset => rx_reset,
|
||||
enable => '1',
|
||||
|
||||
mode => '0',
|
||||
|
||||
sample_i => rx_gen_i,
|
||||
sample_q => rx_gen_q,
|
||||
sample_valid => rx_gen_valid
|
||||
) ;
|
||||
|
||||
-- Register the inputs immediately
|
||||
lms_rx_data_reg <= lms_rx_data when rising_edge(rx_clock) ;
|
||||
lms_rx_iq_select_reg <= lms_rx_iq_select when rising_edge(rx_clock) ;
|
||||
|
|
|
|||
|
|
@ -168,19 +168,19 @@ begin
|
|||
should_rx <= '0' ;
|
||||
end if ;
|
||||
else
|
||||
should_tx <= '0' ;
|
||||
should_rx <= '0' ;
|
||||
end if ;
|
||||
|
||||
if( can_tx = '1' ) then
|
||||
if( can_rx = '0' ) then
|
||||
should_tx <= '1' ;
|
||||
elsif( dma_last_event = DE_TX ) then
|
||||
elsif( dma_last_event = DE_RX ) then
|
||||
should_tx <= '1' ;
|
||||
else
|
||||
should_tx <= '0' ;
|
||||
end if ;
|
||||
else
|
||||
should_rx <= '0' ;
|
||||
should_tx <= '0' ;
|
||||
end if ;
|
||||
end if ;
|
||||
end process ;
|
||||
|
|
@ -228,8 +228,6 @@ begin
|
|||
dma3_tx_ack <= '1';
|
||||
end if;
|
||||
|
||||
--DMA thread 3 is always next
|
||||
--rf_tx_next_dma <= not rf_tx_next_dma;
|
||||
tx_next_dma <= '1';
|
||||
|
||||
state <= IDLE_WR;
|
||||
|
|
@ -253,6 +251,7 @@ begin
|
|||
dma_downcount <= dma_downcount - 1;
|
||||
else
|
||||
state <= FINISHED;
|
||||
dma_downcount <= to_signed(10, dma_downcount'length) ;
|
||||
end if;
|
||||
when IDLE_RD =>
|
||||
state <= SAMPLE_READ;
|
||||
|
|
@ -260,14 +259,19 @@ begin
|
|||
dma0_rx_ack <= '0';
|
||||
dma1_rx_ack <= '0';
|
||||
|
||||
if( dma_downcount > 0 ) then
|
||||
if( dma_downcount >= 0 ) then
|
||||
dma_downcount <= dma_downcount - 1;
|
||||
else
|
||||
state <= FINISHED;
|
||||
dma_downcount <= to_signed(10, dma_downcount'length) ;
|
||||
end if;
|
||||
when FINISHED =>
|
||||
state <= IDLE ;
|
||||
gpif_oe <= '1' ;
|
||||
if( dma_downcount >= 0 ) then
|
||||
dma_downcount <= dma_downcount - 1 ;
|
||||
else
|
||||
state <= IDLE ;
|
||||
gpif_oe <= '1' ;
|
||||
end if ;
|
||||
end case;
|
||||
|
||||
end if;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue