PIC32MZ2048EFH064 / 100 USB CDC

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
SpeedPIC32
Posts: 252
http://meble-kuchenne.info.pl
Joined: Thu Dec 10, 2020 2:35 pm
Has thanked: 36 times
Been thanked: 17 times

Flowcode v10 PIC32MZ2048EFH064 / 100 USB CDC

Post by SpeedPIC32 »

Hello together

I have the same problem as before with FC9 end of 2021, that I can't get the USB interface of the PIC32 to work. This time in FC10.
I had assumed that the problem no longer exists in FC10, but we are now in the middle of 2023!
Old programmes from fc9 with USB CDC, compile in fc10 only with error.
I have reinstalled Harmoni1.11 without result. is it better with Harmoni V3?
I would like a batch file that changes everything.

Greetings SpeedPic32

Target folder: C:\Users\uwe\Documents\Daten\Flowcode_Projekte
Source name: C:\Users\uwe\Documents\Daten\Flowcode_Projekte\USB CDC.fcfx
Title:
Description:
Device: PIC32.32MZ.32MZ2048EFH064
Generated by: Flowcode v10.0.4.33
Date: Saturday, August 26, 2023 10:55:38
Users: 1
Registriert für: SpeedPic32 (24146314)
Lizenzschlüssel:H7PVJQ
https://www.flowcode.co.uk
Using <PICkit4 IPE External Power> inbuilt settings for compiler
Start des Compilers...
C:\Program Files (x86)\Flowcode\Compilers\pic32\bin\xc32-gcc.exe -mprocessor=32MZ2048EFH064 -O1 -o "C:\Users\uwe\Documents\Daten\Flowcode_Projekte\USB CDC.elf" "C:\Users\uwe\Documents\Daten\Flowcode_Projekte\USB CDC.c"
C:\Users\uwe\Documents\Daten\Flowcode_Projekte\USB CDC.c:460:23: fatal error: CDC_Setup.h: No such file or directory
// .Return = 0
^
compilation terminated.

C:\Program Files (x86)\Flowcode\Compilers\pic32\bin\xc32-gcc.exe Hat den Fehlercode 0xFF gemeldet

Autoclose turned off


BEENDET
USB CDC.fcfx
(8.7 KiB) Downloaded 45 times

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: PIC32MZ2048EFH064 / 100 USB CDC

Post by Steve-Matrix »

Hello.

In your previous post, you made the following comment:
Hello I have it

in the compiler options was for whatever reason a wrong entry set as default, sorry
Can you please explain what the solution was? I think the same solution should fix the issue you are having with v10.

SpeedPIC32
Posts: 252
Joined: Thu Dec 10, 2020 2:35 pm
Has thanked: 36 times
Been thanked: 17 times

Flowcode v10 Re: PIC32MZ2048EFH064 / 100 USB CDC

Post by SpeedPIC32 »

hello Steve-Matrix

i tried to set up my software in FC9 and FC10 according to these instructions.
####################################################################################

Hello,

Right here is what you currently need to do to solve the compilation problem.

1) You need to download and install the Harmony 1.11 library from here. This contains the USB drivers and missing files.

https://www.microchip.com/mymicrochip/f ... e=en597939

Make sure you install the harmony library in the default location C:\microchip\harmony\v1_11

2) In Flowcode click Build -> Compiler options

3) Select the PIC32 programmer you are using ICD3/PICkit3/PICkit4 from the list on the left and then click on the save button at the top right of the window.

4) Give the setting a new name e.g. PIC32 USBSerial

5) Select the new item you have created in the list on the left and change the compiler location to one of the following.

HID
$(compilerpic32)batch\PIC32compHID.bat

Serial
$(compilerpic32)batch\PIC32compCDC.bat

6) Change the compiler parameters to this.

"$(chip)" "$(srcdir)" "$(target)" "$(family)"

7) Tick the "Default compiler for platform" checkbox

8) Click the OK button

9) Next extract and copy the updated compiler scripts to the toolchain folder. C:\Program Files (x86)\Flowcode\Common\Compilers\pic32\batch

###########################################################################################

i have the PIC Kit 4 Programmer.
FC10 I have even reinstalled. I can't get it to work.
I just tested a PIC32MX. 3 guesses. It compiles into FC10 with no errors. As soon as I take an MZ chip, it doesn't work any more. FC9 still does it differently. Compiling works with MX as long as I have USB_Serial in Explora but do not use it in Main. As soon as I only call Init. the compilation aborts.
########################################################################################################
Translated with www.DeepL.com/Translator (free version)

FC10 error

Target folder: C:\Users\uwe\Documents\Daten\Flowcode_Projekte
Source name: C:\Users\uwe\Documents\Daten\Flowcode_Projekte\USB CDC.fcfx
Title:
Description:
Device: PIC32.32MZ.32MZ2048EFH100
Generated by: Flowcode v10.0.4.33
Date: Tuesday, August 29, 2023 14:07:17
Users: 1
Registriert für: SpeedPic32 (24146314)
Lizenzschlüssel:H7PVJQ
https://www.flowcode.co.uk
Using <CDC1> user settings for compiler
Start des Compilers...
C:\Program Files (x86)\Flowcode\Compilers\pic32\batch\PIC32compCDC.bat "32MZ2048EFH100" "C:\Users\uwe\Documents\Daten\Flowcode_Projekte\" "USB CDC" "32MZ"

Project USB CDC
Device 32MZ2048EFH100
Objects USB CDC_32MZ2048EFH100


C:\Users\uwe\Documents\Daten\Flowcode_Projekte>xc32-gcc -mprocessor=32MZ2048EFH100 -DMX_USBHS -IC:\Users\uwe\Documents\Daten\Flowcode_Projekte\. -IC:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 -o "USB CDC_32MZ2048EFH100\USB CDC.o" "USB CDC.c" -DMX_USBHS
USB CDC.c: In function '_IntHandlerUSBInstance0':
USB CDC.c:350:27: error: 'sysObj' undeclared (first use in this function)
DRV_USBHS_Tasks_ISR_USBDMA(sysObj.drvUSBObject);
^
USB CDC.c:350:27: note: each undeclared identifier is reported only once for each function it appears in
USB CDC.c: In function '_IntHandlerUSBInstance0_USBDMA':
USB CDC.c:354:34: error: 'sysObj' undeclared (first use in this function)
#ifdef MX_PIC32_MX
^
Error(s) in build

C:\Program Files (x86)\Flowcode\Compilers\pic32\batch\PIC32compCDC.bat Hat den Fehlercode 0x1 gemeldet

Autoclose turned off


BEENDET
USB CDC.fcfx
(8.5 KiB) Downloaded 45 times

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: PIC32MZ2048EFH064 / 100 USB CDC

Post by medelec35 »

Hello the PIC32compCDC.bat that required replacing has these lines:

Code: Select all

@SET MX_CAL_USB=C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC32BIT\USB\CDC
@SET MX_HARMONY=C:\microchip\harmony\v1_11
Therefore you will need to make sure you change the path for v10:

Code: Select all

@SET MX_CAL_USB=C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC
Also, it's Harmony v1.11 that's installed.

Edit:
I have just installed Harmony v1.11 and compiled your attached project.
Here are the results with the first few lines removed:

Code: Select all

https://www.flowcode.co.uk
Using <USB32> user settings for compiler
Launching the compiler...
C:\Program Files (x86)\Flowcode\Common\Compilers\pic32\batch\PIC32compCDC.bat  "32MZ2048EFH064" "D:\FlowcodeTesting\" "USB CDC" "32MZ"

Project USB CDC 
Device 32MZ2048EFH064
Objects USB CDC_32MZ2048EFH064


D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -DMX_USBHS -ID:\FlowcodeTesting\. -IC:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 -o "USB CDC_32MZ2048EFH064\USB CDC.o" "USB CDC.c" -DMX_USBHS 

D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -DMX_USBHS -ID:\FlowcodeTesting\. -IC:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 "C:\microchip\harmony\v1_11\framework\usb\src\dynamic\usb_device.c" -o "USB CDC_32MZ2048EFH064\usb_device.o" 

D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -DMX_USBHS -ID:\FlowcodeTesting\. -IC:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 "C:\microchip\harmony\v1_11\framework\usb\src\dynamic\usb_device_cdc.c" -o "USB CDC_32MZ2048EFH064\usb_device_cdc.o" 

D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -DMX_USBHS -ID:\FlowcodeTesting\. -IC:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 "C:\microchip\harmony\v1_11\framework\usb\src\dynamic\usb_device_cdc_acm.c" -o "USB CDC_32MZ2048EFH064\usb_device_cdc_acm.o" 

D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -DMX_USBHS -ID:\FlowcodeTesting\. -IC:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 "C:\microchip\harmony\v1_11\framework\system\int\src\sys_int_pic32.c" -o "USB CDC_32MZ2048EFH064\sys_int_pic32.o" 

D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -DMX_USBHS -ID:\FlowcodeTesting\. -IC:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 "C:\microchip\harmony\v1_11\framework\system\devcon\src\sys_devcon.c" -o "USB CDC_32MZ2048EFH064\sys_devcon.o" 

D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -DMX_USBHS -ID:\FlowcodeTesting\. -IC:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 "C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC\CDCComp.c" -o "USB CDC_32MZ2048EFH064\CDCComp.o" 
.


D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -DMX_USBHS -ID:\FlowcodeTesting\. -IC:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 "C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC\CDC_HS_Desc.c" -o "USB CDC_32MZ2048EFH064\CDC_Desc.o" 

D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -DMX_USBHS -ID:\FlowcodeTesting\. -IC:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 "C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC\SYS_TMR_PROXY.c" -o "USB CDC_32MZ2048EFH064\SYS_TMR_PROXY.o" 

D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -DMX_USBHS -ID:\FlowcodeTesting\. -IC:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 "C:\microchip\harmony\v1_11\framework\driver\usb\usbhs\src\dynamic\drv_usbhs.c" -o "USB CDC_32MZ2048EFH064\drv_usbxs.o" 

D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -DMX_USBHS -ID:\FlowcodeTesting\. -IC:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 "C:\microchip\harmony\v1_11\framework\driver\usb\usbhs\src\dynamic\drv_usbhs_device.c" -o "USB CDC_32MZ2048EFH064\drv_usbxs_device.o" 

D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -DMX_USBHS -ID:\FlowcodeTesting\. -IC:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC -IC:\microchip\harmony\v1_11 -IC:\microchip\harmony\v1_11\framework -w -c -ffunction-sections -O1 "C:\microchip\harmony\v1_11\framework\system\devcon\src\sys_devcon_pic32mz.c" -o "USB CDC_32MZ2048EFH064\sys_devcon_pic32mxz.o" 

D:\FlowcodeTesting>xc32-gcc -mprocessor=32MZ2048EFH064 -c -I"C:\microchip\harmony\v1_11\framework\system\devcon\src" "C:\microchip\harmony\v1_11\framework\system\devcon\src\sys_devcon_cache_pic32mz.S" -o "USB CDC_32MZ2048EFH064\sys_devcon_cache_pic32mz.o" 

D:\FlowcodeTesting\USB CDC_32MZ2048EFH064>xc32-gcc -mprocessor=32MZ2048EFH064 -Wl,-T"C:\Program Files (x86)\Flowcode\Common\Compilers\pic32\batch\..\bin\..\pic32mx\lib\proc\32MZ2048EFH064\p32MZ2048EFH064.ld",--defsym=__MPLAB_BUILD=1,--defsym=_min_heap_size=0,--gc-sections  "CDCComp.o" "CDC_Desc.o" "drv_usbxs.o" "drv_usbxs_device.o" "sys_devcon.o" "sys_devcon_cache_pic32mz.o" "sys_devcon_pic32mxz.o" "sys_int_pic32.o" "SYS_TMR_PROXY.o" "USB CDC.o" "usb_device.o" "usb_device_cdc.o" "usb_device_cdc_acm.o" -o "..\USB CDC.elf" 
. .


D:\FlowcodeTesting\USB CDC_32MZ2048EFH064>xc32-bin2hex "..\USB CDC.elf" 

D:\FlowcodeTesting\USB CDC_32MZ2048EFH064>xc32-objdump -t -d  -h "..\USB CDC.elf"  1>"USB CDC.lst" 

D:\FlowcodeTesting\USB CDC_32MZ2048EFH064>xc32-size -B "..\USB CDC.elf" 
   text	 rodata	   data	    bss	    dec	    hex	filename
  24948	    584	    780	    848	  27160	   6a18	..\USB CDC.elf
Compilation successful

Using <USB32> user settings for linker
Launching the linker/assembler...
C:\Program Files (x86)\Flowcode\Common\Compilers\pic32\bin\xc32-bin2hex.exe  "D:\FlowcodeTesting\USB CDC.elf"


FINISHED
Martin

SpeedPIC32
Posts: 252
Joined: Thu Dec 10, 2020 2:35 pm
Has thanked: 36 times
Been thanked: 17 times

Flowcode v10 Re: PIC32MZ2048EFH064 / 100 USB CDC

Post by SpeedPIC32 »

Hello medelec35
I have changed the batch file from
@SET MX_CAL_USB=C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC32BIT\USB\CDC
that made
@SET MX_CAL_USB=C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC32BIT\USB\CDC.

with this change FC10 runs when I compile PIC32 chips.

Thanks for the tip

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: PIC32MZ2048EFH064 / 100 USB CDC

Post by medelec35 »

Hi SpeedPIC32.
Thanks for letting us know FC10 runs when you compile PIC32 Chips.
This thread will be handy for anyone migrating from FC9 to FC10 with PIC32 target devices that use USB.
Martin

Post Reply