# USB Specifications for PCB design.

I'm designing a board with a STM32F103CBT6 chip and I've been trying to figure out how USB works so I can have that extended out. Reading some specifications online has just left me with more questions. From another stack overflow question I got these 2 documents which I'll be referencing in my questions.

Questions:

1. Can 2 USB devices talk to each other if both of them are designated as "Downstream" or "Upstream" devices? 2
2. Rpd and Rpu from 2, are they independent of of Vdd or will they change if your device is running off a different supply voltage?
3. If I'm understanding the Termination resistance correctly, one side of the system has to have 45ohms and the other side equally has to have 45ohms for a total series of 90ohms as specified in 1. What happens if a long cable is involved between the 2 systems and added more resistance? Would USB communication stop working?
4. How do I actually calculate Rs needed to add on the D lines? Are they specified somewhere in the STM32F103 manuals? I've been working from the hardware design guide, reference manual and datasheet for the chip but haven't seen anything on it.
5. The reference manual for my chip specifies it's USB2.0 full speed, which 2 says is 12Mbps communication, however the STM32Cubef1 setup program says 48Mhz is required for the USB clock, why the discrepancy between clock speed and data transmission?

3. Long cables can be a problem, especially in marginal USB implementations. It's not strictly cable resistance that is the enemy though. Loss is a function of several factors, but the characteristic impedance of the cable should be $90\Omega$ differential. The terminator matches this value to prevent reflections in the cable.
4. Here is an example schematic of the Discovery board. They use $22\Omega$ resistors. The Rs termination is occasionally internal to the chip, but that doesn't appear to be the case here. Sometimes it's best to just copy what you find, especially when you know it works!