Author Topic: USB3320 Device not able to detect with Zynq RFSoC  (Read 3149 times)

0 Members and 1 Guest are viewing this topic.

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
USB3320 Device not able to detect with Zynq RFSoC
« on: April 06, 2023, 08:26:52 pm »
Hi,
We are using USB3320 with Zynq RFSoC.
We are facing an issue where USB devices not been able to detect.
Attaching log: https://discuss.pynq.io/t/usb3320-not-able-to-detect-the-devicec-connected/4696
https://support.xilinx.com/s/question/0D52E00007Bu0OQSAZ/i-am-not-able-to-detect-usb-storage-device-in-zynq-rfsoc-board?language=en_US


VDDIO - 3.3V
Note:Though USB3320 datasheet suggests VDDIO-1.8V/3.3V, In most of the design, I've seen reference boards using 1.8V as VDDIO
In our case, VDDIO-3.3V
From Hardware point of view,
Reset is happening, REFCLKOUT of 60MHz is observed. External CLKIN-26MHz OSC
When we try to usb start operation, we do see, No USB Devices detected.
I would appreciate valuable inputs.

While USB reset/stop command, We do observe DM going low to high. No other transaction
 

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #1 on: April 07, 2023, 11:19:58 am »
Hi
Awaiting for any feedback.
 

Offline mon2

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: ca
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #2 on: April 07, 2023, 12:23:36 pm »
Have you gone through the attached document?
 

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #3 on: April 07, 2023, 07:41:56 pm »
Yes, I've gone through those documents already
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14472
  • Country: fr
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #4 on: April 07, 2023, 08:56:45 pm »
It's really hard to say anything much as is. I suppose you have already checked the USB data lines with a scope, possibly an eye diagram, just to check signal integrity?

I don't think VDDIO would matter one bit as long as it matches the logic level of the Zynq bank it's connected to. Are you sure it's indeed 3.3V?
 

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #5 on: April 08, 2023, 05:50:57 am »
It is a USB 2.0
Yes VDDIO is 3.3V and VDD is 1.8V
Reset is controlled from FPGA, and Reset sequence is as follows
1. USB3320 IC is in initially reset(through pull down -reset)
2. After FPGA is up, Reset will be driven high(1us)-low(5us)-high
3. We observe IC out of reset, through CLKOUT of 60MHz as usb start command is given
 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6706
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #6 on: April 08, 2023, 11:26:28 am »
With Zynq ULPI, be aware there is an issue with FSBL code where MIO is pulling up STP pin but USB3320 is pulling down.  Result is STP pin is in unknown state and occasionally (1-20% of the time according to one Xilinx user) fails to init correctly.  Maybe you are unlucky and it always fails. 

Solution: hold reset line low until kernel boots. That way, MIO state does not matter on boot.

Or alternatively, modify FSBL code to set pull downs instead of pull ups on ULPI interface.

Make sure reset is low until the oscillator input to the chip is stable (not sure if this matters with xtal).
 

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #7 on: April 09, 2023, 02:36:23 am »
Hi
1. We have tried making MIO states low in vivado
2. Reset is low by default and only at psu initialization psu_init, reset is pulsed and kept high

Solution: hold reset line low until kernel boots. That way, MIO state does not matter on boot.  --this we will try and let you know
 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6706
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #8 on: April 09, 2023, 12:52:22 pm »
Just remember you need to release reset at the moment that kernel tries to init USB controller.   Otherwise ULPI self test will fail.  (I believe if it's the same chipidea controller, it writes 0x55 and 0xaa to the scratch register and reads back the value each time.  If either fails, controller is assumed bad and no USB init.)

We just did it by timing how long u-boot took which is very consistent, but you might want to configure u-boot to strobe a GPIO when it hands over to kernel for instance.  Our system has a small PIC which handles booting the FPGA and other things which has allowed us to handle all sorts of Zynq glitches and bugs with just software changes.   :phew:

There's a kernel flag you can turn on in your build as well for extra USB debug which might reveal the cause of issues. 
« Last Edit: April 09, 2023, 12:54:21 pm by tom66 »
 
The following users thanked this post: SiliconWizard

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #9 on: April 10, 2023, 03:58:20 am »
Hi @tom66

If it's taken care in Zynq MIO i.e., MIO(ULPI all signals) pins are default pull down, Do we need special take care of this releasing the reset of when kernel tried to init USB Controller?
Or only for MIO's are pulled up case?


We also have another designed board, where ULPI Signals 1.8V level i.e., VDD and VDDIO of USB3320 is 1.8V, It works seamlessly, without reset control from Zynq IO. Even in there MIO's are default pulled up. We don't have any issues.

Where as in our case, VDD-1.8V and VDDIO is 3.3V. We have issues here.
 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6706
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #10 on: April 10, 2023, 11:53:53 am »
I couldn't say for sure if VDDIO is causing your issue, but if there is a pull up/down conflict then it might behave differently.  We have had 3.3V VDDIO ULPI cause issues on Zynq boards.

You should have the reset released when oscillator is stable and MIOs are in a defined state, which should be the case after u-boot has completed. If you are using the internal xtal oscillator, then you don't have a choice on when you release reset for the oscillator, but you can still make sure you release it when the MIOs are in a well defined state.
 

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #11 on: April 11, 2023, 03:27:09 am »
 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6706
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #12 on: April 11, 2023, 07:59:45 am »
I couldn't tell you for sure as I'm not intimately familiar with u-boot. 
Does the Zynq have access to the reset pin of the USB chip?
 

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #13 on: April 11, 2023, 08:43:56 am »
Hi tom66

Does the Zynq have access to the reset pin of the USB chip? :   Yes, One of MIO64 is connected to the USB Chip reset

We have tried two cases with the default MIO pull from VIVADO

Case1: Kernal loads normally but usb devices are detected after 2-3 mins Note: No reset of usb IC during kernel loading.  For this case I've attached logs
As you can see, For usb detetction, It takes few duration

Case2: Before Kernel, in U-boot usb reset command is initiated and kernel boots, In this case, USB devices are not detected at all

For Both the case, In ps_init (At PS initialization) USB chip reset is pulsed and usb chip is out of reset


We are yet to try the MIO pins default low from Vivado. We will let you know.
 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6706
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #14 on: April 11, 2023, 10:49:25 am »
You of course need to release the reset before the kernel tries to initialise USB.

However it sounds like your USB3320 is working (as in, the ULPI communications are okay) but there is some other issue with USB, like a signal integrity issue.

If you have access to a 500MHz+ oscilloscope you can attempt to probe the ULPI signals and see if those are OK.  If you have a 1GHz+ scope then you can look at the raw USB signalling layer.  You could also try with an old USB hub that only supports USB 1.1, I still keep one around, it forces the USB interface into low/full speed configuration which removes a lot of the USB layer signal integrity issues.

You can also try writing a baremetal program to read and write the ULPI scratch register or if you deregister the ULPI interface from the devicetree you can do this from userspace as root.  Here is a quick example, you will need to modify it to work:

Code: [Select]
#define ULPI_BASE 0xe0002000
#define ULPI_VIEWPORT_OFFS 0x170
#define ULPI_VIEWPORT_ADDR (ULPI_BASE + ULPI_VIEWPORT_OFFS)

#define ULPI_SS (1 << 27)
#define ULPI_RWCTRL (1 << 29)
#define ULPI_RWRUN (1 << 30)
#define ULPI_WU (1 << 31)

/*
 * Wake the ULPI PHY up for communication
 *
 * returns 0 on success.
 */
int ulpi_wakeup()
{
int err;

if (readl(ULPI_VIEWPORT_OFFS) & ULPI_SS)
return 0; /* already awake */

writel(ULPI_WU, ULPI_VIEWPORT_OFFS);

err = ulpi_wait(ULPI_WU);
if (err)
printf("ULPI wakeup timed out\r\n");

return err;
}

/*
 * Issue a ULPI read/write request
 *
 * @value - the ULPI request
 */
int ulpi_request(uint32_t value)
{
int err;

writel(value, ULPI_VIEWPORT_OFFS);

err = ulpi_wait(ULPI_RWRUN);
if (err)
printf("ULPI request timed out\r\n");

return err;
}

int ulpi_write(uint8_t reg, uint32_t value)
{
uint32_t addr = (uintptr_t)reg & 0xFF;
uint32_t val = ULPI_RWRUN | ULPI_RWCTRL | addr << 16 | (value & 0xff);

return ulpi_request(val);
}

uint32_t ulpi_read(uint8_t reg)
{
int err;
uint32_t val = ULPI_RWRUN | ((uintptr_t)reg & 0xFF) << 16;

err = ulpi_request(val);
if (err)
return err;

return (readl(ULPI_VIEWPORT_OFFS) >> 8) & 0xff;
}

`writel` and `readl` are found in kernel source, but essentially just raw read and write at memory address by mmap of /dev/mem.  This is based on the kernel driver for the chipidea controller, but ported over for userspace as kernel can write addresses directly but sudo userspace needs to use /dev/mem to write private memory as it is still protected.  Obviously I do not recommend this for production use, but it is okay for testing.

The scratch register is at 0x16 you should be able to write a value to this and read it back and on the scope you will see ULPI activity on each of these operations.

Note....  I do not know if you are using chipidea ULPI or not.  If you have an AXI USB controller, you would need to change addresses etc. Same if you have a different ULPI driver or USB3.0 etc. 
« Last Edit: April 11, 2023, 10:51:23 am by tom66 »
 

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #15 on: April 17, 2023, 05:17:43 pm »
Hi
We tried with MIO pins pulled down aswell,
Even in both Kernel and U-boot, USB Devices were not getting detected
Only in case of MIO pulled up, in kernel it was getting connected with JTAG connected. when jtag was removed, we observed that USB devices were not detecting
It was flashed and booting from QSPI
 

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #16 on: April 17, 2023, 05:19:36 pm »
 
" There's a kernel flag you can turn on in your build as well for extra USB debug which might reveal the cause of issues. "

Could you also guide me to an example how to implement of kernel flags to see cause of issue?
 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6706
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #17 on: April 17, 2023, 10:18:26 pm »
Unfortunately I don't build kernels myself so I don't know for sure, but it relates to the extra debug you get in the kernel log.  At a guess something related to this...
https://www.kernel.org/doc/html/v4.15/admin-guide/dynamic-debug-howto.html

Our kernel engineer (we use a contractor for this work) just turned it on by request.

If the USB doesn't work until JTAG is connected, that is very strange.  Suggesting some serious hardware issue or signal integrity problem.

Is this a custom board or bought in dev kit etc?  If custom, have you checked ULPI length matched lines, and do you have a series ULPI_clock resistor?  Is the USB D+/D- routed 90 ohms differentially and not crossing ground planes?
 

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #18 on: April 18, 2023, 04:52:53 pm »
Hi,
Yes, It's a custom board.
We have series clock termination resistor at ULPI_CLK
ULPI signals are length matched, I'll confirm the lengths within which are matched.
Yes D+/D- are differentially routed.


You said-" not crossing ground planes?" This means no split ground planes right.  if that is the question, Then yes, there is no split ground planes where the usb signals are routed
 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6706
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #19 on: April 18, 2023, 04:56:21 pm »
You said-" not crossing ground planes?" This means no split ground planes right.  if that is the question, Then yes, there is no split ground planes where the usb signals are routed

Yes, the USB track should be ideally only on one continuous ground plane. A common error I see is routing it across an analog ground plane or similar, which creates an impedance discontinuity at that moment.  If your board only has one plane then you can't make this error.

What value did you use for the ULPI clock resistor?  Have you any way to measure the performance of the signals at the USB3320 end - you would need 500+ MHz scope.
 

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2732
  • Country: ca
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #20 on: April 18, 2023, 05:05:02 pm »
What value did you use for the ULPI clock resistor?  Have you any way to measure the performance of the signals at the USB3320 end - you would need 500+ MHz scope.
ULPI runs at 60 MHz, which is not that fast, so you've got to seriously screw things up for routing to become a problem.
 
The following users thanked this post: tom66

Online tom66

  • Super Contributor
  • ***
  • Posts: 6706
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #21 on: April 18, 2023, 07:20:37 pm »
What value did you use for the ULPI clock resistor?  Have you any way to measure the performance of the signals at the USB3320 end - you would need 500+ MHz scope.
ULPI runs at 60 MHz, which is not that fast, so you've got to seriously screw things up for routing to become a problem.

That's true.   I'm running out of ideas here to be honest - it's a strange issue.
 

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2732
  • Country: ca
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #22 on: April 18, 2023, 07:43:14 pm »
That's true.   I'm running out of ideas here to be honest - it's a strange issue.
Same here. Unless OP is willing to post at least partial schematics which shows all connections around USB PHY, I can't think of anything else at this point. Searching Xilinx forums for USB3320 does yield some weirdness, but I'm not really sure what to make of it, as my experience with Zynq is very limited (and none whatsoever with Zynq MPSoC as they are too damn expensive!).

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #23 on: April 19, 2023, 10:19:08 am »
Hi
Please find the attached Schematic of USB3320 with FPGA (RFSoC)
and ULPI Trace length attached detailed
 
The following users thanked this post: tom66

Online tom66

  • Super Contributor
  • ***
  • Posts: 6706
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #24 on: April 19, 2023, 01:27:31 pm »
I see you are using mixed USB3.0 / USB2.0 interface solution.  Is USB2.0 always failing to initialise, or is this solution only an issue with USB3.0 devices?
Have you ensured section 5.5.3 in USB3320 datasheet is obeyed - VDD1V8 *must* be available before or at same time as VDDIO.
 

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #25 on: April 19, 2023, 05:53:31 pm »
Hi Tom66
Yes we are using USB 3.0 also,
But as of now, USB 3.0/Super speed signals not initialized in device tree. Only concentrating with USB 2.0
Yes, In design we have made sure that VDD 1V8 will come first and then VDDIO 3.3V
I had also attached the PCB trace lengths in mils, Please look into them once.
« Last Edit: April 19, 2023, 05:55:24 pm by LakshmiN »
 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6706
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #26 on: April 19, 2023, 09:32:40 pm »
Trace lengths ~4.7" total, and DATA7 seems oddly shorter than the rest.  Overall, the bus is longer that I would want.  I have heard a general rule of 2" / 5cm max for ULPI unless you really know what you are doing.

The biggest headache with ULPI and longer trace lengths would be the lane turnaround scenario where the FPGA transmits against the clock supplied by ULPI transceiver.  So total latency would be ~10" PCB track, or approx 1ns, clock period of 60MHz is ~16ns, so I suppose it is possible it could slightly marginalise your setup or hold time.  However this is just a guess, I am not intimately familiar with the ULPI standard at the physical layer.  You would be able to test this using an oscilloscope, but as mentioned it needs to be fast enough so that the bandwidth of the scope does not limit your measurement.  Also, it is possible at such long trace lengths that the impedance matching of the interface becomes more of a problem.  The general rule for impedance matching is that your line should be matched if the maximum wavelength exceeds 1/10th the length of track.  You are right up against that limit, especially if you consider referencing to a clock from the ULPI receiver.

Edit: clarification
« Last Edit: April 19, 2023, 09:48:49 pm by tom66 »
 

Offline asmi

  • Super Contributor
  • ***
  • Posts: 2732
  • Country: ca
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #27 on: April 20, 2023, 12:35:47 am »
I didn't see anything obvious on a schematics, the only thing I can't check is if SoC pinout is correct, please double-check your MIO config to make sure it matches what you have on a board.

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #28 on: April 20, 2023, 07:10:12 pm »
"I have heard a general rule of 2" / 5cm max for ULPI unless you really know what you are doing." ---  I've seen in ZCU216 evaluation board trace length upto 6" inches.
SoC Pinouts are correct
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14472
  • Country: fr
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #29 on: April 20, 2023, 07:34:51 pm »
To get setup or hold time issues at 60MHz you would need to seriously screw up the routing. If you couldn't get this right, I wouldn't want to see what you've done with your DDR RAM. :D
 

Offline AndreZheng

  • Contributor
  • Posts: 18
  • Country: cn
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #30 on: April 21, 2023, 12:30:10 am »
Is the 5V VBUS on J7 header available or not?
 

Offline LakshmiNTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: USB3320 Device not able to detect with Zynq RFSoC
« Reply #31 on: April 21, 2023, 03:27:14 am »
Yes, At J7 USB connector 5V is available
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf