Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No USB signals for the hello_usbdev #4167

Closed
berkguldiker opened this issue Nov 12, 2020 · 12 comments
Closed

No USB signals for the hello_usbdev #4167

berkguldiker opened this issue Nov 12, 2020 · 12 comments

Comments

@berkguldiker
Copy link

Hello, I tried the hello_usbdev program on my FPGA. I was expecting signals on the pins Jb1 and Jb2 (V9 and V8) because according to the xdc-file, the USB signals are connected to those pins. However, I didn't get any signals. Was I analyzing on the wrong pins or is there another issue?

@vogelpi
Copy link
Contributor

vogelpi commented Nov 14, 2020

Hi @berkguldiker ,
could you please provide some more details: which FPGA and board are you using? Do you get any output on the UART? How do you interface your FPGA board with USB? Do you use the PMOD card mentioned here (scroll down to "FPGA Board Implementation with PMOD")?

Best regards, have a good weekend,
Pirmin

@berkguldiker
Copy link
Author

berkguldiker commented Nov 15, 2020

Hi @vogelpi,
Thanks for your reply. I am using a Nexys Video. I get UART output. I also have USB output when simulating on Verilator. I don't have a PMOD card, but I checked the mentioned pins with a logic analyzer.
Thanks a lot and best regards,
Berk

@mdhayter
Copy link
Contributor

You will need to provide the VBUS sense (resistive divider needed because the FPGA isn't 5V tolerant) before the USB is started (or change the code to override that check; it isn't strictly needed but Linux has an ultimate reset of removing VBUS when it believes a port is in a very messed up state). You will also need the 1.5k from the pullup output to D+ or the host will not detect a device. (The USB device won't start producing any traffic until the host starts sending the USB frame sequence and addresses it.)

@berkguldiker
Copy link
Author

Hi, I got the PMOD card. Connected it to the port JB of my board and my PC (tried both J1 and J2). Then run the program hello_usbdev. However, I got the following message on UART:

I00038 boot_rom.c:61] Boot ROM initialisation has completed, jump into flash!
I00000 hello_usbdev.c:145] Hello, USB!
I00001 hello_usbdev.c:146] Built at: Nov 19 2020, 12:15:05
I00002 demos.c:18] Watch the LEDs!
I00003 hello_usbdev.c:157] PHY settings: pinflip=0 differential=0
I00004 handler.c:25] Load/Store fault, mtval shows the fault address
I00005 handler.c:26] MTVAL value is 0x4015006c

There also is no voltage on the sense pin. What might be causing this?

Thanks a lot in advance.

@tjaychen
Copy link

tjaychen commented Feb 19, 2021 via email

@mdhayter
Copy link
Contributor

JB is correct.

The sense voltage is just VBUS divided down, so should follow what the host computer is doing.

The error address is the phy config register and that is indeed the first one written in the init sequence. Is it possible you have an old build of the FPGA? That register was added last summer. I see the software build date is Nov which would be after the register was added but we don't currently show the FPGA build date (it just got added by #5279 but I don't think is sw accessible)

Note that by this point the pullup will not have been asserted (last thing done in init) so the host isn't going to see a device.

@berkguldiker
Copy link
Author

berkguldiker commented Feb 24, 2021

I rebuilt the FPGA with a newer bitstream. It should be from the same time with ROM code. For which I get:

I00000 boot_rom.c:52] Version:    opentitan-snapshot-20191101-1-3168-g8654b021
Build Date: 2020-12-02, 14:08:03

After that I didn't get the error message Load/Store fault, mtval shows the fault address. However, I also didn't get the PASS!. I only got:

I00038 boot_rom.c:61] Boot ROM initialisation has completed, jump into flash!
I00000 hello_usbdev.c:145] Hello, USB!
I00001 hello_usbdev.c:146] Built at: Nov 19 2020, 12:15:05
I00002 demos.c:18] Watch the LEDs!
I00003 hello_usbdev.c:157] PHY settings: pinflip=0 differential=0

The LEDs worked and dmesg showed a new device:

[18016.566562] usb_serial_simple 1-5:1.0: google converter detected
[18016.566757] usb 1-5: google converter now attached to ttyUSB0
[18016.566982] usb_serial_simple 1-5:1.1: google converter detected
[18016.567204] usb 1-5: google converter now attached to ttyUSB1

Why might the program bu cut at this point?

@mdhayter
Copy link
Contributor

That is looking good, all the initial USB handshake and discovery must have worked. If you connect with a terminal program (microcom, minicom, screen etc) on the Linux side (microcom -p /dev/ttyUSB0 is what I use, but of course the device is what ever ttyUSBx the dmsg shows) then you should be able to type characters on one side and see them on the other. Typing / on the FPGA console will print the interrupt and status registers so you can see more about what usbdev is doing.

@berkguldiker
Copy link
Author

berkguldiker commented Feb 26, 2021

Thanks a lot. It is working.

@jake-ke
Copy link
Contributor

jake-ke commented Mar 12, 2021

Hi @berkguldiker , how did you get the PMOD card?

@berkguldiker
Copy link
Author

hi @jackieke724,
https://oshpark.com/shared_projects/xMKhTIHn

@jake-ke
Copy link
Contributor

jake-ke commented Mar 13, 2021

Thank you @berkguldiker for the link. I saw it in the spec mentioned above, but I am not sure if it means we have to make the PCB, buy the parts, and then solder them ourselves?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants