SPRUJ53B April 2024 – September 2024 TMS320F28P550SJ , TMS320F28P559SJ-Q1
Most applications do not need to monitor VBus. Because of this, a dedicated VBus monitoring pin was not included on this microcontroller. If you are designing a bus-powered device application or an embedded host application, you do not need to monitor VBus. If you are designing a self-powered device, you need to actively monitor the state of the VBus pin to make sure compliance with the USB specification. In Section 7.1.5 and Section 7.2.1 of the USB Specification Revision 2.0™:
Meeting the above specification is easy because of the slow timing requirements. The hardware part of the VBus monitoring is discussed in this chapter. The corresponding software is discussed briefly, but for examples and an explanation, consult the USB software guide.
The pins of this microcontroller are not 5V tolerant, and because of this, the VBus signal cannot be directly connected to a GPIO pin. Directly connecting 5V to a pin of the microcontroller destroys the I/O buffer of the pin and possibly more of the chip. The most cost-effective way of making any pin capable of reading a 5V input is to use a series resistance in conjunction with the ESD diode clamps already present inside the device on every pin. Also, use a 100kohm series resistor between the VBus signal and the pin chosen to monitor the pin. A diagram of this setup is shown in Figure 24-2.
In Figure 24-2, if VBus is above 3.3V or below 0V, one of the ESD clamp diodes is forward-biased, allowing current to flow through the 100kohm resistor. The purpose of the diode clamps is to protect the pins of the microcontroller from very short over voltage spikes of a high magnitude. The diode clamps do this by clamping the voltage excursion to one of the supply rails. We are effectively requiring the ESD clamps to do the same thing the clamps were designed to do, but instead of a short high magnitude pulse, we are giving the clamps a long low magnitude static value using the 100kohm resistor.
Any pin that has digital input and output functionality can potentially be used to monitor VBus, but the use of an interrupt-capable GPIO is recommended. A pin that does not have external interrupt capability can also be used, but the input state of the pin must be polled periodically by the application software to make sure appropriate action is taken whenever VBus is applied or removed. If an interrupt-capable GPIO is chosen, the GPIO can be configured to generate an interrupt on both the rising and falling edge. More information on external interrupts can be found in the System Control and Interrupts chapter. Example code that implements VBus monitoring using external interrupts and takes the appropriate actions is documented in the USB Software Guide and can be found in the associated USB software package.