ap. How to tackle Hi-Speed USB problems on PIC32MZ EC microcontrollers?

Question:

I found your blog and you could get PIC32MZ2048ECH100 working on USB. If possible, Could you advice me ?

I would like to get revision 5 PIC32MZ2048ECH100 work by hid_keyboard Demo of v.1.00 Harmony ,which is modified from hid_keyboard Demo for PIC32MZ2048ECH144 of pic32mz ec start kit and exists C:\microchip\haramoy\v1_00\app\usb\device\hid_keyboard. I use ver.1.33 XC32 and ver.2.25 MPLAB X.

I could get revision 3 PIC32MZ2048ECH144 of pic32mz ec start kit to work with hid_keyboard Demo. Namely I could get my PC to detect PIC32MZ2048ECH144 of pic32mz ec start kit and display characters of "bcdef..." in the text editor of my PC.

Concernig PIC32MZ, as you know, microchip hid_keyboard Demo is for only PIC32MZ2048ECH144. So in order to make a hid_keyboard Demo for PIC32MZ2048ECH100 , I did the following:

1. I copied hid_keyboard folder for PIC32MZ2048ECH144 and renamed "hid_keyboard_PIC32MZ2048ECH100"

in the same folder.

2. I opend property of "hid_keyboard_PIC32MZ2048ECH100" project and changed the applied device from PIC32MZ2048ECH144 to PIC32MZ2048ECH100.

3. I modified system_init.c for PIC32MZ2048ECH100.

4. I modified bsp_config.h and bsp_config.c for changing Switch ports and Led ports in order to fit the circuit of my target board.

I was able to compile with no warnings. So I could program the hex file of hid_keyboard_PIC32MZ2048ECH100 project to PIC32MZ2048ECH100 on my target board. I connected the USB connectors between my target board and my PC by USB cable. But my PC cannot detect USB port of PIC32MZ2048ECH100. My PC does not do any detective action, namely I cannot see new event on Control Panel-->Device Manager and new something like indicator on my PC desktop.

Why?

Of course PIC32MZ2048ECH100 of my target board works well, for example SPI, I2C, UART...

Should I modify descriptor, too? or Are there more any file being modified?

I attached the picture of my target board.

Any advice make me pleased.

Answer:

It is a good idea to make a helix of D+ and D- cables, if you use wire connections to the USB plug on your prototyping board. The helix solved most of Hi-Speed connection problems for me. If you use PCB, it is important that D+ and D- lines run in parallel and that they are of approximately the same length.

PIC32MZ microcontrollers support Hi-Speed USB 2.0 communications, PIC32MX family only supports Full speed and Low speed. Therefore, it is not a bad idea to double check, if your USB cable and PC USB port support Hi-Speed communications. It is also possible to alter the examples to use Full Speed, only. I have already ported my PIC32MX firmware to PIC32MZ2048ECH100, but now only some finishing touches are needed to make it fully operational. The current alpha version only supports memory I/O functions and Hi-Speed USB 2.0 communications. But you can still access I/O pins and other PIC32MZ2048ECH100 internal functional units registers with ease... If your USB wiring is correct and if you selected s USB port that supports Hi-Speed on your PC, the firmware should work with PIC32MZ2048ECH100 100-pin PIM (VID = 0x4D8, PID = 0xF100). A device should appear in Windows 7 or later a few seconds after you connect the microcontroller to the PC. An error notice or if your microcontroller is not detected indicate a wiring or USB port problem.

Anyway, it is not difficult to adapt most Harmony examples for PC USB Projects basic circuit or even PIC32MZ2048ECH100 to Velleman K8055-1 or K8055N-2 experiment board adaptor, but you have to take into account that PIC32MZ2048ECH100 lacks some I/O pins that are present on PIC32MZ2048ECH144. If you do not want to cope with Microchip demo board functionality, just remove BSP (board support) check mark in Harmony configurator (you still may have to alter some code) or use other I/Os for LEDs and other external test components that are inbuilt in PIC32MZ EC Starter Kit.

I also suggest that you use the latest MPLAB X, XC32 compiler and Harmony library.

ALSO READ:

- Which USB cable do I need to connect my PIC microcontroller to a PC?

- PIC32MZ2048ECx100 - 100-pin PIM basic USB circuit

- PROGRAMMING GUIDE