FC 8.2 + PIC32MZ + USB HID

Moderator: Benj

Post Reply
ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

Hi Ben et al,

Thought of posting this problem here... I've trying for some weeks to get USB HID working on PIC32MZ1023EFE100 without luck. I've tried different things on the batch also without luck...

I've followed the instructions on a Word Document (PIC32 USB Instructions.doc) from 2017 that I found on the Forum referring to Harmony 1.11 (which I found and downloaded - although current Harmony version is 3.x) and Flowcode 7.x (which at the moment its' Flowcode 8.2 I'm using), but compiling doesn't work and well, was just wondering how to get USB HID component to actually work on PIC32MZ and FC8...? Would you have some documentation about this?

Problem is that the Word document talks about FC7 and the FC8 folders are totally different than FC7... :-(

Althought the CAL elements in my FC 8.2 install are under:
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT

I had copied the harmony files in this folder. I have copied the harmony files AND the USB files that are under
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT
into:
C:\Program Files (x86)\Flowcode\CAL\PIC32BIT

And now the first error does not appear any more. However it now complains about MX_MANF_NAME_P32 and MX_PRDCT_NAME_P32, I suppose these need to be "MZ" instead of "MX"?

Anyway, hope this helps as I have no clue how to fix this one...

Code: Select all

Launching the compiler...
C:\Program Files (x86)\Flowcode\Compilers\pic32\batch\PIC32compHID.bat  "32MZ1024EFE100" "D:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1\" "CONTROL_PCB_V1_TEST" "32MZ"

Project CONTROL_PCB_V1_TEST
Device 32MZ1024EFE100
Objects CONTROL_PCB_V1_TEST_32MZ1024EFE100


D:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1>xc32-gcc -mprocessor=32MZ1024EFE100 -DMX_USBHS -ID:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1\. -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\USB\HID -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony\framework -w -c -ffunction-sections -O1 -o "CONTROL_PCB_V1_TEST_32MZ1024EFE100\CONTROL_PCB_V1_TEST.o" "CONTROL_PCB_V1_TEST.c"

D:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1>xc32-gcc -mprocessor=32MZ1024EFE100 -DMX_USBHS -ID:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1\. -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\USB\HID -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony\framework -w -c -ffunction-sections -O1 "C:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony\framework\usb\src\dynamic\usb_device.c" -o "CONTROL_PCB_V1_TEST_32MZ1024EFE100\usb_device.o"

D:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1>xc32-gcc -mprocessor=32MZ1024EFE100 -DMX_USBHS -ID:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1\. -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\USB\HID -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony\framework -w -c -ffunction-sections -O1 "C:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony\framework\usb\src\dynamic\usb_device_hid.c" -o "CONTROL_PCB_V1_TEST_32MZ1024EFE100\usb_device_hid.o"

D:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1>xc32-gcc -mprocessor=32MZ1024EFE100 -DMX_USBHS -ID:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1\. -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\USB\HID -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony\framework -w -c -ffunction-sections -O1 "C:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony\framework\system\int\src\sys_int_pic32.c" -o "CONTROL_PCB_V1_TEST_32MZ1024EFE100\sys_int_pic32.o"

D:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1>xc32-gcc -mprocessor=32MZ1024EFE100 -DMX_USBHS -ID:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1\. -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\USB\HID -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony\framework -w -c -ffunction-sections -O1 "C:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony\framework\system\devcon\src\sys_devcon.c" -o "CONTROL_PCB_V1_TEST_32MZ1024EFE100\sys_devcon.o"

D:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1>xc32-gcc -mprocessor=32MZ1024EFE100 -DMX_USBHS -ID:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1\. -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\USB\HID -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony\framework -w -c -ffunction-sections -O1 "C:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\USB\HID\HIDComp.c" -o "CONTROL_PCB_V1_TEST_32MZ1024EFE100\HIDComp.o"

D:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1>xc32-gcc -mprocessor=32MZ1024EFE100 -DMX_USBHS -ID:\Projects\CASHAR~1\Products\ELECTR~1\U22BEL~2\FC8\CONTRO~1\. -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\USB\HID -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony -IC:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\harmony\framework -w -c -ffunction-sections -O1 "C:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\USB\HID\HID_HS_Desc.c" -o "CONTROL_PCB_V1_TEST_32MZ1024EFE100\HID_Desc.o"
C:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\USB\HID\HID_HS_Desc.c:327:9: error: 'MX_MANF_NAME_P32' undeclared here (not in a function)
         MX_MANF_NAME_P32
         ^
C:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\..\..\CAL\PIC32BIT\USB\HID\HID_HS_Desc.c:344:3: error: 'MX_PRDCT_NAME_P32' undeclared here (not in a function)
   MX_PRDCT_NAME_P32
   ^
Error(s) in build
.

C:\Program Files (x86)\Flowcode\Compilers\pic32\batch\PIC32compHID.bat reported error code 1
Many thanks for your help!
R

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

Any help at all? We are now totally stuck with this, without USB we can't use our hardware :-(

Thanks,
R

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

Hi Ben,

Is this semething that can be fixed soon? We have tried many times playing with the batch files and settings to get this sorted without luck :-(

Thanks,
R

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by stefan.erni »

Hi Ronaldlijs

What kind of hardware do you like to connect?
Did you build it?

regards

Stefan

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

Hi Stefan,

(I've noticed you are a PIC32 user frmo some of your posts)

Linux system... we had this system working flawlessly on PIC16F1454 + dsPIC33EP, we have now migrated to PIC32MZ (FC8 supported) and USB doesn't work at all :-( Bit of a nightmare as we are totally stuck without USB support.

USB HID was the least of of our concerns when we moved to PIC32MZ as we were expecting it to work out of the box.

Regards,
R

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

And yes hardware has been built of course. No issues there.

Problem is when compiling FC8 USB HID component, it simply doens't work and errors out.

R

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by Benj »

Thanks for letting us know.

We are investigating for you.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by Benj »

Hello,

We have made some progress on this and it looks like it's something we can fix. I've not had time to fully sit down and investigate it myself yet so I'll try and do this early next week for you.

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

Ben et al,

No problem, take your time! I've got Harmony 1.x, 2.x and 3.x components installed on my system so if any testing is needed on my end I can assist too...

Cheers!
R

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

Hi Ben,

Trust all is fine, did you have a chance to check this one?

Cheers,
R

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by Benj »

Hello,

Yes I've been investigating further. It all works fine for v7 but we had to change the location of the CAL and component directories on v8 which is adding an extra spanner to the works.

Have you installed Flowcode and the compilers in the default locations?

C:\Program Files (x86)\Flowcode 8
C:\Program Files (x86)\Flowcode\Common

If so we may be able to easily fix this. If not then we may need to come up with a new way to make this work.

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

Hi Ben,

I understand... Yes Flowcode has been installed in the default locations...

Cheers,
R

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

Hi Ben,

Any news on this one?

Thanks,
R

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by Benj »

I'm meeting with a collegue tomorrow who has been exploring this problem and has it working on their machine. There are a number of things that need fixing so we will hopefully be able to solve all the issues tomorrow.

Sorry again for the delay.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by Benj »

Right I think we're there now.

I have made some changes to the USB HID and USB Serial components and pushed these to the update system.

You will also need to extract the attached zip file into your PIC32 compiler folder.

https://www.matrixtsl.com/temp/pic32_USB.zip

Finally you need to go into the Build -> Compiler Options menu in Flowcode and create two new compiler options from the default.

In the compiler tab change the strings to the following.

HID
Location: $(compilerpic32)batch\PIC32compHID.bat
Parameters: "$(chip)" "$(srcdir)" "$(target)" "$(family)"

Serial
Location: $(compilerpic32)batch\PIC32compCDC.bat
Parameters: "$(chip)" "$(srcdir)" "$(target)" "$(family)"

Then simply make sure the right option is set to be the default.

Let me know how you get on.

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

Thanks Ben,

I will give this a try and let you know how it goes, MUCH appreciated!

Regards,
R

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by stefan.erni »

Hi Ben

Ther are many XC32-GCC.exe.
Where is the correct place to copie the 2 folders "batch and harmony"

Location:
C:\Program Files (x86)\Flowcode\Common\Compilers\pic32\bin\xc32-gcc.exe
Parameters:
"$(chip)" "$(srcdir)" "$(target)" "$(family)"

I get this error.
Launching the compiler...
C:\Program Files (x86)\Flowcode\Common\Compilers\pic32\bin\xc32-gcc.exe Parameters: "32MZ2048EFG144" "C:\C#_SOU~1\_#FC\OPTIS_~1\LEDTRE~2\" "Fc8_Leddriver_EFG144_5er_Serie1" "32MZ"
xc32-gcc.exe: error: Parameters:: Invalid argument
xc32-gcc.exe: error: 32MZ2048EFG144: No such file or directory
xc32-gcc.exe: error: Fc8_Leddriver_EFG144_5er_Serie1: No such file or directory
xc32-gcc.exe: error: 32MZ: No such file or directory

C:\Program Files (x86)\Flowcode\Common\Compilers\pic32\bin\xc32-gcc.exe reported error code 255
XC32.PNG
(58.06 KiB) Downloaded 806 times
Folder.PNG
(196.54 KiB) Downloaded 806 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by Benj »

Hello,

The two folders should be placed just inside the PIC32 folder.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by stefan.erni »

Hi Ben

Ok I changed the place,
It's not yet working.
Launching the compiler...
C:\Program Files (x86)\Flowcode\Common\Compilers\pic32\bin\xc32-gcc.exe Parameters: "32MZ2048EFG144" "C:\C#_SOU~1\_#FC\OPTIS_~1\LEDTRE~2\" "Fc8_Leddriver_EFG144_5er_Serie1" "32MZ"
xc32-gcc.exe: error: Parameters:: Invalid argument
xc32-gcc.exe: error: 32MZ2048EFG144: No such file or directory
xc32-gcc.exe: error: Fc8_Leddriver_EFG144_5er_Serie1: No such file or directory
xc32-gcc.exe: error: 32MZ: No such file or directory
C:\Program Files (x86)\Flowcode\Common\Compilers\pic32\bin\xc32-gcc.exe reported error code 255

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by LeighM »

Did you change the compiler location as Ben's earlier post?
Location: $(compilerpic32)batch\PIC32compHID.bat

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by stefan.erni »

Hi Leigh

Yes I tried this, but it didn't work.

I'm looking for USB serial. It's not yet working...
Fc8_Leddriver_EFG144_5er_Serie1.c:522:23: fatal error: CDC_Setup.h: No such file or directory
\*========================================================================*/
^
compilation terminated.
Error(s) in build

C:\Program Files (x86)\Flowcode\Common\Compilers\pic32\batch\PIC32compCDC.bat reported error code 1

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

Hi all,

I'm afraid I have not tried myself the new USB HID component on PIC32MZ yet as we ended up using a dedicated PIC18 for extra €2 just for the USB HID communication with the PC...

It would be great to have USB working on PIC32MZ with FC though...

Regards!
R

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

I have tried compiling wihtout luck :-(

Any chance to get this working at all?

Thanks!
R

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times
Contact:

Re: FC 8.2 + PIC32MZ + USB HID

Post by ronaldlijs »

We can use PIC32MX here as the circuit will be mostly for interfacing, it doesn't need all the MZ features or power... we just needed CAN Bus, USB and many peripherials...

So I have tried PIC32MX530F128H with the USB HID Component and compilation works fine :D
I will go ahead with this MCU and when the boards arrive will report back if USB HID has any issue. It looks as the issue is with the PIC32MZ devices...

On a side note, we've been using PIC16F1454 for the USB interface as it's a $1 MCU and we interface via serial to the PIC32MZ, works perfectly wellm but it's added cost, another MCU to program, etc, etc.

The issue with this setup and Flowcode, if an issue at all, is that we can only set the Transmit Packet Size to 12:
USB_Packet_Size.jpg
USB_Packet_Size.jpg (11.6 KiB) Viewed 6414 times
If we go beyond 12, the program does not compile. Why is this important? Well, for a keyboard like implementation, it sets the amount of "keystrokes" that can be sent simultaneously via the USB stack to the PC. I am eager to try PIC32MX with Flowcode and raise this value to something much larger. I have seen other implementations with PIC32 devices where up to 64 keystrokes can be sent at the same time.

Thanks for your efforts!
R

Post Reply