Advice on a custom USB device - Page 1
Forum section: electronics / general

author: xylo04
author_rank: Contributor
timestamp: March 18, 2021, 11:04:17 am
content: Hi folks! I'm a software engineer by day and a radio amateur, but I dabble in electronics. I'm working on a OSHW project right now which is basically meant to cram several USB devices into one.The project is published athttps://github.com/k0swe/tx500-data-interface.To interface a ham radio with a computer for digital modes, you generally need two things:a serial UART for controlling frequency, mode, transmit/receive, etc, anda duplex audio signal for received and transmitted digital data (very similar to a modem).Right now I accomplish this with an FTDI cable and a cheap USB sound card plugged into a hub. I want to make a rugged device that has a USB hub controller, UART and audio chip integrated on one PCB. The closest consumer device to compare this to is the Yaesu SCU-17.I have a design started in KiCad, but this is only my second custom PCB, and it's the first design I've done with ICs and USB buses. I'm eager to get advice on anything that can be improved, but I have a couple of specific concerns:Are my uses of power regulation, decoupling caps, signal filtering, etc appropriate? I followed the application notes for my hub controller and UART, but I'm not an EE and don't actually know what I'm doing.The audio chip I'm using, the Cmedia HS-100, doesn't have application notes in its datasheet. I currently have minimal supporting circuitry around it. Do I need to add anything obvious? There's some debate in the amateur radio community in general about adding transformers to audio lines like this.If it helps, I'm trying to optimize for simplicity, small size and ruggedness. This is meant to be in use near RF, but right now I'm only targeting low power operation (QRP), which is 10 W or less of transmitted RF. This is not a consumer device, so I'm currently dispensing with overcurrent and ESD protection. Let me know if I'm going to regret that!

author: teksturi
author_rank: Regular Contributor
timestamp: March 18, 2021, 11:55:03 am
content: Usually it helps if you give us pdf or jpg straight to this site. People are lazy and do not bother to open someone else project files especially when they do not even know if they are interested. This way you will get more input.I look your schematic a little bit, but it was too hard to check because it was 6 pages. This would probably fit one A4. That will make it more readable. You can still split one A4 to sections and write headers to thous. Of course this is little bit personal preference but I think no one puts just one usb connector to one A4 page.

author: xylo04
author_rank: Contributor
timestamp: March 18, 2021, 12:32:04 pm
content: Thanks for the meta-advice. Bad habits from programming.I've restructured the schematic and attached it here. I couldn't quite fit everything on one page, but it's down to two.

author: teksturi
author_rank: Regular Contributor
timestamp: March 18, 2021, 02:51:27 pm
content: Quote from: xylo04 on March 18, 2021, 12:32:04 pmI try it and it will fit. How does this look? I still leave it upto you if you wanna do this. But still very good start

author: xylo04
author_rank: Contributor
timestamp: March 18, 2021, 03:08:37 pm
content: Thank you, that looks very good!Any advice on structural changes?

author: elias
author_rank: Newbie
timestamp: March 18, 2021, 11:13:00 pm
content: The design looks fine to me, I'm just a bit concerned about the way you are mixing the Left and Right channel outputs. I would either expose both channels individually or mix them using a pair of resistors, if not a an OP-Amp.But I'm no expert in this matter, what you are doing may be perfectly fine, just pointing it out so maybe somebody with greater knowledge can comment.

author: teksturi
author_rank: Regular Contributor
timestamp: March 18, 2021, 11:14:19 pm
content: These are just best of my understanding and can be totally false claiming.U1 needs decoupling capacitor.USB hub port needs 120uF as it is minimum required (USB specification)100uF was reference design but thous where low ESR tantalums.You didn't have datasheet for TPS76333You do not have capacitor at VOUT at TPS76333 (Check datasheet)You might even change design that you do not have TPS76333 at all.FT232 can make 3V3 so you can use that to power TUSB2036.Datasheet says you can draw 50mA from that and TUSB2036 use 40mA.I do not know how much J2 other end draws.It will be close and is up to you to decide if you wanna use this.If this is my design. I would design it so that I can use both ways.Just add 0ohm resistor from FT232 output to 3V3 rail. If this notwork then populate TPS76333. Remember to still add needed caps.I think usb shields should be connected together. Other wise whenyou connect some random device with long cable it.I really like idea that FT232 external supply voltage can beselectable. See datasheet section 6.4. You can use 0ohm resistorto jumper. Of course this is just idea and I would probably dothis this way. Also if you have room in your pcb add leds for txand rx. You do not even have to populate these but if something isnot working you can populate them.I check these quickly. Check them againMUTEP should be pulled lowVOLUP should be pulled lowVOLDN should be pulled lowDR maybe pull up? Good idea to make it easy to change after.MUTER should be pulled lowAdd led also for this. I think you have much room in your pcb.I also think that XREGXX pins may need caps. Else they can evenoscillate. Good idea to be safe and caps there. No need to populateright away. If you know you do not need them please leave them awayput it wasn't sure to me.Add test point for 3V3.Example U2 cap between trace and pins are super low. You have room somake it bigger. Same thing with many places. No need to use minimumwhat your pcb manufacturer say. That is minimum for reason. When youdo it like this (minimum caps) you are playing game which you canether draw or lose. Do not play that gameYou have lot of room in your pcb. Redo your designators. Maybe everytext can be even right way. Maybe also add better pin 1 indicator foric's.Be careful with your mounting holes. Right now they are in F.mask layer.There might be lot of other things. But this was just small checking hopeit helps.

author: mon2
author_rank: Frequent Contributor
timestamp: March 19, 2021, 02:59:50 am
content: My 2 bits:1) the ESD protection devices on the USB lines is missing - review the TI ESDS312 - amazing device with high levels of protection.2) when the time comes to the PCB layout, be sure to note that you must apply impedance controlled traces for the USB 2.0 HS lines. Many articles on the internet on this subject. Your PCB shop should be able to support this requirement of 90 ohms and validate with a TDR report.3) Why are there caps on the D+ and D- lines? This may be a violation of the USB spec. Have never used them in any of our designs for USB 1.1 / 2.0 / 3.1 to date.4) Consider to insert an EMI filter on the USB lines like from Littlefuse, etc. You can source them locally to get started and migrate to offshore when the volume picks up at a fraction of the cost.Here are some (dated) offers on these filters:QuoteAbove is from Kingcore (Taiwan).5) As you are using only the TX & RX lines for the USB serial port - you could reduce this chip down to the very low cost device from WCH.Review CH340N (8 pin SOIC; no xtal required) @ $0.50 USD or less in single qty.http://wch-ic.com/products/CH340.htmlIf you select the USB to Serial bridge properly, then it will be possible to install on Windows 10 / MAC, etc. without a driver if the bridge is a 'CDC Class' device. Best to review the datasheet for this confirmation. You can also check Maxlinear (aka Exar) USB Uarts.Cannot recall if the WCH CH340N is CDC or not at this time but they offer a mix of such solutions.6) U4 LDO is not enabled as the EN pin is floating. It should connect to VIN to enable.7) TI is a good company but there are other competitive and more mature options like Microchip who purchased SMSC and SMSC was a great and pioneering company for the USB markets. Do review their USB hub offerings as well. You can also consider offshore brands but did not really find the savings to be great so better to stay with Microchip, etc. brands.

author: xylo04
author_rank: Contributor
timestamp: March 19, 2021, 09:47:19 pm
content: Many thanks to those who responded!Quote from: elias on March 18, 2021, 11:13:00 pmI'm doing this currently by tying L and R inside the audio and it does work, but I don't actually know that this is a good way to do it. Looking for further input here.Quote from: teksturi on March 18, 2021, 11:14:19 pmAssume you mean on USB port 0? Added C19Quote from: teksturi on March 18, 2021, 11:14:19 pmModified C11, C16 and C17 from 100 to 120.Quote from: teksturi on March 18, 2021, 11:14:19 pmAdded to repoQuote from: teksturi on March 18, 2021, 11:14:19 pmAdded C18Quote from: teksturi on March 18, 2021, 11:14:19 pmInteresting idea! I think for now I'll stick with using the TPS76333, but I'll make a note to try this in the future.https://github.com/k0swe/tx500-data-interface/issues/6Quote from: teksturi on March 18, 2021, 11:14:19 pmAdded GND1 as a case ground. On the PCB this includes an exposed strip that should contact with the enclosure.Quote from: teksturi on March 18, 2021, 11:14:19 pmAddedhttps://github.com/k0swe/tx500-data-interface/issues/7to track this suggestion, thanks!Quote from: teksturi on March 18, 2021, 11:14:19 pmAddedhttps://github.com/k0swe/tx500-data-interface/issues/8to add LED footprints for both FT232R and HS-100B.Quote from: teksturi on March 18, 2021, 11:14:19 pmFixed designator directions and pin 1 indicatorsQuote from: teksturi on March 18, 2021, 11:14:19 pmActually, I don't have mounting holes since I'm using a slide-in enclosure. I think you're seeing the fiducials for aligning the solder paste stencil.Many thanks! I'll keep working on these suggestions!

author: xylo04
author_rank: Contributor
timestamp: March 20, 2021, 02:30:43 am
content: Quote from: mon2 on March 19, 2021, 02:59:50 amAdded U6 and U7. I was going to go without them and still might mark them as "optional" but at least having pads for ESD protection makes sense. I added them to the two USB ports as well as the UART TX/RX and audio SPKR/MIC, hopefully that's appropriate.Quote from: mon2 on March 19, 2021, 02:59:50 amI will try to follow this if possible. I'm using KiCad's differential traces which seem to try to do this.Quote from: mon2 on March 19, 2021, 02:59:50 amThey're shown in the TUSB2036 application notes. If I can get away without those that would be great; I'm using larger parts and they take up a lot of real estate.Quote from: mon2 on March 19, 2021, 02:59:50 amThanks for the tip. I might skip this for V1, but assuming this works for my low-power radio application, I will probably need to harden it for use in high-RF environments.Quote from: mon2 on March 19, 2021, 02:59:50 amThanks again for the part recommendation. I am concerned about having this install with as little friction as possible. Again, I'll probably stick with FTDI for V1 since I know it's a high-quality part but I'll have to circle back on that.Quote from: mon2 on March 19, 2021, 02:59:50 amFixed.

author: pigrew
author_rank: Frequent Contributor
timestamp: March 20, 2021, 05:58:23 am
content: My understanding is that a USB device can have a max of 10 uF directly on Vbus. With this schematic, it has 125 uF. The way around this is some sort of soft-start. I'd suggest adding a load switch for the "extra" USB port (which would implement soft-start itself, and also over-current protection) (Oh... seems you did this on the GitHub schematic)One datasheet for the HS-100B says to connect the Vref pin to an external capacitor (10nF is a wild guess). I can't find any sort of documentation for which value to use... I'd imagine that each of the regulator outputs also should have a decoupling capacitor (2.2uF is a wild guess). Is there a reference design schematic? (I see there is an evaluation board available, but I can't find the schematic for it... You could buy it and reverse engineer it.)Quote from: mon2 on March 19, 2021, 02:59:50 amFor HS, I think impedance control probably doesn't matter, as long as the USB tracks are short (like less than 4cm, which is feasible.). The rise time is ~500ps. Guestimate 15 cm/ns prop velocity. So, you might want the track to be less than 250ps long, so 3.75cm max length. That being said, you should try to target 90 ohm. The spec allows +/-10%. The skew is probably more important. Try to length-match to within a few mm.However, the hub is only full speed, so it'll be fine, up to quite a few cm.The USB data-line capacitors are for EMI reduction and also ESD immunity. I would not populate them for the on-board USB devices, but I would use the one going to the USB port.The hub's BUSPWR should be low, since you are provide current from the upstream USB connection.It's very debatable if the USB shield should be shorted to the USB GND, or not. I recently went through my pile of USB cables and most of them had open shields, so it probably doesn't matter.

author: teksturi
author_rank: Regular Contributor
timestamp: March 21, 2021, 12:43:32 am
content: So have you check that almost everything can really left floating with audio ic?I say about that in my previous post.I also notice that you still have some unconnected ground in pcb design. Maybeyou are still working with it? When you make new post here you can also addnew picture for schematic. Also you can add image(s) for layout also.You have made good progress with this one. Nice to notice that you take inputand not just say that you have already do the layout and do not want to do itagain. Nice job.

author: xylo04
author_rank: Contributor
timestamp: March 22, 2021, 05:59:00 am
content: Quote from: pigrew on March 20, 2021, 05:58:23 amThe 120 uF value is coming out of the TUSB2036 datasheet, as well as mon2's advice above. However, I did find that I need to change the package type as that value doesn't come in 1210.Quote from: pigrew on March 20, 2021, 05:58:23 amThis is one of my biggest problems at the moment, the HS-100B doesn't have good application notes or eval board schematics. CMedia sells a slightly more expensive USB audio chip, the CM108, which does have decent documentation:http://rats.fi/wp-content/uploads/2016/04/CM108_DataSheet_v1.6.pdf. I'm considering switching to that chipset.Quote from: pigrew on March 20, 2021, 05:58:23 amIf this is the case, maybe I can move those caps to the TX/RX and SPKR/MIC lines since those are at the edge of the board?Quote from: teksturi on March 21, 2021, 12:43:32 amYou did mention it. I'm hesitating to add a bunch of pull-ups for everything because my board is starting to get a bit crowded. The application note for the CM108 (linked above) suggests that those probably have internal pull-ups. However, that doesn't mean I'm going to ignore your advice.I'm starting to feel like I don't understand these chips well enough to make a super tiny PCB with all three immediately. I'm going to take a step back and basically build my own eval boards for each of the three major functions and make sure each works separately. That should give me a chance to test each in isolation and give me confidence to know that I understand what each chip needs, without the pressure of fitting my desired form factor. That way, I can experiment with 0-ohm resistors and test points galore on a larger surface.Thank you all again, I'm excited that this project is moving forward!

author: pigrew
author_rank: Frequent Contributor
timestamp: March 22, 2021, 01:27:10 pm
content: Quote from: xylo04 on March 22, 2021, 05:59:00 amThe distinction is device-side or host-side. The device should have betwen 1 and 10uF, but the host should have larger. The host must have >=120uF. These values are from the USB 2.0 spec, table 7-7 on page 179.Quote from: xylo04 on March 22, 2021, 05:59:00 amhttps://www.cirmall.com/circuit/13967shows a schematic with the IC. They let you download the files, if you login with QQ or Weibo (which I don't really want to do....). You likely could email CMedia and ask for the schematic for their demo board. You can also order the demo board, and then reverse-engineer it (measure capacitor values).Quote from: xylo04 on March 22, 2021, 05:59:00 amI'd just get rid of them. Although, adding ESD protection for the analog audio pins wouldn't be a bad idea. The implementation would be different (maybe TVS diodes and series resistance).

author: xylo04
author_rank: Contributor
timestamp: March 22, 2021, 10:07:31 pm
content: Quote from: pigrew on March 22, 2021, 01:27:10 pmOk, so I think you're saying in thecurrent version of the schematic, C19 should not be on the upstream port, that C3 and C4 are ok because they are <10uF combined, and that C11, C16 and C17 are in-spec for the downstream ports. Do I want to keep C11 and C16 on the hardwired devices, or can I remove them and only keep C17 for the downstream socket?With regards to trying to break up the project to verify that I know how to use the ICs individually, I've attached two schematics, one for the TUSB2036 hub, and the other for the HS-100B's cousin, the CM108B USB audio controller. Both of these match reasonably well to their application notes, and should have enough room and jumpers and test points to let me verify that each individually is working. I'll make one for the FT232 as well, although that one is well-documented enough that I probably don't have to bore you all with that.I did have to do a little bit of guesswork on the CM108B board. The datasheet for the B version of the chip doesn't have application notes, so I'm relying on application notes from the original CM108 (datasheet). I removed the crystal, SPDIF, EEPROM and some other things that were unnecessary. Unfortunately, I'm confused by the way some of the capacitors are marked. Several caps are marked "101", "104", "105", and "475". I thought those might be in pF, but they're not common values. Maybe they refer to a BOM that's not provided?

author: pigrew
author_rank: Frequent Contributor
timestamp: March 22, 2021, 11:17:53 pm
content: Quote from: xylo04 on March 22, 2021, 10:07:31 pmRight... (C19+C3+C4+C20) (device-side) must sum to less than 10 uF, unless you add a soft-start circuit (<10uF would be on the bus side, and you could have as much capacitance as you want on the load side). Your load switch should count as soft-start, so you likely could use its fourth channel as a soft-start for other bits of your circuit.Load switch U5B's enable pin probably shouldn't be floating. Connect it to VDD through a pull-up resistor to VBUS.Those cap values should be in exponential notation of pF. 101 would be 10*10^0 pF = 10 pF. 104 would be 10*10^4 pF = 100nF, 105 = 1 uF.

author: xylo04
author_rank: Contributor
timestamp: April 26, 2021, 11:12:55 pm
content: Time for an update! I decided there were enough unknowns that I should take a step back and play with the three major sections of the project separately: the USB hub, UART and audio. In that way, I figured I could validate each independently and make sure I understood the individual pieces before putting them together.I've published 4 additional repos:UART:https://github.com/k0swe/ft232r-evalTwo versions of the sound card,https://github.com/k0swe/hs100b-evalandhttps://github.com/k0swe/cm108b-evalUSB hub:https://github.com/k0swe/tusb2036-evalSo far the FT232R and the CM108B work flawlessly according to expectation. I haven't built the HS100B version, but I'm starting to lean toward the CM108B anyway since it has GPIO pins I can use for a push-to-talk (PTT) circuit.However, I'm having trouble with the TUSB2036 hub I built. When I attach it to a host, it doesn't enumerate. I've checked voltages in several places and it seems to be getting power, it's just not talking to the host. I think my next step is to stop by my makerspace and get comfy with the oscilloscope to see what I can learn, maybe starting by verifying the 6 MHz crystal is running as expected. Maybe I inadvertently fried the chip? I'm not quite sure what I'm looking for at this point.One part that confused me about the TUSB2036 datasheet is that the application notes all include a placeholder "System Power-On Reset" on the RESET pin. Do I need something extra to pull this up or down after an initial timer? I don't know what to do with that placeholder. I have a push-button on it now, but that's not doing much to help.I'll keep muddling along, but I would be glad for advice. Thanks to those who have already helped me out!

author: pigrew
author_rank: Frequent Contributor
timestamp: May 04, 2021, 06:01:13 pm
content: Quote from: xylo04 on April 26, 2021, 11:12:55 pmBased on the datasheet, there is no internal pull-up, so your reset pin is being left floating.You probably can get away with a RC filter as a reset (capacitor to GND, resistor to 3.3V, time constant of a millisecond or so). Otherwise, you buy a power supply supervisor IC with a suitable time delay.TI has reference schematics downloadable from their product page ("design tools & simulation" category). They use a RC filter for reset (15k + 1uF).

author: xylo04
author_rank: Contributor
timestamp: May 04, 2021, 09:28:27 pm
content: That's very helpful, thank you!

author: xylo04
author_rank: Contributor
timestamp: June 03, 2021, 08:37:57 pm
content: Probably final update on this: it's working!https://github.com/k0swe/mountaineerThanks to all of the advice here, it was an enormous help!