Page 1 of 1

PIC32MX + USB HID + CAN Doesn't Compile

Posted: Tue Sep 22, 2020 10:13 pm
by ronaldlijs
I've got a simple program with both USB HID and CAN Bus (Internal) Component on PIC32MX530F128H.

The program compiles fine with just USB HID component.
The program compiles also fine with just CAN (Internal) component.
But it gives an error when both components are present in the program.

Code: Select all

D:\Projects\Apora\Products\BEHEMO~1\v5.0\FC8\PIC0_U~1>xc32-gcc -mprocessor=32MX530F128H -DMX_USBFS -ID:\Projects\Apora\Products\BEHEMO~1\v5.0\FC8\PIC0_U~1\. -I"C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT\USB\HID" -I"C:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\harmony" -I"C:\PROGRA~2\Flowcode\COMPIL~1\pic32\batch\..\harmony\framework" -w -c -ffunction-sections -O1 -o "PIC0_USB_MIDI_FLASH_V1_PIC32MX_32MX530F128H\PIC0_USB_MIDI_FLASH_V1_PIC32MX.o" "PIC0_USB_MIDI_FLASH_V1_PIC32MX.c" 
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT\PIC32BIT_CAL_CAN.c: In function 'FC_CAL_Internal_CAN_SendBuffer_1':
PIC0_USB_MIDI_FLASH_V1_PIC32MX.c:117:17: error: expected identifier or '(' before numeric constant
 #define timeout 10
                 ^
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT\PIC32BIT_CAL_CAN.c:376:12: note: in expansion of macro 'timeout'
  MX_UINT32 timeout = 0xFFFF;
            ^
In file included from C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\includes.c:238:0,
                 from PIC0_USB_MIDI_FLASH_V1_PIC32MX.c:715:
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT\PIC32BIT_CAL_CAN.c:383:44: error: lvalue required as decrement operand
      while (C1FIFOCON0bits.TXREQ && timeout--);
                                            ^
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT\PIC32BIT_CAL_CAN.c:387:44: error: lvalue required as decrement operand
      while (C1FIFOCON1bits.TXREQ && timeout--);
                                            ^
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT\PIC32BIT_CAL_CAN.c:391:44: error: lvalue required as decrement operand
      while (C1FIFOCON2bits.TXREQ && timeout--);
                                            ^
Error(s) in build

C:\Program Files (x86)\Flowcode\Compilers\pic32\batch\PIC32compHID.bat reported error code 1
I am using the updated batch files that Ben provided in a past post https://www.matrixtsl.com/temp/pic32_USB.zip

Could you have a look please? Cheers,
R

Re: PIC32MX + USB HID + CAN Doesn't Compile

Posted: Wed Sep 23, 2020 6:32 pm
by ronaldlijs
Hi there,

If you want to investigate why this is not working it would be really great.

I have now tried with dsPIC33EP256MU806, i.e. USB HID + CAN Bus + I2C RTC + SPI FLASH and it does compile and doesn't give any errors, so will give this MCU a try and report back if something doesn't work when I get the board working :)

Regards,
R

Re: PIC32MX + USB HID + CAN Doesn't Compile

Posted: Thu Sep 24, 2020 1:40 pm
by Benj
Hello,

Thanks and glad you're up and running with a different device. The PIC32 is not currently supporting the USB components as detailed in the component tooltip.
PIC32USB.jpg
PIC32USB.jpg (19.79 KiB) Viewed 3445 times
I'll see if this is something we can add soon.

Re: PIC32MX + USB HID + CAN Doesn't Compile

Posted: Thu Sep 24, 2020 5:08 pm
by ronaldlijs
Thanks Ben,

No problem for that, I had dsPIC33EP runinng with CAN before and worked like a charm, if USB also works on the device, then that'll do it... we wouldn't need support for USB on PIC32 for now.

Cheers!
R