I'd like to thank you Jan for helping. This is a really technical/arcane question, so anything you can give me helps. This is the final problem to solve before the product is completely done. It works now, but it needs to be able to detect devices on USB when already plugged in and powering on of course. We can't ask everyone to unplug/plug stuff in.
I get the first part of the handshake. The whole handshake doesn't complete though.
It seems like on both boards U1OTGCON.DPPULUP=0 throughout the handshake.
I get into this part on both boards as the first part of the handshake:
if(USBDeviceState == ATTACHED_STATE)
{
/*
* After enabling the USB module, it takes some time for the
* voltage on the D+ or D- line to rise high enough to get out
* of the SE0 condition. The USB Reset interrupt should not be
* unmasked until the SE0 condition is cleared. This helps
* prevent the firmware from misinterpreting this unique event
* as a USB bus reset from the USB host.
*/
if(!USBSE0Event)
{
numtimessofie=1;
USBClearInterruptRegister(U1IR);// Clear all USB interrupts
USBResetIE = 1; // Unmask RESET interrupt
USBIdleIE = 1; // Unmask IDLE interrupt
USBDeviceState = POWERED_STATE;
}
}
But then I don't ever get another event to call: USBDeviceTasks() in USB Generic Driver Demo from Microchip application library for my prototype board, but the explorer gets some more events.
You know what is really strange? Yesterday I did get another event to call it, but U1IR.URSTF was equal to 0(Prototype) instead of 1(explorer-works)