I'm trying to add a digital generator to E1 connector. Digital pins seem to be driven inside red_pitaya_hk.v file. So, I added this code:
Code: Select all
reg [10-1:0] pg_counter;
initial begin
exp_n_dir_o[7:6] <= 2'b11;
pg_counter = 0;
end
always @(posedge sys_clk_i) begin
pg_counter <= pg_counter+1;
exp_n_dat_o[7] <= pg_counter[9];
end
Code: Select all
always @(posedge sys_clk_i) begin
if (sys_rstn_i == 1'b0) begin
led_reg[7:1] <= 7'h0 ;
exp_p_dat_o <= 8'h0 ;
exp_p_dir_o <= 8'h0 ;
exp_n_dat_o <= 8'b11000000;
exp_n_dir_o <= 8'b11000000 ;
end
else begin
if (sys_wen_i) begin
if (sys_addr_i[19:0]==20'h10) exp_p_dir_o <= sys_wdata_i[8-1:0] ;
if (sys_addr_i[19:0]==20'h14) exp_n_dir_o[5:0] <= sys_wdata_i[5:0] ;
if (sys_addr_i[19:0]==20'h18) exp_p_dat_o <= sys_wdata_i[8-1:0] ;
if (sys_addr_i[19:0]==20'h1C) exp_n_dat_o[5:0] <= sys_wdata_i[5:0] ;
if (sys_addr_i[19:0]==20'h30) led_reg[7:1] <= sys_wdata_i[8-1:1] ;
end
end
end
Code: Select all
always @(posedge sys_clk_i) begin
exp_n_dat_o[7] <= 1'b0;
end
and it also worked.
The problem is the generator does not work, so I'm only able to set constant states of pins. Is something wrong with my code or am I missing something?
Thanks,
Alex.