Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 34

Thread: Communication PC-De0 Nano

  1. #21
    Join Date
    Aug 2005
    Location
    California
    Posts
    4,562
    Rep Power
    1

    Default Re: Communication PC-De0 Nano

    have you finished the tutorial?
    Not yet. I was going to try and finish it tonight, or tomorrow, so its not too far away.

    Did you manage to get your virtual JTAG design to blink some LEDs?

    Cheers,
    Dave

  2. #22
    Join Date
    Aug 2011
    Location
    Jakarta, Indonesia
    Posts
    60
    Rep Power
    1

    Default Re: Communication PC-De0 Nano

    Not yet. The last 2 or 3 days, I'm concentrating at my sensor. This afternoon, I'll try the virtual jtag.
    Thank you so much Dave

  3. #23
    Join Date
    Aug 2011
    Location
    Jakarta, Indonesia
    Posts
    60
    Rep Power
    1

    Default Re: Communication PC-De0 Nano

    Quote Originally Posted by dwh@ovro.caltech.edu View Post
    For your first design, you can ignore all of these signals, and just wire ir_in to your LEDs, and ir_out to some push buttons. You can then use quartus_stp and device_virtual_ir_shift to write to the LEDs and read from the push buttons.
    Hello Dave,
    You said thqt ir_in is an input to my design and ir_out is the output from my design.
    I don't understand. Why should ir_in connected to LED? Because my design is only to make 4 LED blinking by using 4 bit counter. And I use clock divider to slow the clock that will be fed to the counter. If ir_in is connected to LED, that means the virtual jtag will interfere the "original" design.
    So far these are what I've done:
    1. Make the original design with verilog and later generate a bdf(block diagram file)
    2. Make the vji using megawizard. And only generate bdf file.
    3. From this step on, I don't know what should I do. How should I connect the block of my design and virtual jtag block.
    How could I know how much width of IR is needed?(page3 of virtual jtag megawizard)
    What I know from the pdf you gave me, IR is to define to which data TDI and TDO should connect(though I don't understand that).
    Why Altera don't give tutorial about this issue? They only discuss theory and how to use the megawizard not how to apply the megawizard to our design.
    Sorry that I'm asking too much.
    It's good to hear someone is trying to fill that gap.

    Thank you Dave.

  4. #24
    Join Date
    Aug 2005
    Location
    California
    Posts
    4,562
    Rep Power
    1

    Default Re: Communication PC-De0 Nano

    You said thqt ir_in is an input to my design and ir_out is the output from my design. I don't understand. Why should ir_in connected to LED?
    You indicated you wanted to investigate the sld_virtual_jtag component. You can do that by simply instantiating it and wire it to the I/O on your board, eg. something like:

    Code:
        -- Virtual JTAG interface
        u1: sld_virtual_jtag
            generic map (
                sld_auto_instance_index => "YES",
                sld_instance_index      => 0,
                sld_ir_width            => VIR_WIDTH,
                sld_sim_action          => "",
                sld_sim_n_scan          => 0,
                sld_sim_total_length    => 0,
                lpm_type                => "sld_virtual_jtag"
            )
            port map (
                -- JTAG signals
                tck                => tck,
                tms                => tms,
                tdo                => tdio,
                tdi                => tdio,
    
                -- Virtual instruction register
                ir_in              => vir_in,
                ir_out             => vir_out
          );
    
          led <= vir_in;
    where VIR_WIDTH is the number of LEDs.

    Because my design is only to make 4 LED blinking by using 4 bit counter. And I use clock divider to slow the clock that will be fed to the counter. If ir_in is connected to LED, that means the virtual jtag will interfere the "original" design.
    That's a different design. In this design, if you want to use the JTAG interface to say load the initial count, or disable the counter, you have to ensure you cross clock domains from the JTAG interface clock to the 50MHz clock domain correctly.

    So far these are what I've done:
    1. Make the original design with verilog and later generate a bdf(block diagram file)
    2. Make the vji using megawizard. And only generate bdf file.
    3. From this step on, I don't know what should I do. How should I connect the block of my design and virtual jtag block.
    Stop using BDF. Wire the parts up using Verilog. You will need to learn how to use the Modelsim simulator eventually, and its much easier if you stick with an HDL language.

    How could I know how much width of IR is needed?(page3 of virtual jtag megawizard)
    How do you know how wide a counter should be? Its just a port, you make it as wide as you decide you need it (within the limit of the IP; 24-bits I think for the IR width).

    What I know from the pdf you gave me, IR is to define to which data TDI and TDO should connect(though I don't understand that).
    IR is used as an 'instruction' register in the JTAG terminology. In this particular component, its just an output port. You can do with it what you like.

    Why Altera don't give tutorial about this issue? They only discuss theory and how to use the megawizard not how to apply the megawizard to our design.
    Yep, I understand your pain

    Cheers,
    Dave

  5. #25
    Join Date
    Aug 2011
    Location
    Jakarta, Indonesia
    Posts
    60
    Rep Power
    1

    Default Re: Communication PC-De0 Nano

    Hello Dave,
    I think I am really hopeless here with vji.
    Have you already finished the tutorial already? Please finish it. I really need everyone's help.

    I found an example about vji from pdf you gave. Here is the code:
    module counter (clock, my_counter);
    input clock;
    output [3:0] my_counter;
    reg [3:0] my_counter;
    always @ (posedge clock)
    if (load && e1dr) // decode logic: used to load the counter my_counter
    my_counter <= tmp_reg;
    else
    my_counter <= my_counter + 1;
    // Signals and registers declared for VJI instance
    wire tck, tdi;
    reg tdo;
    wire cdr, eldr, e2dr, pdr, sdr, udr, uir, cir;
    wire [1:0] ir_in;

    // Instantiation of VJI
    my_vji VJI_INST(
    .tdo (tdo),
    .tck (tck),
    .tdi (tdi),
    .tms(),
    .ir_in(ir_in),
    .ir_out(),
    .virtual_state_cdr (cdr),
    .virtual_state_e1dr(e1dr),
    .virtual_state_e2dr(e2dr),
    .virtual_state_pdr (pdr),
    .virtual_state_sdr (sdr),
    .virtual_state_udr (udr),
    .virtual_state_uir (uir),
    .virtual_state_cir (cir)
    );
    // Declaration of data register
    reg [3:0] tmp_reg;
    // Decode Logic Block
    // Making some decode logic from ir_in output port of VJI
    wire load = ir_in[1] && ~ir_in[0];
    // Bypass used to maintain the scan chain continuity for
    // tdi and tdo ports
    bypass_reg <= tdi;
    // Data Register Block
    always @ (posedge tck)
    if ( load && sdr )
    tmp_reg <= {tdi, tmp_reg[3:1]};
    // tdo Logic Block
    always @ (tmp_reg[0] or bypass_reg)
    if(load)
    tdo <= tmp_reg[0];
    else
    tdo <= bypass_reg;
    endmodule

    I have questions about this example.
    1. From the pdf, I can read that tck is the clock used for shifting the data in and out on the TDI and TD0 pins. In the example above, what is actually "always @ (posedge tck)"? What I don't understand is how it become a "clock"? It doesn't even wired to the "input clock" of "module counter". Is it just "automatically has the same clock as De0 nano has?

    2. What does the following code mean?
    if ( load && sdr )
    tmp_reg <= {tdi, tmp_reg[3:1]};
    Why is "tmp_reg[3:1]" instead of "tmp_reg[3:0]"? What is the value of "tmp_reg[0]" then?
    I know that sdr will become 1 when DR scan shift operation occurs or tdi is valid.
    Load will be 1 if ir_in[1] = 1 and ir_in[0] = 0. (Please correct me if I'm wrong)

    3. What happens here?
    always @ (tmp_reg[0] or bypass_reg)
    if(load)
    tdo <= tmp_reg[0]
    else
    tdo <= bypass_reg;

    I take it that "tmp_reg[0] or bypass_reg" are values that changing. But it doesn't seems that "tmp_reg[0]" get value from anywhere.

    Thank You Dave.

    Gunardi

    PS. please finish your tutorial. I do need it. Thank you for your effort so far.

  6. #26
    Join Date
    Aug 2005
    Location
    California
    Posts
    4,562
    Rep Power
    1

    Default Re: Communication PC-De0 Nano

    always @ (posedge clock)
    if (load && e1dr) // decode logic: used to load the counter my_counter
    my_counter <= tmp_reg;
    else
    my_counter <= my_counter + 1;
    You cannot use control signals from the JTAG clock domain in your 'clock' clock domain without first ensuring they are synchronized. You are on the right track though.

    Draw yourself a timing diagram with two clocks, one for JTAG TCK and the JTAG signals, and then another for your counter. If your counter clock is faster than the JTAG TCK, then 'load' and 'e1dr' last for many clocks. You need to use synchronization logic to take the pulse from the JTAG clock domain into the 'clock' clock domain.

    // Data Register Block
    always @ (posedge tck)
    if ( load && sdr )
    tmp_reg <= {tdi, tmp_reg[3:1]};
    // tdo Logic Block
    always @ (tmp_reg[0] or bypass_reg)
    if(load)
    tdo <= tmp_reg[0];
    else
    tdo <= bypass_reg;
    endmodule

    what is actually "always @ (posedge tck)"? What I don't understand is how it become a "clock"? It doesn't even wired to the "input clock" of "module counter". Is it just "automatically has the same clock as De0 nano has?
    The statement is Verilog syntax for 'do this at every rising edge of TCK'. TCK is the JTAG clock it comes into the device on the JTAG pins. The clock comes from the USB-Blaster on your board.

    2. What does the following code mean?
    if ( load && sdr )
    tmp_reg <= {tdi, tmp_reg[3:1]};
    Why is "tmp_reg[3:1]" instead of "tmp_reg[3:0]"? What is the value of "tmp_reg[0]" then?
    sdr = Shift-DR, this signal is high when the JTAG data register is getting shifted. Think of it as a shift-register enable signal. The tmp_reg signal is being assigned its previous value right-shifted by 1, with tdi replacing the top-bit ... and that is a shift-register.

    3. What happens here?
    always @ (tmp_reg[0] or bypass_reg)
    if(load)
    tdo <= tmp_reg[0]
    else
    tdo <= bypass_reg;
    This is a Verilog combinatorial statement. It says, every time there is a change on tmp_reg[0] or bypass_reg, run this block of logic, and then it looks at the load signal ... so this is bogus Verilog. If it was supposed to be combinatorial, then it would have load in the sensitivity list, and if it was supposed to be registered, it would have a posedge statement in the sensitivity list.

    PS. please finish your tutorial. I do need it.
    Sorry, I have not had a chance to work on it. I'll try and find some time soon.

    Cheers,
    Dave

  7. #27
    Join Date
    Aug 2011
    Location
    Jakarta, Indonesia
    Posts
    60
    Rep Power
    1

    Default Re: Communication PC-De0 Nano

    Thank you for your reply and effort so far for the tutorial, Dave.
    Could you give me another good link or pdf regarding this issue? I believe you have much more resource than I do.
    I have been trying to find any, but I couldn't find any(including Altera).

  8. #28
    Join Date
    Aug 2005
    Location
    California
    Posts
    4,562
    Rep Power
    1

    Default Re: Communication PC-De0 Nano

    Could you give me another good link or pdf regarding this issue? I believe you have much more resource than I do.
    Here's the incomplete tutorial;

    http://www.ovro.caltech.edu/~dwh/correlator/pdf/vjtag.pdf

    I'm also writing another on the Altera JTAG-to-Avalon bridges and how to use those. I've used the Virtual JTAG interface and created my own VHDL versions. Those will also get documented and links posted (when I get a chance).

    Cheers,
    Dave

  9. #29
    Join Date
    Aug 2011
    Location
    Jakarta, Indonesia
    Posts
    60
    Rep Power
    1

    Default Re: Communication PC-De0 Nano

    Thank you for the tutorial, Dave.
    I will read it immediately.

    Ps. Please notify me everytime you update this pdf.

  10. #30
    Join Date
    Jun 2008
    Location
    San Jose, CA
    Posts
    34
    Rep Power
    1

    Default Re: Communication PC-De0 Nano

    Quote Originally Posted by dwh@ovro.caltech.edu View Post
    The USB interface to the DE0-nano is a USB-Blaster.

    You can communicate from the host via a couple of mechanisms;

    1) SLD Virtual JTAG core, and quartus_stp Tcl procedures

    2) JTAG-to-Avalon-MM master and SystemConsole

    3) Direct access via FTDI drivers
    I'm also trying to communicate via my PC to the DE0-Nano via the current USB connection. I was aiming to do basically option #3, but Terasic wouldn't provide me any schematics for how the FTDI chip is connected to the Cyclone IV.

    I'm now looking into the JTAG options. I'm curious about how I actually assign the pins for working with the JTAG? I noticed when I create a JTAG interface using the Qsys w/ NIOS I never have to make any assignments in the Pin planner.

    I've tried to generate a vJTAG using the megafunction wizard, and I can get to the point where my block is created (I'm using the schematic entry), but I have no idea how I assign the pins. The JTAG pins are not available in the Pin Planner...Are they automatically connected somehow?

    (I'm still very new to this JTAG stuff so I might be completed confused about how to work with it :-)

    Thanks!
    Chris

Similar Threads

  1. DE0-Nano Accelerometer
    By TheTomShow in forum General Altera Discussion
    Replies: 5
    Last Post: February 23rd, 2012, 04:36 PM
  2. DE0-nano
    By venzorc in forum General Altera Discussion
    Replies: 3
    Last Post: February 18th, 2012, 01:00 PM
  3. DE0-Nano Accelerometer
    By TheTomShow in forum FPGA, Hardcopy, and CPLD Discussion
    Replies: 2
    Last Post: September 12th, 2011, 12:49 PM
  4. Win Altera DE0-Nano!
    By ayhoung in forum Development Kit Related
    Replies: 1
    Last Post: May 2nd, 2011, 07:51 PM
  5. DE0-Nano LED D4
    By wala in forum Development Kit Related
    Replies: 2
    Last Post: April 29th, 2011, 07:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •