Use the extension connector as digital inputs

Just about everything about Red Pitaya
Post Reply
ronyang@RP
Posts: 7
Joined: Fri Dec 25, 2015 3:10 am

Use the extension connector as digital inputs

Post by ronyang@RP » Fri Jul 08, 2016 2:42 am

Hi all:

By searching the forum, I found a similar problem viewtopic.php?f=9&t=267 , but the reply below is too concise...
Basically, I would like to sync red pitaya with a galvo scanner. The scanner sends out short pulses at around 100kHz.
I was trying to acquire the pulse using the digital inputs (DIO0_P). I notice that there is only one line code in red_pitaya_top.v about this pin:

IOBUF i_iobufp [8-1:0] (.O(exp_p_in), .IO(exp_p_io), .I(exp_p_out), .T(~exp_p_dir) );

For testing purpose, I commented out the led control lines in red_pitaya_hk.v and do
led_o[0] <= exp_p_in[0];
Then, I send a high(3.3V) or low(0V) signal to the DIO0_P pin. As I was a bit confused by the tristate control signal, I tried both high and low. Unfortunately, the led does not blink with input signal in either case.

Can anyone help me on this?

Thanks!
-Ron

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: Use the extension connector as digital inputs

Post by Nils Roos » Mon Jul 11, 2016 10:28 pm

Hi Ron,

could you post or attach the complete Verilog code of all changed modules? There are so many small things that can lead to unintended consequences during the synthesis.

ronyang@RP
Posts: 7
Joined: Fri Dec 25, 2015 3:10 am

Re: Use the extension connector as digital inputs

Post by ronyang@RP » Wed Jul 13, 2016 4:34 pm

Nils Roos wrote:Hi Ron,

could you post or attach the complete Verilog code of all changed modules? There are so many small things that can lead to unintended consequences during the synthesis.
Hi Nils:

Here are all the changes:
As both the led_o and exp_p_dir output were originally controlled by red_pitaya_hk, I did this

wire [ 8-1: 0] led_bypass;
wire [ 8-1: 0] exp_bypass;
red_pitaya_hk i_hk (
// system signals
.clk_i ( adc_clk ), // clock
.rstn_i ( adc_rstn ), // reset - active low
// LED
.led_o ( led_bypass ), // LED output
// global configuration
.digital_loop ( digital_loop ),
// Expansion connector
.exp_p_dat_i ( exp_p_in ), // input data
.exp_p_dat_o ( exp_p_out ), // output data
.exp_p_dir_o ( exp_bypass ), // 1-output enable
.exp_n_dat_i ( exp_n_in ),
.exp_n_dat_o ( exp_n_out ),
.exp_n_dir_o ( exp_n_dir ),
// System bus
.sys_addr ( sys_addr ), // address
.sys_wdata ( sys_wdata ), // write data
.sys_sel ( sys_sel ), // write byte select
.sys_wen ( sys_wen[0] ), // write enable
.sys_ren ( sys_ren[0] ), // read enable
.sys_rdata ( sys_rdata[ 0*32+31: 0*32] ), // read data
.sys_err ( sys_err[0] ), // error indicator
.sys_ack ( sys_ack[0] ) // acknowledge signal
);

Then, simply
assign exp_p_dir = 8'b00001111; // half are 1's and half 0's just for testing purpose
assign led_o = exp_p_in;

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: Use the extension connector as digital inputs

Post by Nils Roos » Thu Jul 21, 2016 4:23 pm

Hi, sorry it took me a bit to get back to you.

I couldn't find anything wrong with your changes, so I created a bitstream with your modifications and loaded it on my RP.
It works as expected, led 0-3 are dark (connected to outputs driven as 0) and led 4-7 respond to changes on DIO4-7_P.

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 111 guests