Author Topic: PCB Review: RP2040 Breakout with Variable Use USB  (Read 940 times)

0 Members and 1 Guest are viewing this topic.

Offline jcdickinsonTopic starter

  • Newbie
  • Posts: 6
  • Country: us
PCB Review: RP2040 Breakout with Variable Use USB
« on: January 06, 2025, 08:13:18 pm »
Firstly, thank you for taking the time to review my PCB.

I have already made a few PCBs using MCU breakout boards, and have decided the time has come to learn how to use the MCU directly. This RP2040 breakout board is really just that, with a small feature that's relevant to my next project: dual-purpose USB-C. I have tried to build the board as defensively as possible, trying to imagine how hosts could be reasonably out of spec: this may someday be submitted for FCC certification.

This will also be my first stencil + paste + hot plate job (somewhat unavoidable with the QFN components).

Starting with the USB-C port with the single extra feature on the board:

A host device/motherboard (breadboard for now) will have daughterboard-facing USB-C ports that have their CC pins tied to ground (preventing real USB enumeration). This R7 and R8 format a voltage divider to determine whether a real USB host is connected (reboot into DFU) or whether the motherboard is connected (use D+/D- for UART).



Power supply:

Here I am using the TI LMR10510YMF for converting 5v to 3v3 logic level. I opted for a switching power supply because each daugtherboard wil have its own power supply, and could host watt-hungry components, so efficiency is pretty important. Pretty-much a 1:1 copy of the typical application.

No schottky diode between VBUS and the power supply, as there will already be one on the motherboard, and USB-C prevents reverse polarity.



RP2040, Flash, Crystal:

Pretty-much a direct copy of the typical application, optional components included.

Files:

I have attached PDFs for convenience, but the source is also available: https://codeberg.org/jcdickinson/hexkbd/src/branch/main/schematics_new/hexkbd
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11936
  • Country: us
    • Personal site
Re: PCB Review: RP2040 Breakout with Variable Use USB
« Reply #1 on: January 06, 2025, 09:47:53 pm »
You should not connect SBUx to the ground, leave them floating.

Also, your detection scheme will not work all the time. You need to sample both CCx pins, since depending on the orientation only one of them would be high. Also, you may not get enough voltage after the divider. Why even have the divider? Just connect CCx directly to the I/O pins.
Alex
 
The following users thanked this post: jcdickinson

Offline jcdickinsonTopic starter

  • Newbie
  • Posts: 6
  • Country: us
Re: PCB Review: RP2040 Breakout with Variable Use USB
« Reply #2 on: January 07, 2025, 02:05:59 am »
Thank you so much. I failed to mention that I have selected one of the ADC pins, so I can emulate any arbitrary logic level.

I am super concerned about some out-of-spec USB device blowing up the RP2040 if I do that, and I would still need a divider to make sure that the measurement doesn't affect the regular 5.1k negotiation? I really only want to use a single GPIO pin here. With your feedback in mind I approached the problem again with more research. I have also included the host-side components in my schematic, so that I can account for them. I have split the 5.1k resistors each into a voltage divider, and then use another voltage divider between them (to mitigate affecting the resistance required for regular USB/DFU).

2477673-0

I have included the values that the ADC will see for a USB host that uses 5V on the CC line, but 3.3V also checks out (it bottoms out at about 300mV).
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11936
  • Country: us
    • Personal site
Re: PCB Review: RP2040 Breakout with Variable Use USB
« Reply #3 on: January 07, 2025, 02:18:41 am »
Your parallel resistors will affect things way more than ADC or I/O ever could. If you are worried about out of spec devices, then put TVS diodes on CCx lines like you did for D+/D-. 100 kOhm resistors are much better for this if you really want just one channel.

The DFP (host) side does not use 5.1 k Ohm pull-up resistors, the values depend on the voltage so that final levels are much less than 3.3 V regardless of the actual supply on the pull-up side.

I also don't understand 100 kOhm on the Motherboard side.
Alex
 

Offline jcdickinsonTopic starter

  • Newbie
  • Posts: 6
  • Country: us
Re: PCB Review: RP2040 Breakout with Variable Use USB
« Reply #4 on: January 07, 2025, 02:48:19 am »
I also don't understand 100 kOhm on the Motherboard side.

The motherboard will have dedicated ports for daughter devices (and a single regular USB port). The resistor is just there to make sure that USB never works on those ports, that CC is in a defined state, and I don't want it attempting a USB handshake with a UART :). So is this what you are suggesting?

2477705-0
 

Offline Buriedcode

  • Super Contributor
  • ***
  • Posts: 1734
  • Country: gb
Re: PCB Review: RP2040 Breakout with Variable Use USB
« Reply #5 on: January 07, 2025, 02:53:53 am »
Your power supply - look at R18  :(
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11936
  • Country: us
    • Personal site
Re: PCB Review: RP2040 Breakout with Variable Use USB
« Reply #6 on: January 07, 2025, 03:32:53 am »
So is this what you are suggesting?
use two 100 kOhm resistors from each of the CCx pins. Then hard 0 would mean no USB connection and any non-zero value would be a valid USB host.

It is still sketchy, but if this is what you need to do, then do it. Ideally you need to use two different pins.

Another idea to consider is a pair of diodes and a single I/O pin on the other side.
« Last Edit: January 07, 2025, 04:32:33 am by ataradov »
Alex
 

Offline jcdickinsonTopic starter

  • Newbie
  • Posts: 6
  • Country: us
Re: PCB Review: RP2040 Breakout with Variable Use USB
« Reply #7 on: January 07, 2025, 05:48:46 am »
Your power supply - look at R18  :(

Whoops. Only figured that out after making my intent more clear on the schematic. Good catch.

2477835-0

Another idea to consider is a pair of diodes and a single I/O pin on the other side.

I'll have a go at this tomorrow, my main concern is that there are only 4ADCs on the RP2040. 25% of them is a steep cost to pay, especially given that I don't care about orientation. I'm not attached to my ideas in any way, so if you can think of any other solutions please do share.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11936
  • Country: us
    • Personal site
Re: PCB Review: RP2040 Breakout with Variable Use USB
« Reply #8 on: January 08, 2025, 12:29:03 am »
I'm not attached to my ideas in any way, so if you can think of any other solutions please do share.
One other solution is a dual comparator and two digital pins. You can also try to combine comparator outputs into a single signal.
Alex
 

Offline jcdickinsonTopic starter

  • Newbie
  • Posts: 6
  • Country: us
Re: PCB Review: RP2040 Breakout with Variable Use USB
« Reply #9 on: January 08, 2025, 06:15:41 am »
I'm not attached to my ideas in any way, so if you can think of any other solutions please do share.
One other solution is a dual comparator and two digital pins. You can also try to combine comparator outputs into a single signal.

I went with this advice, it's a lot more complicated but "sketchy" got me worried :). Edit, whoops got the voltage divider the wrong way round.

2478393-0
« Last Edit: January 08, 2025, 06:25:59 am by jcdickinson »
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11936
  • Country: us
    • Personal site
Re: PCB Review: RP2040 Breakout with Variable Use USB
« Reply #10 on: January 08, 2025, 02:49:17 pm »
i don't think combining comparators outputs like this will work. For 3.3 V supply Rp values may be 36 kOhm, 12 kOhm or 4.7 kOhm depending on the current supply capabilities.. This results in possible voltages of 0.4 V, 1 V or 1.7 V. So you need to compare with 0.3 V or so. And if either line is higher, then there is a valid host.

But only one line will be high, so if you connect open drain outputs directly, then it will always be 0 V, since one of the lines is always 0 V.
Alex
 

Offline jcdickinsonTopic starter

  • Newbie
  • Posts: 6
  • Country: us
Re: PCB Review: RP2040 Breakout with Variable Use USB
« Reply #11 on: January 15, 2025, 03:08:44 am »
Thanks again, I've been slammed with work so I've only gotten back to this now. I also upped the vref to 0.3V as you suggested. I was being silly attempting to save a GPIO now that it's logic-level input. Each is on a different pin, as you were suggesting from the start |O

Edit: wrong resistor values
« Last Edit: January 15, 2025, 03:23:19 am by jcdickinson »
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11936
  • Country: us
    • Personal site
Re: PCB Review: RP2040 Breakout with Variable Use USB
« Reply #12 on: January 15, 2025, 04:05:12 am »
Yeah, this looks fine.
Alex
 
The following users thanked this post: jcdickinson


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf