USB CDC Error

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

Flowcode v11 USB CDC Error

Post by SpeedPIC32 »

Hello everyone,
My CDC error persists in FC 11.
Is Harmony V1.11 still being used, or is it V3?
Here is my error message:

C:\Users\Uwe\Documents\Matrix\OIT\Oit-Heizung_18_neu.c: In function '_IntHandlerUSBInstance0':
C:\Users\Uwe\Documents\Matrix\OIT\Oit-Heizung_18_neu.c:9540:27: error: 'sysObj' undeclared (first use in this function)
C:\Users\Uwe\Documents\Matrix\OIT\Oit-Heizung_18_neu.c:9540:27: note: each undeclared identifier is reported only once for each function it appears in
C:\Users\Uwe\Documents\Matrix\OIT\Oit-Heizung_18_neu.c: In function '_IntHandlerUSBInstance0_USBDMA':
C:\Users\Uwe\Documents\Matrix\OIT\Oit-Heizung_18_neu.c:9544:34: error: 'sysObj' undeclared (first use in this function)

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

medelec35
Matrix Staff
Posts: 2191
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 665 times
Been thanked: 743 times

Re: USB CDC Error

Post by medelec35 »

Hello.
Can you please upload all the files mentioned on this post.
Then we can see if we can sort out the issue for you.
Martin

SpeedPIC32
Posts: 304
Joined: Thu Dec 10, 2020 2:35 pm
Location: Germany
Has thanked: 41 times
Been thanked: 18 times

Re: USB CDC Error

Post by SpeedPIC32 »

Hello medelec35
Still no solution for USB CDC?
That's really sad.
In your wiki on USB Serial, you use a PIC that doesn't have a USB interface. I switched to FC11 specifically because I hoped that the USB interface would work here. I reinstalled everything and it still doesn't work.

Now it's your turn. You are also welcome to access my computer remotely. Unfortunately, I don't speak English and use a translator.
So get to work! Best regards,
SpeedPic32

Translated with DeepL.com (free version)

SpeedPIC32
Posts: 304
Joined: Thu Dec 10, 2020 2:35 pm
Location: Germany
Has thanked: 41 times
Been thanked: 18 times

Re: USB CDC Error

Post by SpeedPIC32 »

I reinstalled everything, but it still doesn't work.
Target folder: C:\Users\Uwe\Documents\Matrix\OIT
Source name: C:\Users\Uwe\Documents\Matrix\OIT\efhcdc test.fcfx
Title: Neues eingebettetes Projekt
Description:
Device: PIC32.32MZ.32MZ1024EFM144
Generated by: Flowcode v11.0.0.8
Date: Friday, November 14, 2025 17:03:32
Users: 1
Registriert für: SpeedPIC32 (24146314)
Lizenzschlüssel:MP62C5
https://www.flowcode.co.uk
Using <cdcusb> user settings for compiler
Start des Compilers...
C:\Program Files (x86)\Flowcode\Compilers\pic32\batch\PIC32compCDC.bat "32MZ1024EFM144" "C:\Users\Uwe\Documents\Matrix\OIT\" "efhcdc test" "32MZ"

Project efhcdc test
Device 32MZ1024EFM144
Objects efhcdc test_32MZ1024EFM144


C:\Users\Uwe\Documents\Matrix\OIT>xc32-gcc -mprocessor=32MZ1024EFM144 -DMX_USBHS -IC:\Users\Uwe\Documents\Matrix\OIT\. -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 "efhcdc test_32MZ1024EFM144\efhcdc test.o" "efhcdc test.c" -DMX_USBHS
efhcdc test.c: In function '_IntHandlerUSBInstance0':
efhcdc test.c:376:27: error: 'sysObj' undeclared (first use in this function)
DRV_USBHS_Tasks_ISR_USBDMA(sysObj.drvUSBObject);
^
efhcdc test.c:376:27: note: each undeclared identifier is reported only once for each function it appears in
efhcdc test.c: In function '_IntHandlerUSBInstance0_USBDMA':
efhcdc test.c:380: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

BenR
Matrix Staff
Posts: 2000
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 524 times
Been thanked: 711 times

Re: USB CDC Error

Post by BenR »

Hello,

I'm re-installing Harmony now to see if I can replicate the issue you're seeing.

SpeedPIC32
Posts: 304
Joined: Thu Dec 10, 2020 2:35 pm
Location: Germany
Has thanked: 41 times
Been thanked: 18 times

Re: USB CDC Error

Post by SpeedPIC32 »

CDCTest .fcfx
(9.39 KiB) Downloaded 1 time
Target folder: C:\Users\Uwe\Documents\Matrix\OIT
Source name: C:\Users\Uwe\Documents\Matrix\OIT\CDCTest .fcfx
Title:
Description:
Device: PIC32.32MZ.32MZ2048EFH144
Generated by: Flowcode v11.0.0.8
Date: Tuesday, November 18, 2025 12:23:21
Users: 1
Registriert für: SpeedPIC32 (24146314)
Lizenzschlüssel:MP62C5
https://www.flowcode.co.uk
Using <cdcusb> user settings for compiler
Start des Compilers...
C:\Program Files (x86)\Flowcode\Compilers\pic32\batch\PIC32compCDC.bat "32MZ2048EFH144" "C:\Users\Uwe\Documents\Matrix\OIT\" "CDCTest " "32MZ"

Project CDCTest
Device 32MZ2048EFH144
Objects CDCTest _32MZ2048EFH144


C:\Users\Uwe\Documents\Matrix\OIT>xc32-gcc -mprocessor=32MZ2048EFH144 -DMX_USBHS -IC:\Users\Uwe\Documents\Matrix\OIT\. -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 "CDCTest _32MZ2048EFH144\CDCTest .o" "CDCTest .c" -DMX_USBHS
CDCTest .c: In function '_IntHandlerUSBInstance0':
CDCTest .c:272:27: error: 'sysObj' undeclared (first use in this function)
DRV_USBHS_Tasks_ISR_USBDMA(sysObj.drvUSBObject);
^
CDCTest .c:272:27: note: each undeclared identifier is reported only once for each function it appears in
CDCTest .c: In function '_IntHandlerUSBInstance0_USBDMA':
CDCTest .c:276: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

SpeedPIC32
Posts: 304
Joined: Thu Dec 10, 2020 2:35 pm
Location: Germany
Has thanked: 41 times
Been thanked: 18 times

Re: USB CDC Error

Post by SpeedPIC32 »

Google Gemini
It looks like you're encountering a compiler error when trying to build your Flowcode project, CDCTest.fcfx, for the PIC32MZ2048EFH144 microcontroller.

The error messages are:

CDCTest .c: In function '_IntHandlerUSBInstance0': CDCTest .c:272:27: error: 'sysObj' undeclared (first use in this function) DRV_USBHS_Tasks_ISR_USBDMA(sysObj.drvUSBObject);

CDCTest .c: In function '_IntHandlerUSBInstance0_USBDMA': CDCTest .c:276:34: error: 'sysObj' undeclared (first use in this function)

🛠️ Analysis and Solution

The core issue is that the variable sysObj is being used inside the USB interrupt handler functions (_IntHandlerUSBInstance0 and _IntHandlerUSBInstance0_USBDMA) but has not been declared or is not visible (in scope) within those functions.

In Microchip's Harmony framework (which is referenced in the compiler path IC:\microchip\harmony\v1_11), the sysObj structure typically holds system-wide object handles, including the USB driver object (sysObj.drvUSBObject). This variable is usually declared in a main system initialization file.

Probable Cause

The problem likely stems from an issue in how Flowcode 11 is generating the C code (CDCTest.c), specifically regarding the inclusion of necessary header files or the correct declaration/scoping of the sysObj structure when using the <cdcusb> component with the PIC32MZ device, especially when relying on Harmony libraries.

Recommended Fix (Action in Flowcode)

Since this is an automatically generated file by Flowcode, you cannot typically fix the C code directly without the changes being overwritten. The fix must be made within the Flowcode environment or by ensuring the correct settings are used:

Check the <cdcusb> Component Settings:

Open your CDCTest.fcfx project in Flowcode 11.

Examine the properties of the CDC USB component. Ensure all settings related to the PIC32MZ2048EFH144 device and its clock/USB configuration are correct and complete.

Sometimes, changing a minor setting (like re-selecting the device or the USB module) can force Flowcode to regenerate the C code template correctly.

Ensure Flowcode is Up-to-Date:

Make sure you are running the latest minor revision of Flowcode 11 (v11.0.0.8 is listed, but check for any newer patches/updates). Compiler issues like this are often fixed in updates.

Check Harmony/Compiler Path Integrity:

The build log shows: IC:\microchip\harmony\v1_11. Ensure this path is correct and that the necessary Harmony framework files (which define sysObj) are intact. A corrupt or incomplete Harmony installation could cause this.

Try a Clean Build:

In Flowcode, try using the 'Clean Project' option (if available) or manually delete the generated CDCTest _32MZ2048EFH144 folder before compiling again. This ensures a fresh code generation.

Seek Flowcode/Matrix Support:

If the above steps don't resolve it, this is a bug in Flowcode's code generation for the PIC32MZ CDC USB library. You should report this issue to Matrix Technology Solutions (Flowcode developers), providing them with your project file and the build log.

Would you like me to search for documentation or known issues related to Flowcode 11's CDC USB component on the PIC32MZ?

Post Reply