No signal on D+ or D- when I plug the USB
I'm working on the
vendor_pic32mz_ef_sk example to develop a USB device with a PIC32MZ2048EFH144. I'm using an
EasyPIC Fusion v7 by Mikroelektronika configured as the
PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit for the LEDs and SWITCHs. The external clock is the same, 24MHz oscillator, and the USB bus seems to be the same too, except for two 27Ohm serie resistors on D+ and D-, and a 220Ohm resistor and a BAT43 diode in serie on VBUS:
EasyPIC Fusion v7 bus
[See
EasyPIC_Fusion_v7_USB_Bus.png attached]
PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit bus
[See
Starter_Kit_USB_Bus.png attached]
I've loaded the
vendor_pic32mz_ef_sk example on the PIC32MZ but when I plug the USB cable nothing appen: no USB plug sound and no signals on both D+ and D-. The project is configured as High speed device so I espect an high signal on the D+ pin for the speed negotiation. But nothing appen: I checked with oscilloscope on D+ and D- but they are always low.
I'm pretty sure that the USB_DEVICE_EVENT_POWER_DETECTED event is triggered
case USB_DEVICE_EVENT_POWER_DETECTED:
/* VBUS is detected. Attach the device */
USB_DEVICE_Attach(appData.usbDevHandle);
Task_Led_On(); //I turn on the led to confirm the event
break;
and nothing else. But if I check the USBOTG, USBCSR0 and USBCRCON registers before and after I plug the cable, I get:
Cable disconnected
register USBOTG: 00 00 00 80
BDEV = 1: USB is operating as 'B' device
register USBCRCON: 01 00 80 04
USBWK = 1: Connect, disconnect, or other activity on USB detected since last cleared
USBIE = 1: Enables general interrupt from USB module
USBRIE = 1: Enable remote resume from suspend Interrup
register USBCSR0: 00 00 20 00
HSEN = 1: The USB module will negotiate for Hi-Speed mode when the device is reset by the hub
Cable connected
register USBOTG: 00 00 00 98
BDEV = 1: USB is operating as 'B' device
VBUS = 1: Above VBUS Valid
register USBCRCON: 01 00 80 04
USBWK = 1: Connect, disconnect, or other activity on USB detected since last cleared
USBIE = 1: Enables general interrupt from USB module
USBRIE = 1: Enable remote resume from suspend Interrup
register USBCSR0: 00 00 70 00
SOFTCON = 1: The USB D+/D- lines are enabled and active
HSEN = 1: The USB module will negotiate for Hi-Speed mode when the device is reset by the hub
HSMODE = 1: Hi-Speed mode successfully negotiated during USB reset
The VBUS field goes to '11' then the level is valid and the HSMODE goes to '1' too, which means that Hi-Speed mode negotiation occurred!
My first thought was that the internal (?) pull-up resistors on the D+ and D- were not activated (strange, since the
USB_DEVICE_Attach function in the USB_DEVICE_EVENT_POWER_DETECTED was called), so I tryed to hard connect an external pull-up resistor on D+. With that resistor I can get the plug sound from my host PC and I can see some signals on D+ but the host can't recognize it:
[See
USB_Error.png attached]
But at least is a little step forward. I think the problem is at its source.
Why whitout external pull-up resistor the D+ and D- lines are low? It should work without it, right?
And why the HSMODE is set while I have no negotiation signals on D+ or D-?
PS: I've tryed on another PIC and same problem.