+ Post New Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 37
  1. #1
    Advanced Member level 1
    Points: 2,362, Level: 11

    Join Date
    Feb 2016
    Posts
    433
    Helped
    1 / 1
    Points
    2,362
    Level
    11

    USB Softcore for FPGA

    Have anyone used https://github.com/avakar/usbcore before ?

    why do we need extra resistance on the tx pin ONLY ?

    Whichever pins you transmit on need to have resistors after them. The exact values will depend on the internal resistance of the pins; usually something around 27 ohms will be ok.

    •   AltAdvertisment

        
       

  2. #2
    Super Moderator
    Points: 251,373, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    43,775
    Helped
    13310 / 13310
    Points
    251,373
    Level
    100

    Re: USB Softcore for FPGA

    Sounds like you need to review the USB spec for required driver impedance.



  3. #3
    Advanced Member level 1
    Points: 2,362, Level: 11

    Join Date
    Feb 2016
    Posts
    433
    Helped
    1 / 1
    Points
    2,362
    Level
    11

    Re: USB Softcore for FPGA

    According to section 7.1.1 (Tx) and 7.1.2 (Rx) of https://usb.org.10-1-108-210.causewa...7.pdf#page=144 , it seems like we need some resistance for impedance matching for BOTH Tx and Rx.



  4. #4
    Super Moderator
    Points: 251,373, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    43,775
    Helped
    13310 / 13310
    Points
    251,373
    Level
    100

    Re: USB Softcore for FPGA

    You have been apparently confused by the USB 2.0 spec describing both FS and HS requirements. It's easier to review usb11 spec. For FS as targeted by the FPGA project, the effective driver impedance is 28 to 44 ohm (internal driver impedance + series resistor). There's no receiver termination (except for kohm resistors used for device identification.

    The correct GitHub link is https://github.com/avakar/usbcorev, by the way.


    2 members found this post helpful.

  5. #5
    Advanced Member level 1
    Points: 2,362, Level: 11

    Join Date
    Feb 2016
    Posts
    433
    Helped
    1 / 1
    Points
    2,362
    Level
    11

    Re: USB Softcore for FPGA




  6. #6
    Advanced Member level 1
    Points: 2,362, Level: 11

    Join Date
    Feb 2016
    Posts
    433
    Helped
    1 / 1
    Points
    2,362
    Level
    11

    Re: USB Softcore for FPGA

    For https://github.com/avakar/usbcorev#physical-interface , what are the actual purposes of 'input rx_se0' and 'output tx_se0' ?



  7. #7
    Super Moderator
    Points: 251,373, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    43,775
    Helped
    13310 / 13310
    Points
    251,373
    Level
    100

    Re: USB Softcore for FPGA

    You want to review the USB spec about the usage of differential and single-ended signalling and how it's implemented in driver hardware.


    1 members found this post helpful.

    •   AltAdvertisment

        
       

  8. #8
    Advanced Member level 1
    Points: 2,362, Level: 11

    Join Date
    Feb 2016
    Posts
    433
    Helped
    1 / 1
    Points
    2,362
    Level
    11

    Re: USB Softcore for FPGA

    ok.

    You also need to pull the D+ line up to 3.3V via a 1.5k resistor. You can pull it directly, or via a pin on your FPGA, if you want to dynamically attach/detach to the bus.
    What about D- line ?



  9. #9
    Super Moderator
    Points: 69,422, Level: 64
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    14,187
    Helped
    3239 / 3239
    Points
    69,422
    Level
    64

    Re: USB Softcore for FPGA

    Hi,

    What about D- line ?
    The USB spec will tell you.

    I assume it's impossible to tell you all in a forum thread that is written in the USB spec.
    I see no way around reading documentation...

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  10. #10
    Advanced Member level 1
    Points: 2,362, Level: 11

    Join Date
    Feb 2016
    Posts
    433
    Helped
    1 / 1
    Points
    2,362
    Level
    11

    Re: USB Softcore for FPGA

    I found answer for D-line



    - - - Updated - - -

    https://github.com/avakar/usbcorev/b...r/usb.v#L1-L29 this is way too many driver signals ... You have any suggestions ?

    Code Verilog - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    
    module usb(
        input rst_n,
        input clk_48,
     
        input rx_j,
        input rx_se0,
     
        output tx_en,
        output tx_j,
        output tx_se0,
     
        input[6:0] usb_address,
     
        output usb_rst,
     
        output reg transaction_active,
        output reg[3:0] endpoint,
        output reg direction_in,
        output reg setup,
        input data_toggle,
     
        input[1:0] handshake,
        
        output reg[7:0] data_out,
        input[7:0] data_in,
        input data_in_valid,
        output reg data_strobe,
        output reg success
        );
    Last edited by promach; 26th December 2018 at 06:34.



    •   AltAdvertisment

        
       

  11. #11
    Advanced Member level 3
    Points: 5,748, Level: 17

    Join Date
    Feb 2015
    Posts
    946
    Helped
    270 / 270
    Points
    5,748
    Level
    17

    Re: USB Softcore for FPGA

    It looks like 4 pins are used with 2 pins connected to each USB data line. This allows the data lines to be treated as two single ended lines, or one differential pair. Either the single ended drivers are Tristated or the differential or both.



  12. #12
    Advanced Member level 1
    Points: 2,362, Level: 11

    Join Date
    Feb 2016
    Posts
    433
    Helped
    1 / 1
    Points
    2,362
    Level
    11

    Re: USB Softcore for FPGA

    is it correct that I only need TWO 27 ohm resistors in series (to compensate the low output impedance, say 73 ohm of FPGA pins) with the FPGA usbcorev softcore D+ and D- pins ?

    And another 1.5 kilo-ohm pull-up resistor for D+ line ?

    From https://www.intel.cn/content/dam/alt...-02.pdf#page=9 (have anyone used on chip termination ?) , I am not sure if I need to use external series termination resistors for both D+ and D- line

    Could anyone advise ?

    - - - Updated - - -

    When I loop deeper into cyclone IV IO spec, it only supports 25 ohm or 50 ohm on-chip termination.

    This means this on-chip termination is not suffice for 90 ohm transmission line in USB spec



  13. #13
    Super Moderator
    Points: 251,373, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    43,775
    Helped
    13310 / 13310
    Points
    251,373
    Level
    100

    Re: USB Softcore for FPGA

    With Intel FPGA, there's no calibrated series termination that matches the USB FS requirement of 28 - 44 ohm driver impedance. You are probably able to achieve the impedance by choosing a suitable drive strength in uncalibrated mode, but the impedance will be subjected to type and temperature variation. Thus it's probably better to use a low driver impedance along with series resistors.

    Pull-up and -down resistors need to be implemented discretely in case of doubt, but can be switched by tri-state outputs.


    1 members found this post helpful.

  14. #14
    Advanced Member level 1
    Points: 2,362, Level: 11

    Join Date
    Feb 2016
    Posts
    433
    Helped
    1 / 1
    Points
    2,362
    Level
    11

    Re: USB Softcore for FPGA

    USB FS requirement of 28 - 44 ohm driver impedance
    I suppose it should be 90 ohm instead ?? See figure 7-20 of the USB 2.0 spec which I had also posted as screenshot in the previous post.

    Pull-up and -down resistors need to be implemented discretely in case of doubt, but can be switched by tri-state outputs.
    Since D+ and D- are bi-directional, do we need 15 kilo-ohm pull-down resistors for both D+ and D- line at FPGA pins ??

    What do you mean by "can be switched by tri-state outputs" ?



  15. #15
    Super Moderator
    Points: 251,373, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    43,775
    Helped
    13310 / 13310
    Points
    251,373
    Level
    100

    Re: USB Softcore for FPGA

    90 ohm is the nominal differential cable impedance, 22 - 44 om is the specified single ended driver impedance. It's all explained in the USB spec.

    I'm not sure what pull-up and down resistors have to do with bidirectional operation. Different resistor values shall be implemented for down- and up-stream ports, as shown in your post #10. I was suggesting tri-state drivers in case you want to switch resistors, e.g. to signal activation/deactivation of an upstream (device) port or change speed. Otherwise you can use fixed resistor.


    1 members found this post helpful.

  16. #16
    Super Moderator
    Points: 69,422, Level: 64
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    14,187
    Helped
    3239 / 3239
    Points
    69,422
    Level
    64

    Re: USB Softcore for FPGA

    Hi,

    Since D+ and D- are bi-directional, do we need 15 kilo-ohm pull-down resistors for both D+ and D- line at FPGA pins ??
    Look at the picture of post #10.
    Left side: is the HOST or HUB side
    Right side: is the DEVICE side.

    15kOhms pulldown are only at the HOST or HUB side.

    But I assume (did you write it somewhere?) you want to design an USB_DEVICE.
    Is this correct?
    If so, then focus on the right side pcitures.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    1 members found this post helpful.

  17. #17
    Advanced Member level 1
    Points: 2,362, Level: 11

    Join Date
    Feb 2016
    Posts
    433
    Helped
    1 / 1
    Points
    2,362
    Level
    11

    Re: USB Softcore for FPGA

    15kOhms pulldown are only at the HOST or HUB side.

    But I assume (did you write it somewhere?) you want to design an USB_DEVICE.
    Is this correct?
    @KlausST

    According to mindshare introduction to USB article , should I classify usbcorev softcore as HOST, HUB or DEVICE ?



  18. #18
    Super Moderator
    Points: 69,422, Level: 64
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    14,187
    Helped
    3239 / 3239
    Points
    69,422
    Level
    64

    Re: USB Softcore for FPGA

    Hi,

    Wow...

    If you donīt know whether you need to design a HUB, HOST or DEVICE ... nobody else can know.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    1 members found this post helpful.

  19. #19
    Advanced Member level 1
    Points: 2,362, Level: 11

    Join Date
    Feb 2016
    Posts
    433
    Helped
    1 / 1
    Points
    2,362
    Level
    11

    Re: USB Softcore for FPGA

    @KlausST

    I got it now. Since my FPGA code is not capable of running linux yet, so usbcorev softcore is going to be a DEVICE only for now



    •   AltAdvertisment

        
       

  20. #20
    Super Moderator
    Points: 69,422, Level: 64
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    14,187
    Helped
    3239 / 3239
    Points
    69,422
    Level
    64

    Re: USB Softcore for FPGA

    Hi,

    it my eyes it has nothing to do with an operating system (LINUX)

    Letīs try another terminology (not usual USB_Specification)

    Do you want to build a
    * USB-Master
    * or a USB-Slave?

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



--[[ ]]--