I try to use USB keyboard with PIC32MZ1024ECG64 in USB host mode, but the PIC can recognize the keyboard only if the keyboard already connected before I release the PIC from reset. If I disconnect the keyboard and I attach it back then the PIC cannot recognize it, but if I just disconnect the D- and D+ lines only and I connect those lines back then the PIC can recognize the keyboard again. When I disconnect the keyboard (not only D- and D+) and take look the USBOTG register, the PIC switched itself to the USB-B mode and stay in this mode. I using MPLAB Harmony with 1.06 library. The VBUS3V3 pin connected to 3,3V supply, the VBUS pin connected to 5V supply and the USBID pin connected to the ground.
Anybody has any idea why the PIC switching itself to the USB-B mode when I disconnect the USB connector of the keyboard?
Any suggestion will be appreciated.
Br, Viktor Venczel