Greetings,
I would like someone at TI to review the modification I'm submitting. We have a situation where the VBus line is 'dirty' (may come and go) when the USB is connected. I realize this is a violation of expected USB behavior. However, when this does happen, the USB stack crashes.
Device is MSP430F5528
This is the modification to UsbIsr.c which we intend to use. The bold is the modification. If approved, it would be nice if this modification made it into the USB developer tool, as the next time we run that tool this change will get over-written.
Thanks for your taking time for this,
Nat
-----------------------------------------
void PWRVBUSonHandler(void)
{
uint16_t MCLKFreq = USB_determineFreq();
uint16_t DelayConstant_250us = ((MCLKFreq >> 6) + (MCLKFreq >> 7) + (MCLKFreq >> 9));
volatile uint16_t i, j;
//wait 1 ms till enable USB
for(j = 0; j < 4; j++)
{
for (i = 0; i < (DelayConstant_250us); i++){
_NOP();
}
}
// If we're enumerated and we see a VBUSon event, modifying
// USBPWRCTL will cause a USB reset and we'll crash hard. Checking for
// USB Bandgap and VBUS valid (USBBGVBV) before modifying USBPWRCTL
// prevents this crash.
if (USBPWRCTL & USBBGVBV)
{
USBKEYPID = 0x9628; // set KEY and PID to 0x9628 -> access to configuration registers enabled
USBPWRCTL |= VBOFFIE; // enable interrupt VBUSoff
USBPWRCTL &= ~ (VBONIFG + VBOFFIFG); // clean int flag (bouncing)
USBKEYPID = 0x9600; // access to configuration registers disabled
}
}